Skip to content

Commit 90fe4da

Browse files
committed
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
2 parents d5f4f6c + 42208bc commit 90fe4da

File tree

17 files changed

+263
-128
lines changed

17 files changed

+263
-128
lines changed

Marlin/Configuration_adv.h

+1
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@
14471447
*/
14481448
//#define BABYSTEPPING
14491449
#if ENABLED(BABYSTEPPING)
1450+
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
14501451
//#define BABYSTEP_WITHOUT_HOMING
14511452
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
14521453
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way

Marlin/src/HAL/HAL_SAMD51/timers.cpp

+69-37
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@
3737
// Private Variables
3838
// --------------------------------------------------------------------------
3939

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

5152
// --------------------------------------------------------------------------
@@ -66,49 +67,80 @@ FORCE_INLINE void Disable_Irq(IRQn_Type irq) {
6667
// --------------------------------------------------------------------------
6768

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

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

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

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

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

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

93-
NVIC_SetPriority(irq, TimerConfig[timer_num].priority);
88+
// Mode, reset counter on match
89+
rtc->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_MODE_COUNT32 | RTC_MODE0_CTRLA_MATCHCLR;
90+
91+
// Set compare value
92+
rtc->MODE0.COMP[0].reg = (32768 + frequency / 2) / frequency;
93+
SYNC(rtc->MODE0.SYNCBUSY.bit.COMP0);
94+
95+
// Enable interrupt on compare
96+
rtc->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0; // reset pending interrupt
97+
rtc->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0; // enable compare 0 interrupt
98+
99+
// And start timer
100+
rtc->MODE0.CTRLA.bit.ENABLE = true;
101+
SYNC(rtc->MODE0.SYNCBUSY.bit.ENABLE);
102+
}
103+
else {
104+
Tc * const tc = TimerConfig[timer_num].pTc;
105+
106+
// Disable timer interrupt
107+
tc->COUNT32.INTENCLR.reg = TC_INTENCLR_OVF; // disable overflow interrupt
94108

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

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

104-
// And start timer
105-
tc->COUNT32.CTRLA.bit.ENABLE = true;
106-
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
120+
// Reset timer
121+
tc->COUNT32.CTRLA.bit.SWRST = true;
122+
SYNC(tc->COUNT32.SYNCBUSY.bit.SWRST);
107123

108-
// Enable interrupt on RC compare
109-
tc->COUNT32.INTENSET.reg = TC_INTENCLR_OVF; // enable overflow interrupt
124+
// Wave mode, reset counter on overflow on 0 (I use count down to prevent double buffer use)
125+
tc->COUNT32.WAVE.reg = TC_WAVE_WAVEGEN_MFRQ;
126+
tc->COUNT32.CTRLA.reg = TC_CTRLA_MODE_COUNT32 | TC_CTRLA_PRESCALER_DIV1;
127+
tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_DIR;
128+
SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);
129+
130+
// Set compare value
131+
tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = (HAL_TIMER_RATE) / frequency;
132+
133+
// Enable interrupt on compare
134+
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF; // reset pending interrupt
135+
tc->COUNT32.INTENSET.reg = TC_INTENSET_OVF; // enable overflow interrupt
136+
137+
// And start timer
138+
tc->COUNT32.CTRLA.bit.ENABLE = true;
139+
SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
140+
}
110141

111142
// Finally, enable IRQ
143+
NVIC_SetPriority(irq, TimerConfig[timer_num].priority);
112144
NVIC_EnableIRQ(irq);
113145
}
114146

Marlin/src/HAL/HAL_SAMD51/timers.h

+28-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// --------------------------------------------------------------------------
2626
// Defines
2727
// --------------------------------------------------------------------------
28+
#define RTC_TIMER_NUM 8 // This is not a TC but a RTC
2829

2930
typedef uint32_t hal_timer_t;
3031
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
@@ -33,12 +34,12 @@ typedef uint32_t hal_timer_t;
3334

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

3839
#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency
3940

4041
#define STEPPER_TIMER_RATE HAL_TIMER_RATE // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
41-
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
42+
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000) // stepper timer ticks per µs
4243
#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US)
4344

4445
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
@@ -62,14 +63,21 @@ typedef uint32_t hal_timer_t;
6263
#if STEP_TIMER_NUM != PULSE_TIMER_NUM
6364
#define HAL_PULSE_TIMER_ISR() TC_HANDLER(PULSE_TIMER_NUM)
6465
#endif
65-
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
66+
#if TEMP_TIMER_NUM == RTC_TIMER_NUM
67+
#define HAL_TEMP_TIMER_ISR() void RTC_Handler()
68+
#else
69+
#define HAL_TEMP_TIMER_ISR() TC_HANDLER(TEMP_TIMER_NUM)
70+
#endif
6671

6772
// --------------------------------------------------------------------------
6873
// Types
6974
// --------------------------------------------------------------------------
7075

