From a18f8b7a1f750db743f2c4ca41cddd4267aab68b Mon Sep 17 00:00:00 2001 From: thek4n Date: Fri, 5 Jun 2026 12:53:54 +0300 Subject: [PATCH] fix --- main/main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/main/main.c b/main/main.c index 78bd371..3ffbdff 100644 --- a/main/main.c +++ b/main/main.c @@ -39,18 +39,14 @@ static adc_oneshot_unit_handle_t adc_handle; static adc_cali_handle_t cali_handle; static bool is_calibrated = false; -static int g_threshold_low = 0; -static int g_threshold_up = 0; +static atomic_int g_threshold_low = 0; +static atomic_int g_threshold_up = 0; -static int g_current_pressure = 0; +static atomic_int g_current_pressure = 0; -// ==================== ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ ==================== static const char *TAG = "ESP32_AP_SERVER"; -atomic_int low_treshhold = 0; -atomic_int up_treshhold = 0; - esp_err_t adc_init(void) { // Инициализация ADC @@ -365,10 +361,10 @@ static esp_err_t save_thresholds_handler(httpd_req_t *req) { return 1; } - err = nvs_set_i32(my_handle, "treshhold_low", low_value); + err = nvs_set_i32(my_handle, "threshold_low", low_value); ESP_ERROR_CHECK(err); - err = nvs_set_i32(my_handle, "treshhold_up", up_value); + err = nvs_set_i32(my_handle, "threshold_up", up_value); ESP_ERROR_CHECK(err); // 4. Сохраняем изменения во flash