@@ -485,7 +485,7 @@ static void autopid_task(void *pvParameters)
485
485
486
486
case READ_PID :
487
487
{
488
- uint8_t pid_no_response = 0 ;
488
+ uint8_t pid_response = 0 ;
489
489
if (num_of_pids > 0 )
490
490
{
491
491
for (uint32_t i = 0 ; i < num_of_pids ; i ++ )
@@ -524,6 +524,7 @@ static void autopid_task(void *pvParameters)
524
524
525
525
// Convert the cJSON object to a string
526
526
response_str = cJSON_PrintUnformatted (rsp_json );
527
+ pid_response = 1 ;
527
528
}
528
529
529
530
if (response_str != NULL )
@@ -568,7 +569,6 @@ static void autopid_task(void *pvParameters)
568
569
vTaskDelay (pdMS_TO_TICKS (10 ));
569
570
free (error_rsp );
570
571
}
571
- pid_no_response = 1 ;
572
572
}
573
573
}
574
574
vTaskDelay (pdMS_TO_TICKS (2 ));
@@ -620,6 +620,7 @@ static void autopid_task(void *pvParameters)
620
620
// Add the name and result to the JSON object
621
621
cJSON_AddNumberToObject (rsp_json , car .pids [i ].parameters [j ].name , result );
622
622
ESP_LOGI (TAG , "Expression result, Name: %s: %lf" , car .pids [i ].parameters [j ].name , result );
623
+ pid_response = 1 ;
623
624
}
624
625
}
625
626
else
@@ -628,7 +629,7 @@ static void autopid_task(void *pvParameters)
628
629
if (asprintf (& error_rsp , "{\"error\": \"Failed Expression: %s\"}" , car .pids [i ].parameters [j ].expression ) != -1 )
629
630
{
630
631
mqtt_publish (error_topic , error_rsp , 0 , 0 , 0 );
631
- autopid_data_write (error_rsp );
632
+ // autopid_data_write(error_rsp);
632
633
vTaskDelay (pdMS_TO_TICKS (10 ));
633
634
free (error_rsp );
634
635
}
@@ -640,7 +641,7 @@ static void autopid_task(void *pvParameters)
640
641
if (asprintf (& error_rsp , "{\"error\": \"Failed Expression: %s\"}" , car .pids [i ].parameters [j ].expression ) != -1 )
641
642
{
642
643
mqtt_publish (error_topic , error_rsp , 0 , 0 , 0 );
643
- autopid_data_write (error_rsp );
644
+ // autopid_data_write(error_rsp);
644
645
vTaskDelay (pdMS_TO_TICKS (10 ));
645
646
free (error_rsp );
646
647
}
@@ -653,11 +654,10 @@ static void autopid_task(void *pvParameters)
653
654
if (asprintf (& error_rsp , "{\"error\": \"Timeout, pid: %s\"}" , car .pids [i ].pid ) != -1 )
654
655
{
655
656
mqtt_publish (error_topic , error_rsp , 0 , 0 , 0 );
656
- autopid_data_write (error_rsp );
657
+ // autopid_data_write(error_rsp);
657
658
vTaskDelay (pdMS_TO_TICKS (10 ));
658
659
free (error_rsp );
659
660
}
660
- pid_no_response = 1 ;
661
661
}
662
662
}
663
663
else
@@ -666,11 +666,10 @@ static void autopid_task(void *pvParameters)
666
666
if (asprintf (& error_rsp , "{\"error\": \"PID Error\"}" ) != -1 )
667
667
{
668
668
mqtt_publish (error_topic , error_rsp , 0 , 0 , 0 );
669
- autopid_data_write (error_rsp );
669
+ // autopid_data_write(error_rsp);
670
670
vTaskDelay (pdMS_TO_TICKS (10 ));
671
671
free (error_rsp );
672
672
}
673
- pid_no_response = 1 ;
674
673
}
675
674
}
676
675
@@ -687,7 +686,7 @@ static void autopid_task(void *pvParameters)
687
686
}
688
687
}
689
688
vTaskDelay (pdMS_TO_TICKS (10 ));
690
- if (pid_no_response )
689
+ if (pid_response == 0 )
691
690
{
692
691
autopid_state = DISCONNECT_NOTIFY ;
693
692
ESP_LOGI (TAG , "State change --> DISCONNECT_NOTIFY" );
0 commit comments