From 4e4add5287aa7b4eb0a9a5437d5cd891c1c37ef9 Mon Sep 17 00:00:00 2001 From: pulipakaa24 Date: Sat, 3 Jan 2026 17:47:07 -0600 Subject: [PATCH] bugfix --- include/WiFi.cpp | 4 ++++ include/calibration.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/WiFi.cpp b/include/WiFi.cpp index 22704c7..80ca08c 100644 --- a/include/WiFi.cpp +++ b/include/WiFi.cpp @@ -220,6 +220,10 @@ void WiFi::processScanResults() { if (ap_count > 10) ap_count = 10; wifi_ap_record_t *ap_list = (wifi_ap_record_t *)malloc(sizeof(wifi_ap_record_t) * ap_count); + if (ap_list == NULL) { + printf("Heap allocation error in processScanResults\n"); + return; + } ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&ap_count, ap_list)); // 3. Build JSON using cJSON diff --git a/include/calibration.cpp b/include/calibration.cpp index dd77548..e472015 100644 --- a/include/calibration.cpp +++ b/include/calibration.cpp @@ -10,7 +10,7 @@ void Calibration::init() { uint8_t tempCalib; esp_err_t err = ESP_OK; err |= nvs_get_i32(calibHandle, UpTicksTag, &tempUpTicks); - err |= nvs_get_i32(calibHandle, DownTicksTag, &tempUpTicks); + err |= nvs_get_i32(calibHandle, DownTicksTag, &tempDownTicks); err |= nvs_get_u8(calibHandle, statusTag, &tempCalib); if (err == ESP_OK) { UpTicks = tempUpTicks;