Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzmax committed Feb 16, 2020
2 parents d5f4f6c + 42208bc commit 90fe4da
Show file tree
Hide file tree
Showing 17 changed files with 263 additions and 128 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,7 @@
*/
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
//#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
Expand Down
106 changes: 69 additions & 37 deletions Marlin/src/HAL/HAL_SAMD51/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@
// Private Variables
// --------------------------------------------------------------------------

const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS] = {
{ TC0, TC0_IRQn, TC_PRIORITY(0) },
{ TC1, TC1_IRQn, TC_PRIORITY(1) },
{ TC2, TC2_IRQn, TC_PRIORITY(2) }, // Reserved by framework tone function
{ TC3, TC3_IRQn, TC_PRIORITY(3) }, // Reserved by servo library
{ TC4, TC4_IRQn, TC_PRIORITY(4) },
{ TC5, TC5_IRQn, TC_PRIORITY(5) },
{ TC6, TC6_IRQn, TC_PRIORITY(6) },
{ TC7, TC7_IRQn, TC_PRIORITY(7) }
const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS+1] = {
{ {.pTc=TC0}, TC0_IRQn, TC_PRIORITY(0) }, // 0 - stepper
{ {.pTc=TC1}, TC1_IRQn, TC_PRIORITY(1) }, // 1 - stepper (needed by 32 bit timers)
{ {.pTc=TC2}, TC2_IRQn, TC_PRIORITY(2) }, // 2 - tone (framework)
{ {.pTc=TC3}, TC3_IRQn, TC_PRIORITY(3) }, // 3 - servo
{ {.pTc=TC4}, TC4_IRQn, TC_PRIORITY(4) },
{ {.pTc=TC5}, TC5_IRQn, TC_PRIORITY(5) },
{ {.pTc=TC6}, TC6_IRQn, TC_PRIORITY(6) },
{ {.pTc=TC7}, TC7_IRQn, TC_PRIORITY(7) },
{ {.pRtc=RTC}, RTC_IRQn, TC_PRIORITY(8) } // 8 - temperature
};

// --------------------------------------------------------------------------
Expand All @@ -66,49 +67,80 @@ FORCE_INLINE void Disable_Irq(IRQn_Type irq) {
// --------------------------------------------------------------------------

void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
Tc * const tc = TimerConfig[timer_num].pTimer;
IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;

// Disable interrupt, just in case it was already enabled
Disable_Irq(irq);

// Disable timer interrupt
tc->COUNT32.INTENCLR.reg = TC_INTENCLR_OVF; // disable overflow interrupt
if (timer_num == RTC_TIMER_NUM) {
Rtc * const rtc = TimerConfig[timer_num].pRtc;

// TCn clock setup
const uint8_t clockID = GCLK_CLKCTRL_IDs[TCC_INST_NUM + timer_num];
GCLK->PCHCTRL[clockID].bit.CHEN = false;
SYNC(GCLK->PCHCTRL[clockID].bit.CHEN);
GCLK->PCHCTRL[clockID].reg = GCLK_PCHCTRL_GEN_GCLK0 | GCLK_PCHCTRL_CHEN; // 120MHz startup code programmed
SYNC(!GCLK->PCHCTRL[clockID].bit.CHEN);
// Disable timer interrupt
rtc->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;

// Stop timer, just in case, to be able to reconfigure it
tc->COUNT32.CTRLA.bit.ENABLE = false;
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
// RTC clock setup
OSC32KCTRL->RTCCTRL.reg = OSC32KCTRL_RTCCTRL_RTCSEL_XOSC32K; // External 32.768KHz oscillator

// Reset timer
tc->COUNT32.CTRLA.bit.SWRST = true;
SYNC(tc->COUNT32.SYNCBUSY.bit.SWRST);
// Stop timer, just in case, to be able to reconfigure it
rtc->MODE0.CTRLA.bit.ENABLE = false;
SYNC(rtc->MODE0.SYNCBUSY.bit.ENABLE);

NVIC_SetPriority(irq, TimerConfig[timer_num].priority);
// Mode, reset counter on match
rtc->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_MODE_COUNT32 | RTC_MODE0_CTRLA_MATCHCLR;

// Set compare value
rtc->MODE0.COMP[0].reg = (32768 + frequency / 2) / frequency;
SYNC(rtc->MODE0.SYNCBUSY.bit.COMP0);

// Enable interrupt on compare
rtc->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; // reset pending interrupt
rtc->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0; // enable compare 0 interrupt

// And start timer
rtc->MODE0.CTRLA.bit.ENABLE = true;
SYNC(rtc->MODE0.SYNCBUSY.bit.ENABLE);
}
else {
Tc * const tc = TimerConfig[timer_num].pTc;

// Disable timer interrupt
tc->COUNT32.INTENCLR.reg = TC_INTENCLR_OVF; // disable overflow interrupt

// Wave mode, reset counter on overflow on 0 (I use count down to prevent double buffer use)
tc->COUNT32.WAVE.reg = TC_WAVE_WAVEGEN_MFRQ;
tc->COUNT32.CTRLA.reg = TC_CTRLA_MODE_COUNT32 | TC_CTRLA_PRESCALER_DIV1;
tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_DIR;
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);
// TCn clock setup
const uint8_t clockID = GCLK_CLKCTRL_IDs[TCC_INST_NUM + timer_num]; // TC clock are preceeded by TCC ones
GCLK->PCHCTRL[clockID].bit.CHEN = false;
SYNC(GCLK->PCHCTRL[clockID].bit.CHEN);
GCLK->PCHCTRL[clockID].reg = GCLK_PCHCTRL_GEN_GCLK0 | GCLK_PCHCTRL_CHEN; // 120MHz startup code programmed
SYNC(!GCLK->PCHCTRL[clockID].bit.CHEN);

// Set compare value
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = (HAL_TIMER_RATE) / frequency;
// Stop timer, just in case, to be able to reconfigure it
tc->COUNT32.CTRLA.bit.ENABLE = false;
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);

