mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-17 13:08:40 +03:00
gpio handler is working
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user