Skip to content

Commit b071c10

Browse files
committed
rework dir pin management in pulse counter
1 parent 450f552 commit b071c10

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/FastAccelStepper_idf4_esp32_pcnt.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ bool FastAccelStepper::attachToPulseCounter(uint8_t pcnt_unit,
6464
gpio_matrix_in(step_pin, sig_idx[pcnt_unit], 0);
6565
gpio_iomux_in(step_pin, sig_idx[pcnt_unit]); // test failure without this call
6666
if (dir_pin != PIN_UNDEFINED) {
67+
pinMode(dir_pin, OUTPUT);
6768
gpio_matrix_out(dir_pin, 0x100, false, false);
69+
gpio_matrix_in(dir_pin, ctrl_idx[pcnt_unit], 0);
6870
gpio_iomux_in(dir_pin, ctrl_idx[pcnt_unit]);
69-
pinMode(dir_pin, OUTPUT);
7071
}
7172

7273
pcnt_counter_clear(cfg.unit);

0 commit comments

Comments
 (0)