gpio handler is working

This commit is contained in:
Zwer2k
2021-07-04 23:59:59 +02:00
parent 7b8f10a14e
commit b205326782
24 changed files with 719 additions and 112 deletions

View File

@@ -502,10 +502,8 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
if (strcmp(filepath, CONFIG_FILE) == 0) {
printf("New config foung. Reload handler.");
gpio_handler_deinit();
MQTTdestroy();
if (gpioHandler != NULL) {
gpioHandler->destroy();
}
}
return ESP_OK;

View File

@@ -12,7 +12,7 @@
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "esp_event.h"
#include "esp_log.h"
#include <esp_ota_ops.h>
#include "esp_http_client.h"
@@ -28,6 +28,7 @@
#include "server_tflite.h"
#include "server_file.h"
#include "server_main.h"
#include "ClassLogFile.h"
@@ -375,6 +376,8 @@ esp_err_t handler_ota_update(httpd_req_t *req)
const char* resp_str;
KillTFliteTasks();
gpio_handler_deinit();
if (ota_example_task(fn))
{
resp_str = "Firmware Update Successfull!<br><br>You can restart now.";
@@ -401,8 +404,6 @@ void hard_restart() {
void task_reboot(void *pvParameter)
{
while(1)
{
vTaskDelay(5000 / portTICK_PERIOD_MS);
@@ -414,12 +415,14 @@ void task_reboot(void *pvParameter)
}
void doReboot(){
LogFile.WriteToFile("Reboot - now");
KillTFliteTasks();
ESP_LOGI(TAGPARTOTA, "Reboot in 5sec");
LogFile.WriteToFile("Reboot in 5sec");
xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL);
// KillTFliteTasks(); // kills itself
gpio_handler_destroy();
vTaskDelay(5000 / portTICK_PERIOD_MS);
esp_restart();
hard_restart();
hard_restart();
}