diff --git a/firmware/components/sen5x/sen5x_app.c b/firmware/components/sen5x/sen5x_app.c index 0480181..23b3759 100644 --- a/firmware/components/sen5x/sen5x_app.c +++ b/firmware/components/sen5x/sen5x_app.c @@ -20,10 +20,6 @@ #include // NAN, isfinite, lround #include "vars.h" -// i2cdev API (aus i2cdev.c) -esp_err_t i2cdev_init(void); -esp_err_t i2cdev_done(void); - static const char* TAG = "sen5x_app"; /* ====================== Konfiguration ====================== */ @@ -308,13 +304,18 @@ void sen5x_app_deinit(void) { ESP_LOGI(TAG, "Deinitializing SEN5x app..."); - g_run = false; // Producer freundlich bitten zu stoppen + g_run = false; - // Warten, bis der Producer sich selbst beendet hat for (int i = 0; i < 50 && g_task_prod; i++) { vTaskDelay(pdMS_TO_TICKS(10)); } + if (g_task_prod) { + ESP_LOGW(TAG, "Producer did not stop in time; skip sen5x_stop_measurement/HAL free"); + // Hier NICHT sen5x_stop_measurement() / HAL free, weil Task evtl. noch I2C nutzt + return; + } + net_influx_stop(); if (g_device_tag) {