fix compiler warnings. fix bug where drive dist was not properly capped.

This commit is contained in:
Thaddeus Hughes
2026-03-12 21:18:32 -05:00
parent cdb3b11db1
commit 77548e7e9f
8 changed files with 14 additions and 20 deletions

View File

@@ -57,6 +57,7 @@
20. - [ ] Extract pure logic (e-fuse thermal model, param serialization, sensor debounce) into host-testable modules with Unity/CMock
21. - [ ] UART integration test framework: Python runner + ESP-side test commands
22. - [ ] Fix compile warnings
23. - [ ] Check if NVS needed for wifi/bluetooth (research first; what is it actually used for? can it be done without?)
24. - [ ] If NVS needed for wifi/bluetooth, compare its space efficiency, runtime efficiency, and security (errorchecking/crashes) to current params architecture
22. - [clauded] Fix compile warnings — unused vars (uart_comms.c, rf_433.c), const-correctness (log_write signatures), fallthrough annotation (control_fsm.c)
25. - [clauded] BUG FIX: `FSM_CMD_START` fallthrough was overwriting `this_move_dist = MIN(...)` with unconditional `DRIVE_DIST` — replaced fallthrough with goto to shared start logic so leash limit is preserved
23. - [clauded] NVS is required: WiFi blob stores RF cal data (CONFIG_ESP_WIFI_NVS_ENABLED), Bluedroid stores bonding/GATT cache unconditionally, bt_hid.c stores last-connected BDA. Cannot remove nvs_flash_init().
24. - [clauded] NVS vs custom params: NVS serves WiFi/BT internals + BDA storage; custom flash partition serves app params with CRC32 protection. Different purposes, no consolidation needed.

View File

@@ -211,8 +211,10 @@ void control_task(void *param) {
continue;
}
this_move_dist = MIN(get_param_value_t(PARAM_DRIVE_DIST).f32, remaining_distance);
goto do_start;
case FSM_CMD_START_IGNORE_OVERTRAVEL:
this_move_dist = get_param_value_t(PARAM_DRIVE_DIST).f32;
do_start:
if (current_state == STATE_IDLE) {
if (get_battery_V() < get_param_value_t(PARAM_LOW_PROTECTION_V).f32) {

View File

@@ -145,15 +145,6 @@ static void rf_433_receiver_task(void* param) {
ESP_LOGI(TAG, "LEARNED KEYCODE (temp storage)");
learn_flag = -1;
} else if (controls_enabled) {
// Only process RF commands if controls are enabled
rf_code_t rf_msg = {
.code = code,
.high_avg = high / 24,
.low_avg = low / 24,
.errors = err,
.num_symbols = len
};
for (uint8_t i = 0; i < NUM_RF_BUTTONS; i++) {
uint32_t match = get_param_value_t(PARAM_KEYCODE_0+i).u32;
// Compare just the code (lower 32 bits)

View File

@@ -724,7 +724,7 @@ static inline void find_head_tail(int32_t num_sectors, int32_t *head, int32_t *t
// Replace log_write with this non-blocking version:
esp_err_t log_write(uint8_t* buf, uint8_t len, uint8_t type) {
esp_err_t log_write(const uint8_t* buf, uint8_t len, uint8_t type) {
if (!log_initialized || log_partition == NULL) {
ESP_LOGE(TAG, "Logging not initialized");
return ESP_FAIL;
@@ -761,7 +761,7 @@ esp_err_t log_write(uint8_t* buf, uint8_t len, uint8_t type) {
}
// The actual blocking write function (called by the task)
static esp_err_t log_write_blocking(uint8_t* buf, uint8_t len, uint8_t type) {
static esp_err_t log_write_blocking(const uint8_t* buf, uint8_t len, uint8_t type) {
if (!log_initialized || log_partition == NULL) {
ESP_LOGE(TAG, "Logging not initialized");
return ESP_FAIL;
@@ -1319,7 +1319,7 @@ esp_err_t log_simulate_power_cycle(void) {
return ESP_OK;
}
esp_err_t log_write_blocking_test(uint8_t* buf, uint8_t len, uint8_t type) {
esp_err_t log_write_blocking_test(const uint8_t* buf, uint8_t len, uint8_t type) {
// Check queue space - wait if nearly full
while (uxQueueSpacesAvailable(log_queue) < 2) {
vTaskDelay(pdMS_TO_TICKS(10));

View File

@@ -171,7 +171,7 @@ esp_err_t commit_params(void);
// Logging functions
esp_err_t log_init(void);
esp_err_t log_write(uint8_t* buf, uint8_t len, uint8_t type);
esp_err_t log_write(const uint8_t* buf, uint8_t len, uint8_t type);
uint32_t log_get_head(void);
uint32_t log_get_tail(void);
uint32_t log_get_offset(void);
@@ -188,5 +188,5 @@ esp_err_t log_read(uint8_t* len, uint8_t* buf, uint8_t* type);
esp_err_t log_erase_all_sectors(void);
esp_err_t log_simulate_power_cycle(void);
void log_read_reset(void);
esp_err_t log_write_blocking_test(uint8_t* buf, uint8_t len, uint8_t type);
esp_err_t log_write_blocking_test(const uint8_t* buf, uint8_t len, uint8_t type);
#endif // STORAGE_H

View File

@@ -62,7 +62,7 @@ static void cmd_post(char *json_data) {
// Call the unified POST handler
cJSON *response = NULL;
esp_err_t err = comms_handle_post(request, &response);
(void)comms_handle_post(request, &response);
cJSON_Delete(request);
if (response == NULL) {

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@
#include <Arduino.h>
const unsigned char PROGMEM html_content_gz[] = {
0x1f, 0x8b, 0x08, 0x00, 0x18, 0x55, 0xb3, 0x69, 0x02, 0xff, 0xed, 0x3d, 0xfb, 0x5b, 0xdb, 0x48,
0x1f, 0x8b, 0x08, 0x00, 0x58, 0x6d, 0xb3, 0x69, 0x02, 0xff, 0xed, 0x3d, 0xfb, 0x5b, 0xdb, 0x48,
0x92, 0x3f, 0xef, 0xfc, 0x15, 0x0d, 0x93, 0x21, 0x52, 0x10, 0xb2, 0x0d, 0x64, 0x66, 0xd6, 0x46,
0x66, 0x09, 0x38, 0x3b, 0x4c, 0x12, 0xe0, 0xc3, 0x90, 0xcc, 0x1c, 0xc7, 0x87, 0x64, 0xab, 0x8d,
0x35, 0xc8, 0x92, 0x57, 0x92, 0x21, 0x5e, 0xe3, 0xff, 0xfd, 0xaa, 0xfa, 0x21, 0xb5, 0x1e, 0x36,