Skip to content

Commit

Permalink
fix simavr expectations for StepperDemo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Aug 25, 2024
1 parent e87542c commit c214af0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 34 deletions.
18 changes: 12 additions & 6 deletions examples/StepperDemo/StepperDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand All @@ -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);
Expand Down
28 changes: 14 additions & 14 deletions examples/StepperDemo/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); \
Expand All @@ -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(); \
Expand Down
14 changes: 7 additions & 7 deletions extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

10 changes: 5 additions & 5 deletions extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
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

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

0 comments on commit c214af0

Please sign in to comment.