// And start timer
tc->COUNT32.CTRLA.bit.ENABLE = true;
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
// Reset timer
tc->COUNT32.CTRLA.bit.SWRST = true;
SYNC(tc->COUNT32.SYNCBUSY.bit.SWRST);

// Enable interrupt on RC compare
tc->COUNT32.INTENSET.reg = TC_INTENCLR_OVF; // enable overflow interrupt
// Wave mode, reset counter on overflow on 0 (I use count down to prevent double buffer use)
tc->COUNT32.WAVE.reg = TC_WAVE_WAVEGEN_MFRQ;
tc->COUNT32.CTRLA.reg = TC_CTRLA_MODE_COUNT32 | TC_CTRLA_PRESCALER_DIV1;
tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_DIR;
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);

// Set compare value
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = (HAL_TIMER_RATE) / frequency;

// Enable interrupt on compare
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF; // reset pending interrupt
tc->COUNT32.INTENSET.reg = TC_INTENSET_OVF; // enable overflow interrupt

// And start timer
tc->COUNT32.CTRLA.bit.ENABLE = true;
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
}

// Finally, enable IRQ
NVIC_SetPriority(irq, TimerConfig[timer_num].priority);
NVIC_EnableIRQ(irq);
}

Expand Down
38 changes: 28 additions & 10 deletions Marlin/src/HAL/HAL_SAMD51/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
#define RTC_TIMER_NUM 8 // This is not a TC but a RTC

typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
Expand All @@ -33,12 +34,12 @@ typedef uint32_t hal_timer_t;

#define STEP_TIMER_NUM 0 // index of timer to use for stepper (also +1 for 32bits counter)
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define TEMP_TIMER_NUM 4 // index of timer to use for temperature (also +1 for 32bits counter)
#define TEMP_TIMER_NUM RTC_TIMER_NUM // index of timer to use for temperature

#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency

#define STEPPER_TIMER_RATE HAL_TIMER_RATE // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000) // stepper timer ticks per µs
#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US)

#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
Expand All @@ -62,14 +63,21 @@ typedef uint32_t hal_timer_t;
#if STEP_TIMER_NUM != PULSE_TIMER_NUM
#define HAL_PULSE_TIMER_ISR() TC_HANDLER(PULSE_TIMER_NUM)
#endif
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
#if TEMP_TIMER_NUM == RTC_TIMER_NUM
#define HAL_TEMP_TIMER_ISR() void RTC_Handler()
#else
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
#endif

