Direct Stepping update (#19135)
This commit is contained in:
committed by
Scott Lahteine
parent
1b129ede4e
commit
8670f475b8
@ -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, 0 }, // 5 = -2
|
||||
{ 0, 0, 0, 0, 1, 0, 0, 0 }, // 6 = -1
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // 7 = 0
|
||||
{ 0, 0, 0, 0, 1, 0, 0, 0 }, // 8 = 1
|
||||
{ 0, 0, 1, 0, 0, 0, 1, 0 }, // 9 = 2
|
||||
{ 0, 1, 0, 0, 1, 0, 0, 1 }, // 10 = 3
|
||||
{ 0, 1, 0, 1, 0, 1, 0, 1 }, // 11 = 4
|
||||
{ 0, 1, 1, 0, 1, 0, 1, 1 }, // 12 = 5
|
||||
{ 1, 1, 1, 0, 1, 1, 1, 0 }, // 13 = 6
|
||||
{ 1, 1, 1, 1, 1, 1, 1, 0 }, // 14 = 7
|
||||
{ 1, 1, 1, 1, 1, 1, 1 }, // 0 = -7
|
||||
{ 1, 1, 1, 0, 1, 1, 1 }, // 1 = -6
|
||||
{ 1, 1, 1, 0, 1, 0, 1 }, // 2 = -5
|
||||
{ 1, 1, 0, 1, 0, 1, 0 }, // 3 = -4
|
||||
{ 1, 1, 0, 0, 1, 0, 0 }, // 4 = -3
|
||||
{ 0, 0, 1, 0, 0, 0, 1 }, // 5 = -2
|
||||
{ 0, 0, 0, 1, 0, 0, 0 }, // 6 = -1
|
||||
{ 0, 0, 0, 0, 0, 0, 0 }, // 7 = 0
|
||||
{ 0, 0, 0, 1, 0, 0, 0 }, // 8 = 1
|
||||
{ 0, 0, 1, 0, 0, 0, 1 }, // 9 = 2
|
||||
{ 1, 1, 0, 0, 1, 0, 0 }, // 10 = 3
|
||||
{ 1, 1, 0, 1, 0, 1, 0 }, // 11 = 4
|
||||
{ 1, 1, 1, 0, 1, 0, 1 }, // 12 = 5
|
||||
{ 1, 1, 1, 0, 1, 1, 1 }, // 13 = 6
|
||||
{ 1, 1, 1, 1, 1, 1, 1 }, // 14 = 7
|
||||
{ 0 }
|
||||
|
||||
#elif STEPPER_PAGE_FORMAT == SP_4x2_256
|
||||
|
||||
{ 0, 0, 0, 0 }, // 0
|
||||
{ 0, 1, 0, 0 }, // 1
|
||||
{ 1, 0, 1, 0 }, // 2
|
||||
{ 1, 1, 1, 0 }, // 3
|
||||
{ 0, 0, 0 }, // 0
|
||||
{ 0, 1, 0 }, // 1
|
||||
{ 1, 0, 1 }, // 2
|
||||
{ 1, 1, 1 }, // 3
|
||||
|
||||
#elif STEPPER_PAGE_FORMAT == SP_4x1_512
|
||||
|
||||
|
@ -70,7 +70,6 @@ namespace DirectStepping {
|
||||
|
||||
static volatile PageState page_states[Cfg::NUM_PAGES];
|
||||
static volatile bool page_states_dirty;
|
||||
static millis_t next_response;
|
||||
|
||||
static uint8_t pages[Cfg::NUM_PAGES][Cfg::PAGE_SIZE];
|
||||
static uint8_t checksum;
|
||||
@ -94,14 +93,11 @@ namespace DirectStepping {
|
||||
static constexpr int DIRECTIONAL = dir ? 1 : 0;
|
||||
static constexpr int SEGMENTS = segments;
|
||||
|
||||
static constexpr int RAW = (BITS_SEGMENT == 1) ? 1 : 0;
|
||||
static constexpr int NUM_SEGMENTS = 1 << BITS_SEGMENT;
|
||||
static constexpr int SEGMENT_STEPS = 1 << (BITS_SEGMENT - DIRECTIONAL - RAW);
|
||||
static constexpr int SEGMENT_STEPS = (1 << (BITS_SEGMENT - DIRECTIONAL)) - 1;
|
||||
static constexpr int TOTAL_STEPS = SEGMENT_STEPS * SEGMENTS;
|
||||
static constexpr int PAGE_SIZE = (NUM_AXES * BITS_SEGMENT * SEGMENTS) / 8;
|
||||
|
||||
static constexpr millis_t RESPONSE_INTERVAL_MS = 50;
|
||||
|
||||
typedef typename TypeSelector<(PAGE_SIZE>256), uint16_t, uint8_t>::type write_byte_idx_t;
|
||||
typedef typename TypeSelector<(NUM_PAGES>256), uint16_t, uint8_t>::type page_idx_t;
|
||||
};
|
||||
|
Reference in New Issue
Block a user