7176
typedef struct {
72-
Tc *pTimer;
77+
union {
78+
Tc *pTc;
79+
Rtc *pRtc;
80+
};
7381
IRQn_Type IRQ_Id;
7482
uint8_t priority;
7583
} tTimerConfig;
@@ -87,17 +95,20 @@ extern const tTimerConfig TimerConfig[];
8795
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
8896

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

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

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

110121
FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
111-
Tc * const tc = TimerConfig[timer_num].pTimer;
112-
// Clear interrupt flag
113-
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF;
122+
if (timer_num == RTC_TIMER_NUM) {
123+
Rtc * const rtc = TimerConfig[timer_num].pRtc;
124+
// Clear interrupt flag
125+
rtc->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
126+
}
127+
else {
128+
Tc * const tc = TimerConfig[timer_num].pTc;
129+
// Clear interrupt flag
130+
tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF;
131+
}
114132
}
115133

116134
#define HAL_timer_isr_epilogue(timer_num)

Marlin/src/feature/babystep.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
117117
#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
118118
gcode.reset_stepper_timeout();
119119
#endif
120+
121+
#if ENABLED(INTEGRATED_BABYSTEPPING)
122+
if (has_steps()) stepper.initiateBabystepping();
123+
#endif
120124
}
121125

122126
#endif // BABYSTEPPING

Marlin/src/feature/babystep.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323

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

26+
#if ENABLED(INTEGRATED_BABYSTEPPING)
27+
#define BABYSTEPS_PER_SEC 1000UL
28+
#define BABYSTEP_TICKS ((STEPPER_TIMER_RATE) / (BABYSTEPS_PER_SEC))
29+
#else
30+
#define BABYSTEPS_PER_SEC 976UL
31+
#define BABYSTEP_TICKS ((TEMP_TIMER_RATE) / (BABYSTEPS_PER_SEC))
32+
#endif
33+
2634
#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
2735
#define BS_TODO_AXIS(A) A
2836
#else
@@ -56,8 +64,12 @@ class Babystep {
5664
static void add_steps(const AxisEnum axis, const int16_t distance);
5765
static void add_mm(const AxisEnum axis, const float &mm);
5866

67+
static inline bool has_steps() {
68+
return steps[BS_TODO_AXIS(X_AXIS)] || steps[BS_TODO_AXIS(Y_AXIS)] || steps[BS_TODO_AXIS(Z_AXIS)];
69+
}
70+
5971
//
60-
// Called by the Temperature ISR to
72+
// Called by the Temperature or Stepper ISR to
6173
// apply accumulated babysteps to the axes.
6274
//
6375
static inline void task() {

Marlin/src/feature/tmc_util.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -723,13 +723,13 @@
723723
SERIAL_CHAR('\t');
724724
switch (i) {
725725
case TMC_DRV_CODES: st.printLabel(); break;
726-
case TMC_STST: if (st.stst()) SERIAL_CHAR('*'); break;
727-
case TMC_OLB: if (st.olb()) SERIAL_CHAR('*'); break;
728-
case TMC_OLA: if (st.ola()) SERIAL_CHAR('*'); break;
729-
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('*'); break;
730-
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('*'); break;
731-
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('*'); break;
732-
case TMC_OT: if (st.ot()) SERIAL_CHAR('*'); break;
726+
case TMC_STST: if (!st.stst()) SERIAL_CHAR('*'); break;
727+
case TMC_OLB: if (st.olb()) SERIAL_CHAR('*'); break;
728+
case TMC_OLA: if (st.ola()) SERIAL_CHAR('*'); break;
729+
case TMC_S2GB: if (st.s2gb()) SERIAL_CHAR('*'); break;
730+
case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('*'); break;
731+
case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('*'); break;
732+
case TMC_OT: if (st.ot()) SERIAL_CHAR('*'); break;
733733
case TMC_DRV_STATUS_HEX: {
734734
const uint32_t drv_status = st.DRV_STATUS();
735735
SERIAL_CHAR('\t');

Marlin/src/gcode/queue.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void GCodeQueue::get_serial_commands() {
415415

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

418-
process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i]);
418+
if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i])) continue;
419419

420420
char* command = serial_line_buffer[i];
421421

