Fix WDT, Web refresh bug
This commit is contained in:
@ -116,7 +116,7 @@ static const char* html_page =
|
|||||||
" <p><strong>Speed:</strong> <span id=\"speed\">0</span>%</p>"
|
" <p><strong>Speed:</strong> <span id=\"speed\">0</span>%</p>"
|
||||||
" <p><strong>Target:</strong> <span id=\"target\">0</span>%</p>"
|
" <p><strong>Target:</strong> <span id=\"target\">0</span>%</p>"
|
||||||
" <div id=\"rampStatus\" class=\"ramping\" style=\"display: none;\">"
|
" <div id=\"rampStatus\" class=\"ramping\" style=\"display: none;\">"
|
||||||
" <strong>⚡ Ramping in progress...</strong>"
|
" <strong>Ramping in progress...</strong>"
|
||||||
" </div>"
|
" </div>"
|
||||||
" </div>"
|
" </div>"
|
||||||
" "
|
" "
|
||||||
@ -209,15 +209,28 @@ static void apply_motor_pwm(int speed_percent);
|
|||||||
void init_watchdog(void) {
|
void init_watchdog(void) {
|
||||||
ESP_LOGI(TAG, "Setting up watchdog monitoring...");
|
ESP_LOGI(TAG, "Setting up watchdog monitoring...");
|
||||||
|
|
||||||
// The system watchdog is already monitoring the main task
|
// Get current task handle and add to watchdog
|
||||||
// We don't need to add anything, just need to reset it properly
|
main_task_handle = xTaskGetCurrentTaskHandle();
|
||||||
ESP_LOGI(TAG, "Using system watchdog - will reset from main context");
|
esp_err_t result = esp_task_wdt_add(main_task_handle);
|
||||||
|
|
||||||
|
if (result == ESP_OK) {
|
||||||
|
ESP_LOGI(TAG, "Main task added to watchdog monitoring");
|
||||||
|
} else if (result == ESP_ERR_INVALID_ARG) {
|
||||||
|
ESP_LOGI(TAG, "Task already monitored by watchdog");
|
||||||
|
} else {
|
||||||
|
ESP_LOGW(TAG, "Watchdog not available: %s", esp_err_to_name(result));
|
||||||
|
main_task_handle = NULL; // Disable watchdog feeding
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feed the watchdog
|
// Feed the watchdog
|
||||||
void feed_watchdog(void) {
|
void feed_watchdog(void) {
|
||||||
// Simply reset the watchdog for the current task context
|
if (main_task_handle != NULL) {
|
||||||
esp_task_wdt_reset();
|
esp_err_t result = esp_task_wdt_reset();
|
||||||
|
if (result != ESP_OK) {
|
||||||
|
ESP_LOGD(TAG, "Watchdog reset failed: %s", esp_err_to_name(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WiFi event handler
|
// WiFi event handler
|
||||||
|
|||||||
Reference in New Issue
Block a user