// --------------------------------------------------------------------------
// Types
// --------------------------------------------------------------------------

typedef struct {
Tc *pTimer;
union {
Tc *pTc;
Rtc *pRtc;
};
IRQn_Type IRQ_Id;
uint8_t priority;
} tTimerConfig;
Expand All @@ -87,17 +95,20 @@ extern const tTimerConfig TimerConfig[];
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);

FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare) {
Tc * const tc = TimerConfig[timer_num].pTimer;
// Should never be called with timer RTC_TIMER_NUM
Tc * const tc = TimerConfig[timer_num].pTc;
tc->COUNT32.CC[0].reg = HAL_TIMER_TYPE_MAX - compare;
}

FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) {
Tc * const tc = TimerConfig[timer_num].pTimer;
// Should never be called with timer RTC_TIMER_NUM
Tc * const tc = TimerConfig[timer_num].pTc;
return (hal_timer_t)(HAL_TIMER_TYPE_MAX - tc->COUNT32.CC[0].reg);
}

FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
Tc * const tc = TimerConfig[timer_num].pTimer;
// Should never be called with timer RTC_TIMER_NUM
Tc * const tc = TimerConfig[timer_num].pTc;
tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_CMD_READSYNC;
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB || tc->COUNT32.SYNCBUSY.bit.COUNT);
return HAL_TIMER_TYPE_MAX - tc->COUNT32.COUNT.reg;
Expand All @@ -108,9 +119,16 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num);
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);

FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
Tc * const tc = TimerConfig[timer_num].pTimer;
// Clear interrupt flag
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF;
if (timer_num == RTC_TIMER_NUM) {
Rtc * const rtc = TimerConfig[timer_num].pRtc;
// Clear interrupt flag
rtc->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
}
else {
Tc * const tc = TimerConfig[timer_num].pTc;
// Clear interrupt flag
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF;
}
}

#define HAL_timer_isr_epilogue(timer_num)
4 changes: 4 additions & 0 deletions Marlin/src/feature/babystep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
gcode.reset_stepper_timeout();
#endif

#if ENABLED(INTEGRATED_BABYSTEPPING)
if (has_steps()) stepper.initiateBabystepping();
#endif
}

#endif // BABYSTEPPING
14 changes: 13 additions & 1 deletion Marlin/src/feature/babystep.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@

#include "../inc/MarlinConfigPre.h"

#if ENABLED(INTEGRATED_BABYSTEPPING)
#define BABYSTEPS_PER_SEC 1000UL
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))
#else
#define BABYSTEPS_PER_SEC 976UL
#define BABYSTEP_TICKS ((TEMP_TIMER_RATE) / (BABYSTEPS_PER_SEC))
#endif

