Add Linear Advance values to EEPROM and enable configuration of K via LCD

This commit is contained in:
Thomas Moore 2017-04-15 22:18:10 -05:00 committed by Scott Lahteine
parent eb2d073dae
commit f8e77d6545
5 changed files with 168 additions and 67 deletions

View File

@ -36,7 +36,7 @@
*
*/
#define EEPROM_VERSION "V34"
#define EEPROM_VERSION "V35"
// Change EEPROM version if these are changed:
#define EEPROM_OFFSET 100
@ -149,8 +149,12 @@
* 572 M906 E3 stepperE3 current (uint16_t)
* 576 M906 E4 stepperE4 current (uint16_t)
*
* 580 Minimum end-point
* 1901 (580 + 36 + 9 + 288 + 988) Maximum end-point
* LIN_ADVANCE: 8 bytes
* 580 M905 K extruder_advance_k (float)
* 584 M905 WHD advance_ed_ratio (float)
*
* 588 Minimum end-point
* 1909 (588 + 36 + 9 + 288 + 988) Maximum end-point
*/
#include "configuration_store.h"
@ -570,6 +574,20 @@ void MarlinSettings::postprocess() {
for (uint8_t q = 0; q < 11; ++q) EEPROM_WRITE(val);
#endif
//
// Linear Advance
//
float extruder_advance_k = 0.0f, advance_ed_ratio = 0.0f;
#if ENABLED(LIN_ADVANCE)
extruder_advance_k = planner.get_extruder_advance_k();
advance_ed_ratio = planner.get_advance_ed_ratio();
#endif
EEPROM_WRITE(extruder_advance_k);
EEPROM_WRITE(advance_ed_ratio);
if (!eeprom_write_error) {
const uint16_t final_checksum = eeprom_checksum,
@ -900,6 +918,19 @@ void MarlinSettings::postprocess() {
for (uint8_t q = 0; q < 11; q++) EEPROM_READ(val);
#endif
//
// Linear Advance
//
float extruder_advance_k, advance_ed_ratio;
EEPROM_READ(extruder_advance_k);
EEPROM_READ(advance_ed_ratio);
#if ENABLED(LIN_ADVANCE)
planner.set_extruder_advance_k(extruder_advance_k);
planner.set_advance_ed_ratio(advance_ed_ratio);
#endif
if (eeprom_checksum == stored_checksum) {
if (eeprom_read_error)
reset();
@ -1155,6 +1186,11 @@ void MarlinSettings::reset() {
#endif
#endif
#if ENABLED(LIN_ADVANCE)
planner.set_extruder_advance_k(LIN_ADVANCE_K);
planner.set_advance_ed_ratio(LIN_ADVANCE_E_D_RATIO);
#endif
postprocess();
SERIAL_ECHO_START;
@ -1619,6 +1655,19 @@ void MarlinSettings::reset() {
#endif
SERIAL_EOL;
#endif
/**
* Linear Advance
*/
#if ENABLED(LIN_ADVANCE)
if (!forReplay) {
CONFIG_ECHO_START;
SERIAL_ECHOLNPGM("Linear Advance:");
}
CONFIG_ECHO_START;
SERIAL_ECHOPAIR(" M905 K", planner.get_extruder_advance_k());
SERIAL_ECHOLNPAIR(" R", planner.get_advance_ed_ratio());
#endif
}
#endif // !DISABLE_M503

View File

@ -267,9 +267,10 @@ class Planner {
#endif
#if ENABLED(LIN_ADVANCE)
static void set_extruder_advance_k(const float &k) { extruder_advance_k = k; };
static void set_extruder_advance_k(float k) { extruder_advance_k = k; };
static float get_extruder_advance_k() { return extruder_advance_k; };
static void set_advance_ed_ratio(const float &ratio) { advance_ed_ratio = ratio; };
static void set_advance_ed_ratio(float ratio) { advance_ed_ratio = ratio; };
static float get_advance_ed_ratio() { return advance_ed_ratio; };
#endif
/**

View File

@ -143,7 +143,7 @@ uint16_t max_display_update_time = 0;
void lcd_control_temperature_preheat_material1_settings_menu();
void lcd_control_temperature_preheat_material2_settings_menu();
void lcd_control_motion_menu();
void lcd_control_volumetric_menu();
void lcd_control_filament_menu();
#if ENABLED(DAC_STEPPER_CURRENT)
void dac_driver_commit();
@ -198,26 +198,31 @@ uint16_t max_display_update_time = 0;
void menu_action_submenu(screenFunc_t data);
void menu_action_gcode(const char* pgcode);
void menu_action_function(screenFunc_t data);
#define DECLARE_MENU_EDIT_TYPE(_type, _name) \
bool _menu_edit_ ## _name(); \
void menu_edit_ ## _name(); \
void menu_edit_callback_ ## _name(); \
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback); \
void _menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
void menu_action_setting_edit_accessor_ ## _name(const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue); \
typedef void _name##_void
DECLARE_MENU_EDIT_TYPE(int, int3);
DECLARE_MENU_EDIT_TYPE(float, float3);
DECLARE_MENU_EDIT_TYPE(float, float32);
DECLARE_MENU_EDIT_TYPE(float, float43);
DECLARE_MENU_EDIT_TYPE(float, float5);
DECLARE_MENU_EDIT_TYPE(float, float51);
DECLARE_MENU_EDIT_TYPE(float, float52);
DECLARE_MENU_EDIT_TYPE(float, float62);
DECLARE_MENU_EDIT_TYPE(unsigned long, long5);
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_float62(const char* pstr, float* ptr, float minValue, float maxValue);
void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_float62(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool));
#if ENABLED(SDSUPPORT)
void lcd_sdcard_menu();
@ -375,12 +380,15 @@ uint16_t max_display_update_time = 0;
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
#if ENABLED(ENCODER_RATE_MULTIPLIER)
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
#else //!ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_MULTIPLIER_ITEM_EDIT_ACCESSOR(type, label, ...) MENU_ITEM(setting_edit_accessor_ ## type, label, PSTR(label), ## __VA_ARGS__)
#endif //!ENCODER_RATE_MULTIPLIER
/** Used variables to keep track of the menu */
@ -417,6 +425,7 @@ uint16_t max_display_update_time = 0;
// Variables used when editing values.
const char* editLabel;
void* editValue;
void* editSetter;
int32_t minEditValue, maxEditValue;
screenFunc_t callbackFunc; // call this after editing
@ -2105,7 +2114,7 @@ void kill_screen(const char* lcd_msg) {
MENU_BACK(MSG_MAIN);
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_filament_menu);
#if HAS_LCD_CONTRAST
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
@ -2543,10 +2552,14 @@ void kill_screen(const char* lcd_msg) {
* "Control" > "Filament" submenu
*
*/
void lcd_control_volumetric_menu() {
void lcd_control_filament_menu() {
START_MENU();
MENU_BACK(MSG_CONTROL);
#if ENABLED(LIN_ADVANCE)
MENU_ITEM_EDIT_ACCESSOR(float3, MSG_ADVANCE_K, planner.get_extruder_advance_k, planner.set_extruder_advance_k, 0, 999);
#endif
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
if (volumetric_enabled) {
@ -3101,6 +3114,8 @@ void kill_screen(const char* lcd_msg) {
* void _menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
* void menu_action_setting_edit_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue);
* void menu_action_setting_edit_callback_int3(const char * const pstr, int * const ptr, const int minValue, const int maxValue, const screenFunc_t callback); // edit int with callback
* void _menu_action_setting_edit_accessor_int3(const char * const pstr, int (*pget)(), void (*pset)(int), const int minValue, const int maxValue);
* void menu_action_setting_edit_accessor_int3(const char * const pstr, int (*pget)(), void (*pset)(int), const int minValue, const int maxValue); // edit int via pget and pset accessor functions
*
* You can then use one of the menu macros to present the edit interface:
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
@ -3112,6 +3127,9 @@ void kill_screen(const char* lcd_msg) {
* Also: MENU_MULTIPLIER_ITEM_EDIT, MENU_ITEM_EDIT_CALLBACK, and MENU_MULTIPLIER_ITEM_EDIT_CALLBACK
*
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999)
*
* Values that are get/set via functions (As opposed to global variables) can use the accessor form:
* MENU_ITEM_EDIT_ACCESSOR(int3, MSG_SPEED, get_feedrate_percentage, set_feedrate_percentage, 10, 999)
*/
#define menu_edit_type(_type, _name, _strFunc, _scale) \
bool _menu_edit_ ## _name () { \
@ -3121,7 +3139,11 @@ void kill_screen(const char* lcd_msg) {
if (lcdDrawUpdate) \
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale))); \
if (lcd_clicked) { \
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
_type value = ((_type)((int32_t)encoderPosition + minEditValue)) * (1.0 / _scale); \
if (editValue != NULL) \
*((_type*)editValue) = value; \
else if (editSetter != NULL) \
((void (*)(_type))editSetter)(value); \
lcd_goto_previous_menu(); \
} \
return lcd_clicked; \
@ -3135,6 +3157,7 @@ void kill_screen(const char* lcd_msg) {
\
editLabel = pstr; \
editValue = ptr; \
editSetter = NULL; \
minEditValue = minValue * _scale; \
maxEditValue = maxValue * _scale - minEditValue; \
encoderPosition = (*ptr) * _scale - minEditValue; \
@ -3148,6 +3171,22 @@ void kill_screen(const char* lcd_msg) {
currentScreen = menu_edit_callback_ ## _name; \
callbackFunc = callback; \
} \
void _menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
lcd_save_previous_screen(); \
\
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
\
editLabel = pstr; \
editValue = NULL; \
editSetter = pset; \
minEditValue = minValue * _scale; \
maxEditValue = maxValue * _scale - minEditValue; \
encoderPosition = pget() * _scale - minEditValue; \
} \
void menu_action_setting_edit_accessor_ ## _name (const char * const pstr, _type (*pget)(), void (*pset)(_type), const _type minValue, const _type maxValue) { \
_menu_action_setting_edit_accessor_ ## _name(pstr, pget, pset, minValue, maxValue); \
currentScreen = menu_edit_ ## _name; \
} \
typedef void _name
menu_edit_type(int, int3, itostr3, 1);
@ -3252,6 +3291,11 @@ void kill_screen(const char* lcd_msg) {
menu_action_setting_edit_bool(pstr, ptr);
(*callback)();
}
void menu_action_setting_edit_accessor_bool(const char* pstr, bool (*pget)(), void (*pset)(bool)) {
UNUSED(pstr);
pset(!pget());
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
}
#endif // ULTIPANEL

View File

@ -767,27 +767,31 @@ static void lcd_implementation_status_screen() {
#define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false)
#define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true)
#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _strFunc(pget())); \
} \
typedef void _name##_void
#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int, int3, itostr3);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float32, ftostr32);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(long, long5, ftostr5rj);
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL) {
const uint8_t labellen = lcd_strlen_P(pstr),

View File

@ -874,28 +874,31 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(data);
}
#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _strFunc(pget())); \
} \
typedef void _name##_void
//Add version for callback functions
#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr43sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(int, int3, itostr3);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float3, ftostr3);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float32, ftostr32);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float43, ftostr43sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float5, ftostr5rj);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float51, ftostr51sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float52, ftostr52sign);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(float, float62, ftostr62rj);
DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(long, long5, ftostr5rj);
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) {
lcd.setCursor(1, 1);