@@ -550,7 +550,7 @@ void GCodeQueue::get_serial_commands() {
550550
else if (n < 0)
551551
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
552552

553-
process_line_done(sd_input_state, command_buffer[index_w], sd_count);
553+
if (process_line_done(sd_input_state, command_buffer[index_w], sd_count)) continue;
554554

555555
_commit_command(false);
556556

Marlin/src/inc/Version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* version was tagged.
4343
*/
4444
#ifndef STRING_DISTRIBUTION_DATE
45-
#define STRING_DISTRIBUTION_DATE "2020-02-14"
45+
#define STRING_DISTRIBUTION_DATE "2020-02-16"
4646
#endif
4747

4848
/**

Marlin/src/lcd/menu/menu.h

+26-25
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ template<typename NAME>
234234
class TMenuEditItem : MenuEditItemBase {
235235
private:
236236
typedef typename NAME::type_t type_t;
237-
static inline float unscale(const float value) { return value * (1.0f / NAME::scale); }
238-
static inline float scale(const float value) { return value * NAME::scale; }
239-
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
237+
static inline float scale(const float value) { return NAME::scale(value); }
238+
static inline float unscale(const float value) { return NAME::unscale(value); }
240239
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
240+
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
241241
public:
242242
FORCE_INLINE static void draw(const bool sel, const uint8_t row, PGM_P const pstr, type_t * const data, ...) {
243243
MenuEditItemBase::draw(sel, row, pstr, NAME::strfunc(*(data)));
@@ -266,34 +266,35 @@ class TMenuEditItem : MenuEditItemBase {
266266
// Provide a set of Edit Item Types which encompass a primitive
267267
// type, a string function, and a scale factor for edit and display.
268268
// These items call the Edit Item draw method passing the prepared string.
269-
#define DEFINE_MENU_EDIT_ITEM_TYPE(TYPE, NAME, STRFUNC, SCALE) \
269+
#define DEFINE_MENU_EDIT_ITEM_TYPE(TYPE, NAME, FIX, STRFUNC, SCALE, V...) \
270270
struct MenuEditItemInfo_##NAME { \
271271
typedef TYPE type_t; \
272-
static constexpr float scale = SCALE; \
273-
static inline const char* strfunc(const float value) { return STRFUNC((TYPE)value); } \
272+
static inline float scale(const float value) { return value * (SCALE) + (V+0); } \
273+
static inline float unscale(const float value) { return value / (SCALE) + (V+0); } \
274+
static inline const char* strfunc(const float value) { return STRFUNC((TYPE)(FIX ? FIXFLOAT(value) : value)); } \
274275
}; \
275276
typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME
276277

277278
// TYPE NAME STRFUNC SCALE
278-
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, percent, ui8tostr4pct, 100.0/255); // 100% right-justified
279-
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified
280-
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
281-
DEFINE_MENU_EDIT_ITEM_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified
282-
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, uint8, ui8tostr3, 1 ); // 123 right-justified
283-
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123 right-justified
284-
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234 right-justified
285-
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_5, ui16tostr5, 0.01 ); // 12345 right-justified
286-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified
287-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52, ftostr42_52, 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
288-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234
289-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5, ftostr5rj, 1 ); // 12345 right-justified
290-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
291-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51, ftostr51rj, 10 ); // 1234.5 right-justified
292-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float41sign, ftostr41sign, 10 ); // +123.4
293-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5
294-
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45
295-
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified
296-
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
279+
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, percent, 0, ui8tostr4pct, 100.0/255, 0.5); // 100% right-justified
280+
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int3, 0, i16tostr3, 1 ); // 123, -12 right-justified
281+
DEFINE_MENU_EDIT_ITEM_TYPE(int16_t, int4, 0, i16tostr4sign, 1 ); // 1234, -123 right-justified
282+
DEFINE_MENU_EDIT_ITEM_TYPE(int8_t, int8, 0, i8tostr3, 1 ); // 123, -12 right-justified
283+
DEFINE_MENU_EDIT_ITEM_TYPE(uint8_t, uint8, 0, ui8tostr3, 1 ); // 123 right-justified
284+
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_3, 0, ui16tostr3, 1 ); // 123 right-justified
285+
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_4, 0, ui16tostr4, 0.1 ); // 1234 right-justified
286+
DEFINE_MENU_EDIT_ITEM_TYPE(uint16_t, uint16_5, 0, ui16tostr5, 0.01 ); // 12345 right-justified
287+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float3, 1, ftostr3, 1 ); // 123 right-justified
288+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52, 1, ftostr42_52, 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
289+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float43, 1, ftostr43sign, 1000 ); // 1.234
290+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5, 1, ftostr5rj, 1 ); // 12345 right-justified
291+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float5_25, 1, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
292+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51, 1, ftostr51rj, 10 ); // 1234.5 right-justified
293+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float41sign, 1, ftostr41sign, 10 ); // +123.4
294+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float51sign, 1, ftostr51sign, 10 ); // +1234.5
295+
DEFINE_MENU_EDIT_ITEM_TYPE(float, float52sign, 1, ftostr52sign, 100 ); // +123.45
296+
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5, 0, ftostr5rj, 0.01f ); // 12345 right-justified
297+
DEFINE_MENU_EDIT_ITEM_TYPE(uint32_t, long5_25, 0, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
297298

298299
class MenuItem_bool : public MenuEditItemBase {
299300
public:

0 commit comments

Comments
 (0)