#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
#define BS_TODO_AXIS(A) A
#else
Expand Down Expand Up @@ -56,8 +64,12 @@ class Babystep {
static void add_steps(const AxisEnum axis, const int16_t distance);
static void add_mm(const AxisEnum axis, const float &mm);

static inline bool has_steps() {
return steps[BS_TODO_AXIS(X_AXIS)] || steps[BS_TODO_AXIS(Y_AXIS)] || steps[BS_TODO_AXIS(Z_AXIS)];
}

//
// Called by the Temperature ISR to
// Called by the Temperature or Stepper ISR to
// apply accumulated babysteps to the axes.
//
static inline void task() {
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,13 +723,13 @@
SERIAL_CHAR('\t');
switch (i) {
case TMC_DRV_CODES: st.printLabel(); break;
case TMC_STST: if (st.stst()) SERIAL_CHAR('*'); break;
case TMC_OLB: if (st.olb()) SERIAL_CHAR('*'); break;
case TMC_OLA: if (st.ola()) SERIAL_CHAR('*'); break;
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('*'); break;
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('*'); break;
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('*'); break;
case TMC_OT: if (st.ot()) SERIAL_CHAR('*'); break;
case TMC_STST: if (!st.stst()) SERIAL_CHAR('*'); break;
case TMC_OLB: if (st.olb()) SERIAL_CHAR('*'); break;
case TMC_OLA: if (st.ola()) SERIAL_CHAR('*'); break;
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('*'); break;
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('*'); break;
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('*'); break;
case TMC_OT: if (st.ot()) SERIAL_CHAR('*'); break;
case TMC_DRV_STATUS_HEX: {
const uint32_t drv_status = st.DRV_STATUS();
SERIAL_CHAR('\t');
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void GCodeQueue::get_serial_commands() {

if (serial_char == '\n' || serial_char == '\r') {

process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i]);
if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i])) continue;

char* command = serial_line_buffer[i];

Expand Down Expand Up @@ -550,7 +550,7 @@ void GCodeQueue::get_serial_commands() {
else if (n < 0)
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);

process_line_done(sd_input_state, command_buffer[index_w], sd_count);
if (process_line_done(sd_input_state, command_buffer[index_w], sd_count)) continue;

_commit_command(false);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-02-14"
#define STRING_DISTRIBUTION_DATE "2020-02-16"
#endif

/**
Expand Down
51 changes: 26 additions & 25 deletions Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ template<typename NAME>
class TMenuEditItem : MenuEditItemBase {
private:
typedef typename NAME::type_t type_t;
static inline float unscale(const float value) { return value * (1.0f / NAME::scale); }
static inline float scale(const float value) { return value * NAME::scale; }
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
static inline float scale(const float value) { return NAME::scale(value); }
static inline float unscale(const float value) { return NAME::unscale(value); }
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
public:
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t * const data, ...) {
MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(*(data)));
Expand Down Expand Up @@ -266,34 +266,35 @@ class TMenuEditItem : MenuEditItemBase {
// Provide a set of Edit Item Types which encompass a primitive
// type, a string function, and a scale factor for edit and display.
// These items call the Edit Item draw method passing the prepared string.
#define DEFINE_MENU_EDIT_ITEM_TYPE(TYPE, NAME, STRFUNC, SCALE) \
#define DEFINE_MENU_EDIT_ITEM_TYPE(TYPE, NAME, FIX, STRFUNC, SCALE, V...) \
struct MenuEditItemInfo_##NAME { \
typedef TYPE type_t; \
static constexpr float scale = SCALE; \
static inline const char* strfunc(const float value) { return STRFUNC((TYPE)value); } \
static inline float scale(const float value) { return value * (SCALE) + (V+0); } \
static inline float unscale(const float value) { return value / (SCALE) + (V+0); } \
static inline const char* strfunc(const float value) { return STRFUNC((TYPE)(FIX ? FIXFLOAT(value) : value)); } \
}; \
typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME

// TYPE NAME STRFUNC SCALE
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, percent, ui8tostr4pct, 100.0/255); // 100% right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, uint8, ui8tostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_5, ui16tostr5, 0.01 ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52, ftostr42_52, 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
DEFINE_MENU_EDIT_ITEM_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5, ftostr5rj, 1 ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51, ftostr51rj, 10 ); // 1234.5 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float41sign, ftostr41sign, 10 ); // +123.4
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, percent, 0, ui8tostr4pct, 100.0/255, 0.5); // 100% right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int3, 0, i16tostr3, 1 ); // 123, -12 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int4, 0, i16tostr4sign, 1 ); // 1234, -123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(int8_t, int8, 0, i8tostr3, 1 ); // 123, -12 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, uint8, 0, ui8tostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_3, 0, ui16tostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_4, 0, ui16tostr4, 0.1 ); // 1234 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_5, 0, ui16tostr5, 0.01 ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float3, 1, ftostr3, 1 ); // 123 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52, 1, ftostr42_52, 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
DEFINE_MENU_EDIT_ITEM_TYPE(float, float43, 1, ftostr43sign, 1000 ); // 1.234
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5, 1, ftostr5rj, 1 ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5_25, 1, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51, 1, ftostr51rj, 10 ); // 1234.5 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(float, float41sign, 1, ftostr41sign, 10 ); // +123.4
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51sign, 1, ftostr51sign, 10 ); // +1234.5
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52sign, 1, ftostr52sign, 100 ); // +123.45
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5, 0, ftostr5rj, 0.01f ); // 12345 right-justified
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5_25, 0, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)

class MenuItem_bool : public MenuEditItemBase {
public:
Expand Down
Loading

0 comments on commit 90fe4da

Please sign in to comment.