Restore menu edit to 32bit value (#13976)
This commit is contained in:
parent
3eee880967
commit
991ee7552b
6 changed files with 27 additions and 27 deletions
|
@ -68,7 +68,7 @@ bool screen_changed;
|
||||||
// Value Editing
|
// Value Editing
|
||||||
PGM_P MenuItemBase::editLabel;
|
PGM_P MenuItemBase::editLabel;
|
||||||
void* MenuItemBase::editValue;
|
void* MenuItemBase::editValue;
|
||||||
int16_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue;
|
int32_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue;
|
||||||
screenFunc_t MenuItemBase::callbackFunc;
|
screenFunc_t MenuItemBase::callbackFunc;
|
||||||
bool MenuItemBase::liveEdit;
|
bool MenuItemBase::liveEdit;
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItemBase::init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) {
|
void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) {
|
||||||
ui.save_previous_screen();
|
ui.save_previous_screen();
|
||||||
ui.refresh();
|
ui.refresh();
|
||||||
editLabel = el;
|
editLabel = el;
|
||||||
|
|
|
@ -53,11 +53,11 @@ DECLARE_MENU_EDIT_TYPE(uint8_t, uint8, ui8tostr3, 1 ); // 123
|
||||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123, -12 right-justified
|
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123, -12 right-justified
|
||||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234, -123 right-justified
|
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234, -123 right-justified
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified
|
DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); // 123.45
|
DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); // 123.45, -23.45
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234
|
DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); // 12345 right-justified
|
DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); // 12345 right-justified
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
|
DECLARE_MENU_EDIT_TYPE(float, float5_25, ftostr5rj, 0.04f ); // 12345 right-justified (25 increment)
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51rj, 10 ); // 1234.5 right-justified
|
DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51rj, 10 ); // _1234.5 right-justified
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5
|
DECLARE_MENU_EDIT_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45
|
DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45
|
||||||
DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified
|
DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified
|
||||||
|
@ -123,11 +123,11 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint8); // 123 right-justif
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3); // 123, -12 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3); // 123, -12 right-justified
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4); // 1234, -123 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4); // 1234, -123 right-justified
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); // 123 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); // 123 right-justified
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); // 123.45
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); // 123.45, -23.45
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); // 1.234
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); // 1.234
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); // 12345 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); // 12345 right-justified
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5_25); // 12345 right-justified (25 increment)
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5_25); // 12345 right-justified (25 increment)
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); // 1234.5 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); // _1234.5 right-justified
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51sign); // +1234.5
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51sign); // +1234.5
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); // +123.45
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); // +123.45
|
||||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); // 12345 right-justified
|
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); // 12345 right-justified
|
||||||
|
@ -168,13 +168,13 @@ class MenuItemBase {
|
||||||
private:
|
private:
|
||||||
static PGM_P editLabel;
|
static PGM_P editLabel;
|
||||||
static void *editValue;
|
static void *editValue;
|
||||||
static int16_t minEditValue, maxEditValue;
|
static int32_t minEditValue, maxEditValue;
|
||||||
static screenFunc_t callbackFunc;
|
static screenFunc_t callbackFunc;
|
||||||
static bool liveEdit;
|
static bool liveEdit;
|
||||||
protected:
|
protected:
|
||||||
typedef char* (*strfunc_t)(const int16_t);
|
typedef char* (*strfunc_t)(const int32_t);
|
||||||
typedef void (*loadfunc_t)(void *, const int16_t);
|
typedef void (*loadfunc_t)(void *, const int32_t);
|
||||||
static void init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le);
|
static void init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le);
|
||||||
static void edit(strfunc_t, loadfunc_t);
|
static void edit(strfunc_t, loadfunc_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,13 +184,13 @@ class TMenuItem : MenuItemBase {
|
||||||
typedef typename NAME::type_t type_t;
|
typedef typename NAME::type_t type_t;
|
||||||
static inline float unscale(const float value) { return value * (1.0f / NAME::scale); }
|
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 inline float scale(const float value) { return value * NAME::scale; }
|
||||||
static void load(void *ptr, const int16_t value) { *((type_t*)ptr) = unscale(value); }
|
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
|
||||||
static char* to_string(const int16_t value) { return NAME::strfunc(unscale(value)); }
|
static char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
|
||||||
public:
|
public:
|
||||||
static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=nullptr, const bool live=false) {
|
static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=nullptr, const bool live=false) {
|
||||||
// Make sure minv and maxv fit within int16_t
|
// Make sure minv and maxv fit within int16_t
|
||||||
const int16_t minv = MAX(scale(minValue), INT16_MIN),
|
const int32_t minv = MAX(scale(minValue), INT_MIN),
|
||||||
maxv = MIN(scale(maxValue), INT16_MAX);
|
maxv = MIN(scale(maxValue), INT_MAX);
|
||||||
init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
|
init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live);
|
||||||
}
|
}
|
||||||
static void edit() { MenuItemBase::edit(to_string, load); }
|
static void edit() { MenuItemBase::edit(to_string, load); }
|
||||||
|
|
|
@ -131,9 +131,9 @@ void menu_backlash();
|
||||||
|
|
||||||
#if ENABLED(LIN_ADVANCE)
|
#if ENABLED(LIN_ADVANCE)
|
||||||
#if EXTRUDERS == 1
|
#if EXTRUDERS == 1
|
||||||
MENU_ITEM_EDIT(float51, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
|
MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
|
||||||
#elif EXTRUDERS > 1
|
#elif EXTRUDERS > 1
|
||||||
#define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float51, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999)
|
#define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999)
|
||||||
EDIT_ADVANCE_K(1);
|
EDIT_ADVANCE_K(1);
|
||||||
EDIT_ADVANCE_K(2);
|
EDIT_ADVANCE_K(2);
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
|
@ -669,9 +669,9 @@ void menu_advanced_settings() {
|
||||||
MENU_ITEM(submenu, MSG_FILAMENT, menu_advanced_filament);
|
MENU_ITEM(submenu, MSG_FILAMENT, menu_advanced_filament);
|
||||||
#elif ENABLED(LIN_ADVANCE)
|
#elif ENABLED(LIN_ADVANCE)
|
||||||
#if EXTRUDERS == 1
|
#if EXTRUDERS == 1
|
||||||
MENU_ITEM_EDIT(float51, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
|
MENU_ITEM_EDIT(float52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
|
||||||
#elif EXTRUDERS > 1
|
#elif EXTRUDERS > 1
|
||||||
#define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float51, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999)
|
#define EDIT_ADVANCE_K(N) MENU_ITEM_EDIT(float52, MSG_ADVANCE_K MSG_E##N, &planner.extruder_advance_K[N-1], 0, 999)
|
||||||
EDIT_ADVANCE_K(1);
|
EDIT_ADVANCE_K(1);
|
||||||
EDIT_ADVANCE_K(2);
|
EDIT_ADVANCE_K(2);
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
|
|
|
@ -278,7 +278,7 @@ void menu_bed_leveling() {
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
||||||
#elif HAS_BED_PROBE
|
#elif HAS_BED_PROBE
|
||||||
MENU_ITEM_EDIT(float52sign, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(LEVEL_BED_CORNERS)
|
#if ENABLED(LEVEL_BED_CORNERS)
|
||||||
|
|
|
@ -134,12 +134,12 @@ static void lcd_factory_settings() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_MAIN);
|
MENU_BACK(MSG_MAIN);
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets);
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets);
|
||||||
#else
|
#else
|
||||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets);
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets);
|
||||||
#endif
|
#endif
|
||||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets);
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets);
|
||||||
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
|
||||||
#if ENABLED(EEPROM_SETTINGS)
|
#if ENABLED(EEPROM_SETTINGS)
|
||||||
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
|
||||||
#endif
|
#endif
|
||||||
|
@ -287,7 +287,7 @@ void menu_configuration() {
|
||||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||||
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
||||||
#elif HAS_BED_PROBE
|
#elif HAS_BED_PROBE
|
||||||
MENU_ITEM_EDIT(float52sign, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const bool busy = printer_busy();
|
const bool busy = printer_busy();
|
||||||
|
|
|
@ -94,17 +94,17 @@ void _recalc_delta_settings() {
|
||||||
void lcd_delta_settings() {
|
void lcd_delta_settings() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_DELTA_CALIBRATE);
|
MENU_BACK(MSG_DELTA_CALIBRATE);
|
||||||
MENU_ITEM_EDIT_CALLBACK(float51, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings);
|
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10, delta_height + 10, _recalc_delta_settings);
|
||||||
#define EDIT_ENDSTOP_ADJ(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_endstop_adj[_AXIS(N)], -5, 5, _recalc_delta_settings)
|
#define EDIT_ENDSTOP_ADJ(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_endstop_adj[_AXIS(N)], -5, 5, _recalc_delta_settings)
|
||||||
EDIT_ENDSTOP_ADJ("Ex",A);
|
EDIT_ENDSTOP_ADJ("Ex",A);
|
||||||
EDIT_ENDSTOP_ADJ("Ey",B);
|
EDIT_ENDSTOP_ADJ("Ey",B);
|
||||||
EDIT_ENDSTOP_ADJ("Ez",C);
|
EDIT_ENDSTOP_ADJ("Ez",C);
|
||||||
MENU_ITEM_EDIT_CALLBACK(float51, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings);
|
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5, delta_radius + 5, _recalc_delta_settings);
|
||||||
#define EDIT_ANGLE_TRIM(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_tower_angle_trim[_AXIS(N)], -5, 5, _recalc_delta_settings)
|
#define EDIT_ANGLE_TRIM(LABEL,N) MENU_ITEM_EDIT_CALLBACK(float43, LABEL, &delta_tower_angle_trim[_AXIS(N)], -5, 5, _recalc_delta_settings)
|
||||||
EDIT_ANGLE_TRIM("Tx",A);
|
EDIT_ANGLE_TRIM("Tx",A);
|
||||||
EDIT_ANGLE_TRIM("Ty",B);
|
EDIT_ANGLE_TRIM("Ty",B);
|
||||||
EDIT_ANGLE_TRIM("Tz",C);
|
EDIT_ANGLE_TRIM("Tz",C);
|
||||||
MENU_ITEM_EDIT_CALLBACK(float51, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5, delta_diagonal_rod + 5, _recalc_delta_settings);
|
MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5, delta_diagonal_rod + 5, _recalc_delta_settings);
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue