21 Commits

Author SHA256 Message Date
localhorst 4f355bdfdf update README 2026-01-10 18:51:33 +01:00
localhorst 430b4cb690 cleanup README 2026-01-10 13:42:24 +01:00
localhorst 1d4e272d80 error handling and cleanup 2026-01-10 13:32:49 +01:00
localhorst f8f6af53bd implement config 2026-01-10 12:50:06 +01:00
localhorst f3f6f1bc5f Potential division by zero 2026-01-10 12:01:22 +01:00
localhorst b718073907 Missing break before default 2026-01-10 11:58:46 +01:00
localhorst d36b91a0fd Variable name shadows type name 2026-01-10 11:57:15 +01:00
localhorst 40f757b7d1 uUnchangedCounter reset logic flaw 2026-01-10 11:54:18 +01:00
localhorst a9ec101bc6 Floating-point equality comparison 2026-01-10 11:52:08 +01:00
localhorst 0236ebcdd1 Unsafe strcpy 2026-01-10 11:47:04 +01:00
localhorst 05757a5038 Unchecked WiFi API call 2026-01-10 11:45:49 +01:00
localhorst 020eb63e05 Unchecked network configuration 2026-01-10 11:43:26 +01:00
localhorst 67929580d5 Unchecked xEventGroupCreate 2026-01-10 11:42:27 +01:00
localhorst 10f9645580 Unchecked gpio_config returns 2026-01-10 11:39:37 +01:00
localhorst df3825df3a Non-thread-safe function 2026-01-10 11:33:37 +01:00
localhorst 8c3dbc2886 Unprotected shared state access 2026-01-10 11:31:34 +01:00
localhorst 267197ec20 Missing mutex protection 2026-01-10 11:06:10 +01:00
localhorst 781f9a1445 ncorrect memset with strlen 2026-01-10 11:02:31 +01:00
localhorst 09a3c3a22d Misuse of ESP_ERROR_CHECK 2026-01-10 10:58:12 +01:00
localhorst 0775fda0ca Off-by-one error (buffer overread) 2026-01-10 10:55:15 +01:00
localhorst cd73985740 Wrong memset size 2026-01-10 10:54:32 +01:00
7 changed files with 11 additions and 81 deletions
-2
View File
@@ -291,5 +291,3 @@ dkms.conf
*.out
*.app
managed_components/
dependencies.lock
+3
View File
@@ -1,3 +1,6 @@
set(EXTRA_COMPONENT_DIRS $ENV{ESP_IDF_LIB_PATH}/components)
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
-14
View File
@@ -36,20 +36,6 @@ menu "Smart Oil Heating Control System"
default "192.168.0.1"
help
NTP server address for time synchronization.
config ENV_WIFI_BSSID_LOCK
bool "Lock to specific Access Point (BSSID)"
default n
help
When enabled, the device will only connect to the access point
with the specified MAC address (BSSID). Useful when multiple APs
share the same SSID.
config ENV_WIFI_BSSID
string "Access Point MAC Address (BSSID)"
default "00:00:00:00:00:00"
depends on ENV_WIFI_BSSID_LOCK
help
MAC address of the access point to connect to.
Format: XX:XX:XX:XX:XX:XX (uppercase or lowercase)
endmenu
menu "GPIO Configuration"
+7 -8
View File
@@ -291,7 +291,6 @@ eControlState getControlState(void)
eControlWeekday getControlCurrentWeekday(void)
{
// Get current time
time_t now;
struct tm timeinfo;
time(&now);
@@ -358,15 +357,15 @@ static void findControlCurrentTemperatureEntry(void)
const sControlDay *sunday = &gControlTable[6];
gCurrentControlEntry = sunday->aTemperatureEntries[sunday->entryCount - 1];
}
xSemaphoreGiveRecursive(xMutexAccessControl);
/*
ESP_LOGI(TAG, "Active entry found - Time: %02d:%02d, "
"Return Temp: %lf, Chamber Temp: %lf",
gCurrentControlEntry.timestamp.hour,
gCurrentControlEntry.timestamp.minute,
gCurrentControlEntry.fReturnFlowTemperature,
gCurrentControlEntry.fChamberTemperature);
*/
xSemaphoreGiveRecursive(xMutexAccessControl);
"Return Temp: %lf, Chamber Temp: %lf",
gCurrentControlEntry.timestamp.hour,
gCurrentControlEntry.timestamp.minute,
gCurrentControlEntry.fReturnFlowTemperature,
gCurrentControlEntry.fChamberTemperature);
*/
return;
}
}
-17
View File
@@ -1,17 +0,0 @@
## IDF Component Manager Manifest File
dependencies:
## Required IDF version
idf:
version: '>=4.1.0'
# # Put list of dependencies here
# # For components maintained by Espressif:
# component: "~1.0.0"
# # For 3rd party components:
# username/component: ">=1.0.0,<2.0.0"
# username2/component2:
# version: "~1.0.0"
# # For transient dependencies `public` flag can be set.
# # `public` flag doesn't have an effect dependencies of the `main` component.
# # All dependencies of `main` are public by default.
# public: true
esp-idf-lib/ds18x20: '*'
+1
View File
@@ -31,6 +31,7 @@ static sSensorSanityCheck sanityChecks[NUMBER_OF_SENSOR_SANITY_CHECKS] = {
{SENSOR_NO_ERROR, "outdoor_temperature", {SENSOR_LIMIT_OUTDOOR_MAX, SENSOR_LIMIT_OUTDOOR_MIN}, 0.0f, 0U, getOutdoorTemperature},
{SENSOR_NO_ERROR, "inlet_flow_temperature", {SENSOR_LIMIT_INLET_MAX, SENSOR_LIMIT_INLET_MIN}, 0.0f, 0U, getInletFlowTemperature},
{SENSOR_NO_ERROR, "return_flow_temperature", {SENSOR_LIMIT_RETURN_MAX, SENSOR_LIMIT_RETURN_MIN}, 0.0f, 0U, getReturnFlowTemperature}};
static eSafetyState sSafetyState = SAFETY_NO_ERROR;
/* Private function prototypes */
-40
View File
@@ -37,7 +37,6 @@ static bool s_initial_connect = true;
static void event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data);
static bool parse_bssid(const char *bssid_str, uint8_t *bssid);
esp_err_t initWifi(void)
{
@@ -81,21 +80,6 @@ esp_err_t initWifi(void)
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
},
};
#if CONFIG_ENV_WIFI_BSSID_LOCK
/* Lock to specific AP by BSSID */
if (parse_bssid(CONFIG_ENV_WIFI_BSSID, wifi_config.sta.bssid))
{
wifi_config.sta.bssid_set = true;
ESP_LOGI(TAG, "BSSID lock enabled: %s", CONFIG_ENV_WIFI_BSSID);
}
else
{
ESP_LOGE(TAG, "Invalid BSSID format: %s", CONFIG_ENV_WIFI_BSSID);
wifi_config.sta.bssid_set = false;
}
#endif
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
@@ -192,27 +176,3 @@ static void event_handler(void *arg, esp_event_base_t event_base,
}
}
}
/**
* @brief Parse BSSID string to byte array
*
* @param bssid_str BSSID string in format "XX:XX:XX:XX:XX:XX"
* @param bssid Output byte array (6 bytes)
* @return true on success, false on parse error
*/
static bool parse_bssid(const char *bssid_str, uint8_t *bssid)
{
unsigned int tmp[6];
int parsed = sscanf(bssid_str, "%x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2],
&tmp[3], &tmp[4], &tmp[5]);
if (parsed != 6)
{
return false;
}
for (int i = 0; i < 6; i++)
{
bssid[i] = (uint8_t)tmp[i];
}
return true;
}