Skip to content

Commit

Permalink
fix StepperDemo compile error and adjust simavr limits
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Aug 25, 2024
1 parent 34f4a5d commit 450f552
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ pre-0.31.0:
- compatibility with esp-idf 5.3.0 (not working with 5.0.x to 5.2.x)
`pio run -e esp32_idf_V6_8_1` in `pio_espidf/UsageExample` works.
- Drop support for esp-idf 3.x.y versions
beta level. barely tested
- Add github build tests for esp32c6 with espidf5
- StepperDemo can be compiled with esp-idf4/5 without arduino

0.30.15:
- Fix missing initialization in `getCurrentSpeedInTicks()` (#262)
Expand Down
14 changes: 12 additions & 2 deletions examples/StepperDemo/StepperDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,20 @@ void test_direct_drive(const struct stepper_config_s *stepper) {

void setup() {
PRINT_INIT();
#ifdef ARDUINO_ARCH_ESP32
#if defined(ARDUINO_ARCH_ESP32)
printf("LOG start\n");
esp_log_level_set("*", ESP_LOG_INFO);
esp_log_level_set("rmt", ESP_LOG_INFO);
ESP_LOGI("StepperDemo", "Started INFO");
ESP_LOGE("*", "Started ERROR");
PRINTLN("");
#endif
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP_PLATFORM)
PRINT("ESP-IDF: ");
PRINTI16((int16_t)ESP_IDF_VERSION_MAJOR);
PRINTCH('.');
PRINTI16((int16_t)ESP_IDF_VERSION_MINOR);
PRINTLN("");
#endif

for(uint8_t i = 0;i < MAX_STEPPER;i++) {
Expand Down Expand Up @@ -1189,9 +1197,9 @@ bool process_cmd(char *cmd) {
ESP.restart();
#else
esp_reset();
#endif
#endif
}
#endif
#if defined(ARDUINO_ARCH_AVR)
if (*cmd == 0) {
output_msg(MSG_STRAY_DIGITAL_READ_TOGGLE);
Expand Down Expand Up @@ -1780,6 +1788,8 @@ extern "C" void app_main() {
esp_task_wdt_add(NULL);
#endif
esp_task_wdt_add(NULL);

printf("Non-arduino version\n");
setup();
while(true) {
loop();
Expand Down
6 changes: 6 additions & 0 deletions extras/tests/esp32_hw_based/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ test: M1.test M7.test
compile:
(cd ../../../pio_dirs/StepperDemo;rm -fR .pio; pio run -e esp32_V6_8_1 -t upload --upload-port /dev/$(DEV))

compile_idf4:
(cd ../../../pio_espidf/StepperDemo;rm -fR .pio; pio run -e esp32_idf_V5_3_0 -t upload --upload-port /dev/$(DEV))

compile_idf5:
(cd ../../../pio_espidf/StepperDemo;rm -fR .pio; pio run -e esp32_idf_V6_8_1 -t upload --upload-port /dev/$(DEV))

clean:
rm -f seq*.log
13 changes: 13 additions & 0 deletions extras/tests/esp32_hw_based/test_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# arduino idf4 based test
make compile
make M1.test M7.test

# idf4 based test
make compile_idf4
make M1.test M7.test

# idf5 only rmt-module supporting 8 steppers
make compile_idf5
make M1.test
16 changes: 8 additions & 8 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=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
StepA: 64000*L->H, 64000*H->L, Max High=22us Total High=313053us
StepB: 64000*L->H, 64000*H->L, Max High=34us Total High=360569us
StepC: 64000*L->H, 64000*H->L, Max High=35us Total High=384714us
Position[A]=64000

Position[B]=64000
Expand All @@ -17,13 +17,13 @@ Time in EnableA max=233599 us, total=233599 us

Time in EnableB max=246086 us, total=246086 us

Time in EnableC max=254243 us, total=254243 us
Time in EnableC max=254244 us, total=254244 us

Time in FillISR max=2774 us, total=2119073 us
Time in FillISR max=2774 us, total=2119112 us

Time in StepA max=22 us, total=312923 us
Time in StepA max=22 us, total=313053 us

Time in StepB max=33 us, total=360304 us
Time in StepB max=34 us, total=360569 us

Time in StepC max=35 us, total=391846 us
Time in StepC max=35 us, total=384714 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=4234us
StepB: 1000*L->H, 1000*H->L, Max High=14us Total High=5038us
StepA: 1000*L->H, 1000*H->L, Max High=13us Total High=4252us
StepB: 1000*L->H, 1000*H->L, Max High=15us Total High=5049us
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=47826 us
Time in FillISR max=2651 us, total=47834 us

Time in StepA max=13 us, total=4234 us
Time in StepA max=13 us, total=4252 us

Time in StepB max=14 us, total=5038 us
Time in StepB max=15 us, total=5049 us

Time in StepISR max=6 us, total=8566 us

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Position[A]=1000

Time in EnableA max=225399 us, total=225399 us

Time in FillISR max=2023 us, total=27791 us
Time in FillISR max=2023 us, total=27796 us

Time in StepA max=9 us, total=3978 us

Expand Down
6 changes: 3 additions & 3 deletions extras/tests/simavr_based/test_sd_11_328p/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
DirB: 1*L->H, 0*H->L
EnableA: 1*L->H, 1*H->L
EnableB: 1*L->H, 0*H->L
StepA: 99558*L->H, 99558*H->L, Max High=11us Total High=384501us
StepA: 99808*L->H, 99808*H->L, Max High=11us Total High=385248us
StepB: 0*L->H, 0*H->L, Max High=0us Total High=0us
Position[A]=50286
Position[A]=50536

Time in EnableA max=225395 us, total=225395 us

Time in StepA max=11 us, total=384501 us
Time in StepA max=11 us, total=385248 us

2 changes: 1 addition & 1 deletion src/fas_arch/espidf_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define LOW 0
#define HIGH 1
#define OUTPUT GPIO_MODE_OUTPUT
#define pinMode(pin, mode) gpio_set_direction((gpio_num_t)pin, mode)
#define pinMode(pin, mode) gpio_set_direction((gpio_num_t)pin, (mode) == OUTPUT ? GPIO_MODE_OUTPUT : GPIO_MODE_INPUT)
#define digitalWrite(pin, level) gpio_set_level((gpio_num_t)pin, level)
#define digitalRead(pin) gpio_get_level((gpio_num_t)pin)

Expand Down

0 comments on commit 450f552

Please sign in to comment.