diff --git a/Grbl_Esp32/src/Limits.cpp b/Grbl_Esp32/src/Limits.cpp
index d273dbb6..4770787f 100644
--- a/Grbl_Esp32/src/Limits.cpp
+++ b/Grbl_Esp32/src/Limits.cpp
@@ -252,13 +252,13 @@ void limits_go_home(uint8_t cycle_mask, uint n_locate_cycles) {
}
}
} while (STEP_MASK & axislock);
-#ifdef USE_I2S_STEPS
+
if (config->_stepType == ST_I2S_STREAM) {
if (!approach) {
delay_ms(I2S_OUT_DELAY_MS);
}
}
-#endif
+
st_reset(); // Immediately force kill steppers and reset step segment buffer.
delay_ms(debounce); // Delay to allow transient dynamics to dissipate.
// Reverse direction and reset homing rate for locate cycle(s).
diff --git a/Grbl_Esp32/src/Machines/6_pack_Lowrider_stepstick_v1.h b/Grbl_Esp32/src/Machines/6_pack_Lowrider_stepstick_v1.h
index 03a5cb09..20f1cf21 100644
--- a/Grbl_Esp32/src/Machines/6_pack_Lowrider_stepstick_v1.h
+++ b/Grbl_Esp32/src/Machines/6_pack_Lowrider_stepstick_v1.h
@@ -29,8 +29,6 @@
// === Special Features
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
diff --git a/Grbl_Esp32/src/Machines/6_pack_MPCNC_stepstick_v1.h b/Grbl_Esp32/src/Machines/6_pack_MPCNC_stepstick_v1.h
index 9881eb4f..93d1372e 100644
--- a/Grbl_Esp32/src/Machines/6_pack_MPCNC_stepstick_v1.h
+++ b/Grbl_Esp32/src/Machines/6_pack_MPCNC_stepstick_v1.h
@@ -29,8 +29,6 @@
// === Special Features
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
diff --git a/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_pc.h b/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_pc.h
index de74455b..f51710e7 100644
--- a/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_pc.h
+++ b/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_pc.h
@@ -29,8 +29,6 @@
// === Special Features
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
// === Default settings
#define DEFAULT_STEP_PULSE_MICROSECONDS I2S_OUT_USEC_PER_PULSE
diff --git a/Grbl_Esp32/src/Machines/6_pack_stepstick_v1.h b/Grbl_Esp32/src/Machines/6_pack_stepstick_v1.h
index 17fd4b35..5bcab55a 100644
--- a/Grbl_Esp32/src/Machines/6_pack_stepstick_v1.h
+++ b/Grbl_Esp32/src/Machines/6_pack_stepstick_v1.h
@@ -29,8 +29,6 @@
// === Special Features
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
diff --git a/Grbl_Esp32/src/Machines/6_pack_trinamic_stallguard.h b/Grbl_Esp32/src/Machines/6_pack_trinamic_stallguard.h
index 920954c7..90cd26e5 100644
--- a/Grbl_Esp32/src/Machines/6_pack_trinamic_stallguard.h
+++ b/Grbl_Esp32/src/Machines/6_pack_trinamic_stallguard.h
@@ -24,8 +24,6 @@
#define N_AXIS 6
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
#define I2S_OUT_BCK "gpio.22"
diff --git a/Grbl_Esp32/src/Machines/Root_Controller_Root_4_Lite_RS485.h b/Grbl_Esp32/src/Machines/Root_Controller_Root_4_Lite_RS485.h
index f9bb81ca..7ee94202 100644
--- a/Grbl_Esp32/src/Machines/Root_Controller_Root_4_Lite_RS485.h
+++ b/Grbl_Esp32/src/Machines/Root_Controller_Root_4_Lite_RS485.h
@@ -30,8 +30,6 @@
// === Special Features
//**I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
diff --git a/Grbl_Esp32/src/Machines/tapster_pro_6P_trinamic.h b/Grbl_Esp32/src/Machines/tapster_pro_6P_trinamic.h
index 66d5092d..6de55765 100644
--- a/Grbl_Esp32/src/Machines/tapster_pro_6P_trinamic.h
+++ b/Grbl_Esp32/src/Machines/tapster_pro_6P_trinamic.h
@@ -57,8 +57,6 @@
// I2S (steppers & other output-only pins)
-#define USE_I2S_OUT
-#define USE_I2S_STEPS
//#define DEFAULT_STEPPER ST_I2S_STATIC
// === Default settings
#define DEFAULT_STEP_PULSE_MICROSECONDS I2S_OUT_USEC_PER_PULSE
diff --git a/Grbl_Esp32/src/Machines/test_drive.h b/Grbl_Esp32/src/Machines/test_drive.h
index adf92dcf..3256195a 100644
--- a/Grbl_Esp32/src/Machines/test_drive.h
+++ b/Grbl_Esp32/src/Machines/test_drive.h
@@ -37,4 +37,3 @@
#define MACHINE_NAME "Test Drive - Demo Only No I/O!"
-#define USE_I2S_STEPS
\ No newline at end of file
diff --git a/Grbl_Esp32/src/MotionControl.cpp b/Grbl_Esp32/src/MotionControl.cpp
index 26431e26..85a6c1b2 100644
--- a/Grbl_Esp32/src/MotionControl.cpp
+++ b/Grbl_Esp32/src/MotionControl.cpp
@@ -299,24 +299,11 @@ static bool axis_is_squared(AxisMask axis_mask) {
return false;
}
-#ifdef USE_I2S_STEPS
-# define BACKUP_STEPPER(save_stepper) \
- do { \
- if (save_stepper == ST_I2S_STREAM) { \
- stepper_switch(ST_I2S_STATIC); /* Change the stepper to reduce the delay for accurate probing. */ \
- } \
- } while (0)
-
-# define RESTORE_STEPPER(save_stepper) \
- do { \
- if (save_stepper == ST_I2S_STREAM && config->_stepType != ST_I2S_STREAM) { \
- stepper_switch(ST_I2S_STREAM); /* Put the stepper back on. */ \
- } \
- } while (0)
-#else
-# define BACKUP_STEPPER(save_stepper)
-# define RESTORE_STEPPER(save_stepper)
-#endif
+inline void RESTORE_STEPPER(int save_stepper) {
+ if (save_stepper == ST_I2S_STREAM && config->_stepType != ST_I2S_STREAM) {
+ stepper_switch(ST_I2S_STREAM); /* Put the stepper back on. */
+ }
+}
// For this routine, homing_mask cannot be 0. The 0 case,
// meaning run all cycles, is handled by the caller mc_homing_cycle()
@@ -429,11 +416,12 @@ GCUpdatePos mc_probe_cycle(float* target, plan_line_data_t* pl_data, uint8_t par
return GCUpdatePos::None; // Return if system reset has been issued.
}
-#ifdef USE_I2S_STEPS
int save_stepper = config->_stepType; /* remember the stepper */
-#endif
+
// Switch stepper mode to the I2S static (realtime mode)
- BACKUP_STEPPER(save_stepper);
+ if (save_stepper == ST_I2S_STREAM) {
+ stepper_switch(ST_I2S_STATIC); /* Change the stepper to reduce the delay for accurate probing. */
+ }
// Initialize probing control variables
bool is_probe_away = bit_istrue(parser_flags, GCParserProbeIsAway);
@@ -572,10 +560,8 @@ void mc_reset() {
}
ganged_mode = gangDual; // in case an error occurred during squaring
-#ifdef USE_I2S_STEPS
if (config->_stepType == ST_I2S_STREAM) {
i2s_out_reset();
}
-#endif
}
}
diff --git a/Grbl_Esp32/src/ProcessSettings.cpp b/Grbl_Esp32/src/ProcessSettings.cpp
index 6e8ac94a..193e4b7f 100644
--- a/Grbl_Esp32/src/ProcessSettings.cpp
+++ b/Grbl_Esp32/src/ProcessSettings.cpp
@@ -249,20 +249,16 @@ Error home(int cycle) {
}
sys.state = State::Homing; // Set system state variable
-#ifdef USE_I2S_STEPS
int save_stepper = config->_stepType;
if (save_stepper == ST_I2S_STREAM) {
stepper_switch(ST_I2S_STATIC);
}
-#endif
mc_homing_cycle(cycle);
-#ifdef USE_I2S_STEPS
if (save_stepper == ST_I2S_STREAM && config->_stepType != ST_I2S_STREAM) {
stepper_switch(ST_I2S_STREAM);
}
-#endif
if (!sys.abort) { // Execute startup scripts after successful homing.
sys.state = State::Idle; // Set to IDLE when complete.
diff --git a/Grbl_Esp32/src/Stepper.cpp b/Grbl_Esp32/src/Stepper.cpp
index 239d9714..c67daebd 100644
--- a/Grbl_Esp32/src/Stepper.cpp
+++ b/Grbl_Esp32/src/Stepper.cpp
@@ -339,10 +339,9 @@ void stepper_init() {
config->_disableDelayMicroSeconds,
config->_directionDelayMicroSeconds);
-#ifdef USE_I2S_STEPS
// I2S stepper stream mode use callback but timer interrupt
i2s_out_set_pulse_callback(stepper_pulse_func);
-#endif
+
// Other stepper use timer interrupt
Stepper_Timer_Init();
}
@@ -353,7 +352,7 @@ void stepper_switch(stepper_id_t new_stepper) {
// do not need to change
return;
}
-#ifdef USE_I2S_STEPS
+
if (config->_stepType == ST_I2S_STREAM) {
if (i2s_out_get_pulser_status() != PASSTHROUGH) {
// Called during streaming. Stop streaming.
@@ -362,7 +361,7 @@ void stepper_switch(stepper_id_t new_stepper) {
i2s_out_delay(); // Wait for a change in mode.
}
}
-#endif
+
config->_stepType = new_stepper;
}
@@ -390,11 +389,10 @@ void st_reset() {
//Serial.println("st_reset()");
#endif
// Initialize stepper driver idle state.
-#ifdef USE_I2S_STEPS
if (config->_stepType == ST_I2S_STREAM) {
i2s_out_reset();
}
-#endif
+
st_go_idle();
// Initialize stepper algorithm variables.
memset(&prep, 0, sizeof(st_prep_t));
@@ -915,12 +913,10 @@ float st_get_realtime_rate() {
// The argument is in units of ticks of the timer that generates ISRs
void IRAM_ATTR Stepper_Timer_WritePeriod(uint16_t timerTicks) {
if (config->_stepType == ST_I2S_STREAM) {
-#ifdef USE_I2S_STEPS
// 1 tick = fTimers / fStepperTimer
// Pulse ISR is called for each tick of alarm_val.
// The argument to i2s_out_set_pulse_period is in units of microseconds
i2s_out_set_pulse_period(((uint32_t)timerTicks) / ticksPerMicrosecond);
-#endif
} else {
timerAlarmWrite(stepTimer, (uint64_t)timerTicks, autoReload);
}
@@ -938,9 +934,7 @@ void IRAM_ATTR Stepper_Timer_Start() {
//Serial.println("ST Start");
#endif
if (config->_stepType == ST_I2S_STREAM) {
-#ifdef USE_I2S_STEPS
i2s_out_set_stepping();
-#endif
} else {
timerWrite(stepTimer, 0ULL);
timerAlarmEnable(stepTimer);
diff --git a/Grbl_Esp32/src/Stepper.h b/Grbl_Esp32/src/Stepper.h
index a2344be9..3efb9a8e 100644
--- a/Grbl_Esp32/src/Stepper.h
+++ b/Grbl_Esp32/src/Stepper.h
@@ -32,7 +32,7 @@ enum stepper_id_t {
ST_TIMED = 0,
ST_RMT,
ST_I2S_STATIC,
- ST_I2S_STREAM,
+ ST_I2S_STREAM,
};
// esp32 work around for diable in main loop
diff --git a/platformio.ini b/platformio.ini
index 2cc87a2b..f91e301c 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@ src_dir = Grbl_Esp32
lib_dir = libraries
test_dir = Grbl_Esp32/test
data_dir = Grbl_Esp32/data
-default_envs = release
+default_envs = wifi
;extra_configs=debug.ini
[common_env_data]
@@ -54,13 +54,13 @@ src_filter =
-<.git/> - - -
test_build_project_src = true
-[env:release]
+[env:debug]
+build_type = debug
lib_deps =
TMCStepper@>=0.7.0,<1.0.0
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
-[env:debug]
-build_type = debug
+[env:noradio]
lib_deps =
TMCStepper@>=0.7.0,<1.0.0
ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0