diff --git a/examples/StepperDemo/StepperDemo.ino b/examples/StepperDemo/StepperDemo.ino index dfd1a3e7..13e17d1d 100644 --- a/examples/StepperDemo/StepperDemo.ino +++ b/examples/StepperDemo/StepperDemo.ino @@ -1143,6 +1143,10 @@ int8_t get_val1_val2_val3(char *cmd) { return -1; } +#if ESP_IDF_VERSION_MAJOR == 5 +const esp_task_wdt_config_t wdt_config = {.timeout_ms = 1, .idle_core_mask = 1, .trigger_panic = true}; +#endif + bool process_cmd(char *cmd) { FastAccelStepper *stepper_selected = stepper[selected]; uint16_t s = *cmd++; @@ -1164,23 +1168,25 @@ bool process_cmd(char *cmd) { } break; case MODE(normal, 'r'): -#if defined(ARDUINO_ARCH_ESP32) +#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM) if (strcmp(cmd, "eset") == 0) { PRINTLN("ESP reset"); #if ESP_IDF_VERSION_MAJOR == 5 - esp_task_wdt_config_t config = { - .timeout_ms = 1, .idle_core_mask = 1, .trigger_panic = 0}; - esp_task_wdt_reconfigure(&config); + esp_task_wdt_reconfigure(&wdt_config); #else esp_task_wdt_init(1, true); esp_task_wdt_add(NULL); #endif - while (true) - ; + while (true) {} } +#if ESP_IDF_VERSION_MAJOR == 5 + esp_task_wdt_reconfigure(&wdt_config); + while (true) {} +#else PRINTLN("ESP restart"); ESP.restart(); #endif +#endif #if defined(ARDUINO_ARCH_AVR) if (*cmd == 0) { output_msg(MSG_STRAY_DIGITAL_READ_TOGGLE); diff --git a/examples/StepperDemo/generic.h b/examples/StepperDemo/generic.h index 860ac570..68dfba27 100644 --- a/examples/StepperDemo/generic.h +++ b/examples/StepperDemo/generic.h @@ -26,13 +26,13 @@ /* wait for USB serial port to connect */ \ } #define PRINTLN USBSerial.println -#define PRINTCH USBSerial.println -#define PRINTU8 USBSerial.println -#define PRINTU16 USBSerial.println -#define PRINTI16 USBSerial.println -#define PRINTU32 USBSerial.println -#define PRINTI32 USBSerial.println -#define PRINT USBSerial.println +#define PRINTCH USBSerial.print +#define PRINTU8 USBSerial.print +#define PRINTU16 USBSerial.print +#define PRINTI16 USBSerial.print +#define PRINTU32 USBSerial.print +#define PRINTI32 USBSerial.print +#define PRINT USBSerial.print #define POLL_CHAR_IF_ANY(ch) \ if (USBSerial.available()) { \ ch = USBSerial.read(); \ @@ -44,13 +44,13 @@ #define PRINT_INIT() Serial.begin(115200); #define PRINTLN Serial.println -#define PRINTCH Serial.println -#define PRINTU8 Serial.println -#define PRINTU16 Serial.println -#define PRINTI16 Serial.println -#define PRINTU32 Serial.println -#define PRINTI32 Serial.println -#define PRINT Serial.println +#define PRINTCH Serial.print +#define PRINTU8 Serial.print +#define PRINTU16 Serial.print +#define PRINTI16 Serial.print +#define PRINTU32 Serial.print +#define PRINTI32 Serial.print +#define PRINT Serial.print #define POLL_CHAR_IF_ANY(ch) \ if (Serial.available()) { \ ch = Serial.read(); \ diff --git a/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt index c6362875..f5d073ad 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt @@ -4,9 +4,9 @@ EnableA: 1*L->H, 1*H->L EnableB: 2*L->H, 1*H->L EnableC: 2*L->H, 1*H->L - StepA: 64000*L->H, 64000*H->L, Max High=23us Total High=312934us - StepB: 64000*L->H, 64000*H->L, Max High=31us Total High=360420us - StepC: 64000*L->H, 64000*H->L, Max High=36us Total High=391279us + StepA: 64000*L->H, 64000*H->L, Max High=22us Total High=312923us + StepB: 64000*L->H, 64000*H->L, Max High=33us Total High=360304us + StepC: 64000*L->H, 64000*H->L, Max High=35us Total High=391846us Position[A]=64000 Position[B]=64000 @@ -19,11 +19,11 @@ Time in EnableB max=246086 us, total=246086 us Time in EnableC max=254243 us, total=254243 us -Time in FillISR max=2757 us, total=2118948 us +Time in FillISR max=2774 us, total=2119073 us -Time in StepA max=23 us, total=312934 us +Time in StepA max=22 us, total=312923 us -Time in StepB max=31 us, total=360420 us +Time in StepB max=33 us, total=360304 us -Time in StepC max=36 us, total=391279 us +Time in StepC max=35 us, total=391846 us diff --git a/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt index 5185ca54..43aa3290 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt @@ -2,8 +2,8 @@ DirB: 1*L->H, 0*H->L EnableA: 1*L->H, 1*H->L EnableB: 2*L->H, 1*H->L - StepA: 1000*L->H, 1000*H->L, Max High=13us Total High=4237us - StepB: 1000*L->H, 1000*H->L, Max High=19us Total High=5051us + StepA: 1000*L->H, 1000*H->L, Max High=13us Total High=4234us + StepB: 1000*L->H, 1000*H->L, Max High=14us Total High=5038us Position[A]=1000 Position[B]=1000 @@ -12,11 +12,11 @@ Time in EnableA max=225398 us, total=225398 us Time in EnableB max=238118 us, total=238118 us -Time in FillISR max=2651 us, total=47834 us +Time in FillISR max=2651 us, total=47826 us -Time in StepA max=13 us, total=4237 us +Time in StepA max=13 us, total=4234 us -Time in StepB max=19 us, total=5051 us +Time in StepB max=14 us, total=5038 us Time in StepISR max=6 us, total=8566 us diff --git a/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt index 7a9ccf19..b668de35 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt @@ -2,7 +2,7 @@ DirB: 1*L->H, 0*H->L EnableA: 1*L->H, 1*H->L EnableB: 1*L->H, 0*H->L - StepA: 1000*L->H, 1000*H->L, Max High=9us Total High=3953us + StepA: 1000*L->H, 1000*H->L, Max High=9us Total High=3978us StepB: 0*L->H, 0*H->L, Max High=0us Total High=0us Position[A]=1000 @@ -10,7 +10,7 @@ Time in EnableA max=225399 us, total=225399 us Time in FillISR max=2023 us, total=27791 us -Time in StepA max=9 us, total=3953 us +Time in StepA max=9 us, total=3978 us Time in StepISR max=5 us, total=3975 us