|
|
@ -56,9 +56,6 @@ namespace DirectStepping { |
|
|
|
template<typename Cfg> |
|
|
|
volatile bool SerialPageManager<Cfg>::page_states_dirty; |
|
|
|
|
|
|
|
template<typename Cfg> |
|
|
|
millis_t SerialPageManager<Cfg>::next_response; |
|
|
|
|
|
|
|
template<typename Cfg> |
|
|
|
uint8_t SerialPageManager<Cfg>::pages[Cfg::NUM_PAGES][Cfg::PAGE_SIZE]; |
|
|
|
|
|
|
@ -80,7 +77,6 @@ namespace DirectStepping { |
|
|
|
page_states[i] = PageState::FREE; |
|
|
|
|
|
|
|
fatal_error = false; |
|
|
|
next_response = 0; |
|
|
|
state = State::NEWLINE; |
|
|
|
|
|
|
|
page_states_dirty = false; |
|
|
@ -181,15 +177,8 @@ namespace DirectStepping { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// Runs on a set interval also, as responses may get lost.
|
|
|
|
if (next_response && next_response < millis()) { |
|
|
|
page_states_dirty = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (!page_states_dirty) return; |
|
|
|
|
|
|
|
page_states_dirty = false; |
|
|
|
next_response = millis() + Cfg::RESPONSE_INTERVAL_MS; |
|
|
|
|
|
|
|
SERIAL_ECHO(Cfg::CONTROL_CHAR); |
|
|
|
constexpr int state_bits = 2; |
|
|
@ -238,29 +227,29 @@ const uint8_t segment_table[DirectStepping::Config::NUM_SEGMENTS][DirectStepping |
|
|
|
|
|
|
|
#if STEPPER_PAGE_FORMAT == SP_4x4D_128 |
|
|
|
|
|
|
|
{ 1, 1, 1, 1, 1, 1, 1, 0 }, // 0 = -7
|
|
|
|
{ 1, 1, 1, 0, 1, 1, 1, 0 }, // 1 = -6
|
|
|
|
{ 0, 1, 1, 0, 1, 0, 1, 1 }, // 2 = -5
|
|
|
|
{ 0, 1, 0, 1, 0, 1, 0, 1 }, // 3 = -4
|
|
|
|
{ 0, 1, 0, 0, 1, 0, 0, 1 }, // 4 = -3
|
|
|
|
{ 0, 0, 1, 0, 0, 0, 1,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