Procházet zdrojové kódy

Kontaktor is inverted

Thomas Chef před 2 roky
rodič
revize
08ffacb736
1 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 4 3
      main/http_client.c

+ 4 - 3
main/http_client.c

@@ -93,7 +93,8 @@ void http_rest_with_url()
 {
     char local_response_buffer[MAX_HTTP_RECV_BUFFER] = {0};
 
-    uint32_t kontaktor = 1;     // The default state is always ON
+    // The default state of VVB is always ON (kontaktor is normally closed, so control value is inverted)
+    uint32_t kontaktor = 0;     // Kontaktor 0 = VVB ON
 
     esp_http_client_config_t config = {
         .url = "http://192.168.1.110/electrical/system/isBoilerOn.php",
@@ -117,7 +118,7 @@ void http_rest_with_url()
                 ESP_LOGI(TAG, "HTTP Received: Ok" );
                 if( strstr(local_response_buffer,"OFF") != NULL ) {
                     ESP_LOGI(TAG, "HTTP Received: OFF" );
-                    kontaktor = 0;
+                    kontaktor = 1;
                 }
                 else if( strstr(local_response_buffer,"ON") != NULL ) {
                     ESP_LOGI(TAG, "HTTP Received: ON" );
@@ -131,7 +132,7 @@ void http_rest_with_url()
     
     esp_http_client_cleanup(client);
 
-    ESP_LOGI(TAG, "Change relay state: %u",kontaktor);
+    ESP_LOGI(TAG, "Set kontaktor state: %u",kontaktor);
     gpio_set_level(VVB_RELAY_OUTPUT_IO, kontaktor);
 }