mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 10:53:01 +02:00
Fixed a few IRAM_ATTR bugs in stepping. Changed config.yaml to stress testing setup.
This commit is contained in:
@@ -16,12 +16,12 @@ axes:
|
||||
shared_stepper_disable: gpio.13:high
|
||||
|
||||
x:
|
||||
steps_per_mm: 800
|
||||
max_rate: 2000
|
||||
acceleration: 25
|
||||
max_travel: 1000
|
||||
steps_per_mm: 1500
|
||||
max_rate: 50000
|
||||
acceleration: 5000
|
||||
max_travel: 100000
|
||||
homing:
|
||||
cycle: -1
|
||||
cycle: 0
|
||||
mpos: 10
|
||||
positive_direction: false
|
||||
feed_rate: 50.000
|
||||
|
@@ -160,6 +160,7 @@ namespace Machine {
|
||||
a->unstep();
|
||||
}
|
||||
}
|
||||
|
||||
config->_stepping->finishPulse();
|
||||
}
|
||||
|
||||
|
@@ -244,6 +244,7 @@ void IRAM_ATTR Stepper::pulse_func() {
|
||||
return; // Nothing to do but exit.
|
||||
}
|
||||
}
|
||||
|
||||
// Check probing state.
|
||||
if (sys_probe_state == ProbeState::Active && config->_probe->tripped()) {
|
||||
sys_probe_state = ProbeState::Off;
|
||||
|
@@ -15,8 +15,6 @@ namespace Machine {
|
||||
{ Stepping::I2S_STREAM, "I2S_stream" },
|
||||
EnumItem(Stepping::RMT) };
|
||||
|
||||
static std::atomic<bool> busy;
|
||||
|
||||
void Stepping::init() {
|
||||
info_serial("Step type:%s Pulse:%dus Dsbl Delay:%dus Dir Delay:%dus Idle Delay:%dms",
|
||||
// stepping->name(),
|
||||
@@ -39,8 +37,6 @@ namespace Machine {
|
||||
// Register pulse_func with the I2S subsystem
|
||||
// This could be done via the linker.
|
||||
// i2s_out_set_pulse_callback(Stepper::pulse_func);
|
||||
|
||||
busy.store(false);
|
||||
}
|
||||
|
||||
// Wait for motion to complete; the axes can still be moving
|
||||
@@ -83,7 +79,8 @@ namespace Machine {
|
||||
NOP();
|
||||
}
|
||||
}
|
||||
void Stepping::waitPulse() {
|
||||
|
||||
void IRAM_ATTR Stepping::waitPulse() {
|
||||
uint64_t pulseEndTime;
|
||||
switch (_engine) {
|
||||
case I2S_STREAM:
|
||||
@@ -100,7 +97,8 @@ namespace Machine {
|
||||
return;
|
||||
}
|
||||
}
|
||||
void Stepping::waitDirection() {
|
||||
|
||||
void IRAM_ATTR Stepping::waitDirection() {
|
||||
if (_directionDelayUsecs) {
|
||||
// Stepper drivers need some time between changing direction and doing a pulse.
|
||||
switch (_engine) {
|
||||
@@ -108,7 +106,7 @@ namespace Machine {
|
||||
i2s_out_push_sample(_directionDelayUsecs);
|
||||
break;
|
||||
case stepper_id_t::I2S_STATIC:
|
||||
case stepper_id_t::TIMED: {
|
||||
case stepper_id_t::TIMED:
|
||||
// wait for step pulse time to complete...some time expired during code above
|
||||
//
|
||||
// If we are using GPIO stepping as opposed to RMT, record the
|
||||
@@ -121,9 +119,8 @@ namespace Machine {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stepping::startPulseTimer() {
|
||||
void IRAM_ATTR Stepping::startPulseTimer() {
|
||||
switch (_engine) {
|
||||
case stepper_id_t::I2S_STREAM:
|
||||
break;
|
||||
@@ -136,7 +133,7 @@ namespace Machine {
|
||||
}
|
||||
}
|
||||
|
||||
void Stepping::finishPulse() {
|
||||
void IRAM_ATTR Stepping::finishPulse() {
|
||||
switch (_engine) {
|
||||
case stepper_id_t::I2S_STREAM:
|
||||
break;
|
||||
@@ -191,11 +188,8 @@ namespace Machine {
|
||||
// with probing and homing cycles that require true real-time positions.
|
||||
void IRAM_ATTR Stepping::onStepperDriverTimer() {
|
||||
// Timer ISR, normally takes a step.
|
||||
|
||||
//
|
||||
// The intermediate handler clears the timer interrupt so we need not do it here
|
||||
|
||||
bool expected = false;
|
||||
if (busy.compare_exchange_strong(expected, true)) {
|
||||
++isr_count;
|
||||
|
||||
// Using autoReload results is less timing jitter so it is
|
||||
@@ -213,9 +207,6 @@ namespace Machine {
|
||||
timerAlarmEnable(stepTimer);
|
||||
|
||||
Stepper::pulse_func();
|
||||
|
||||
busy.store(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Stepping::group(Configuration::HandlerBase& handler) {
|
||||
|
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "Configuration/Configurable.h"
|
||||
// #include <atomic>
|
||||
|
||||
namespace Machine {
|
||||
class Stepping : public Configuration::Configurable {
|
||||
@@ -29,7 +28,7 @@ namespace Machine {
|
||||
|
||||
private:
|
||||
static const int stepTimerNumber = 0;
|
||||
static const bool autoReload = true;
|
||||
static const bool autoReload = false;
|
||||
static hw_timer_t* stepTimer;
|
||||
static void onStepperDriverTimer();
|
||||
|
||||
|
@@ -143,6 +143,7 @@
|
||||
<ClInclude Include="Grbl_Esp32\src\StackTrace\debug_helpers.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\Stepper.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\StepperPrivate.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\Stepping.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\StringRange.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\StringStream.h" />
|
||||
<ClInclude Include="Grbl_Esp32\src\System.h" />
|
||||
@@ -276,6 +277,7 @@
|
||||
<ClCompile Include="Grbl_Esp32\src\StackTrace\AssertionFailed.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\StackTrace\debug_helpers.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\Stepper.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\Stepping.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\System.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\Uart.cpp" />
|
||||
<ClCompile Include="Grbl_Esp32\src\UserOutput.cpp" />
|
||||
|
@@ -507,6 +507,9 @@
|
||||
<ClInclude Include="X86TestSupport\soc\ledc_struct.h">
|
||||
<Filter>X86TestSupport\soc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Grbl_Esp32\src\Stepping.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Grbl_Esp32\src\WebUI\JSONEncoder.cpp">
|
||||
@@ -854,6 +857,9 @@
|
||||
<ClCompile Include="X86TestSupport\driver\uartdriver.cpp">
|
||||
<Filter>X86TestSupport\driver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Grbl_Esp32\src\Stepping.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Grbl_Esp32\src\SimpleOutputStream.md">
|
||||
|
Reference in New Issue
Block a user