Allow to live-tune K during a print
This commit is contained in:
parent
282b502393
commit
0a26de1e7f
@ -96,7 +96,7 @@ void menu_back(void)
|
||||
menu_back(1);
|
||||
}
|
||||
|
||||
static void menu_back_no_reset(void)
|
||||
void menu_back_no_reset(void)
|
||||
{
|
||||
if (menu_depth > 0)
|
||||
{
|
||||
@ -130,7 +130,7 @@ void menu_submenu(menu_func_t submenu)
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_submenu_no_reset(menu_func_t submenu)
|
||||
void menu_submenu_no_reset(menu_func_t submenu)
|
||||
{
|
||||
if (menu_depth < MENU_DEPTH_MAX)
|
||||
{
|
||||
|
@ -54,6 +54,7 @@ void menu_start(void);
|
||||
extern void menu_end(void);
|
||||
|
||||
extern void menu_back(void);
|
||||
extern void menu_back_no_reset(void);
|
||||
extern void menu_back(uint8_t nLevel);
|
||||
|
||||
extern void menu_back_if_clicked(void);
|
||||
@ -61,6 +62,7 @@ extern void menu_back_if_clicked(void);
|
||||
extern void menu_back_if_clicked_fb(void);
|
||||
|
||||
extern void menu_submenu(menu_func_t submenu);
|
||||
extern void menu_submenu_no_reset(menu_func_t submenu);
|
||||
|
||||
extern uint8_t menu_item_ret(void);
|
||||
|
||||
@ -98,6 +100,7 @@ extern const char menu_fmt_int3[];
|
||||
|
||||
extern const char menu_fmt_float31[];
|
||||
extern const char menu_fmt_float13[];
|
||||
extern const char menu_fmt_float13off[];
|
||||
|
||||
|
||||
extern void menu_draw_float31(const char* str, float val);
|
||||
|
@ -6606,6 +6606,60 @@ static void lcd_colorprint_change() {
|
||||
lcd_draw_update = 3;
|
||||
}
|
||||
|
||||
|
||||
#ifdef LIN_ADVANCE
|
||||
// @wavexx: looks like there's no generic float editing function in menu.cpp so we
|
||||
// redefine our custom handling functions to mimick other tunables
|
||||
#define MSG_ADVANCE_K PSTR("Advance K:")
|
||||
|
||||
static void lcd_advance_draw_K(char chr, float val)
|
||||
{
|
||||
if (val <= 0)
|
||||
lcd_printf_P(menu_fmt_float13off, chr, MSG_ADVANCE_K, " [off]");
|
||||
else
|
||||
lcd_printf_P(menu_fmt_float13, chr, MSG_ADVANCE_K, val);
|
||||
}
|
||||
|
||||
static void lcd_advance_edit_K(void)
|
||||
{
|
||||
if (lcd_draw_update)
|
||||
{
|
||||
if (lcd_encoder < 0) lcd_encoder = 0;
|
||||
if (lcd_encoder > 999) lcd_encoder = 999;
|
||||
lcd_set_cursor(0, 1);
|
||||
lcd_advance_draw_K(' ', 0.01 * lcd_encoder);
|
||||
}
|
||||
if (LCD_CLICKED)
|
||||
{
|
||||
extruder_advance_K = 0.01 * lcd_encoder;
|
||||
menu_back_no_reset();
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t lcd_advance_K()
|
||||
{
|
||||
if (menu_item == menu_line)
|
||||
{
|
||||
if (lcd_draw_update)
|
||||
{
|
||||
lcd_set_cursor(0, menu_row);
|
||||
lcd_advance_draw_K((lcd_encoder == menu_item)?'>':' ', extruder_advance_K);
|
||||
}
|
||||
if (menu_clicked && (lcd_encoder == menu_item))
|
||||
{
|
||||
menu_submenu_no_reset(lcd_advance_edit_K);
|
||||
lcd_encoder = 100. * extruder_advance_K;
|
||||
return menu_item_ret();
|
||||
}
|
||||
}
|
||||
menu_item++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MENU_ITEM_EDIT_advance_K() do { if (lcd_advance_K()) return; } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
static void lcd_tune_menu()
|
||||
{
|
||||
typedef struct
|
||||
@ -6644,8 +6698,11 @@ static void lcd_tune_menu()
|
||||
|
||||
MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), &fanSpeed, 0, 255);//5
|
||||
MENU_ITEM_EDIT_int3_P(_i("Flow"), &extrudemultiply, 10, 999);//6////MSG_FLOW
|
||||
#ifdef LIN_ADVANCE
|
||||
MENU_ITEM_EDIT_advance_K();//7
|
||||
#endif
|
||||
#ifdef FILAMENTCHANGEENABLE
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//7
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8
|
||||
#endif
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
|
Loading…
Reference in New Issue
Block a user