|
|
@ -37,52 +37,33 @@ |
|
|
|
|
|
|
|
#if ENABLED(GRADIENT_MIX) |
|
|
|
|
|
|
|
void lcd_mixer_gradient_z_start_edit() { |
|
|
|
void _lcd_mixer_gradient_z_edit(const bool isend) { |
|
|
|
ui.defer_status_screen(); |
|
|
|
ENCODER_RATE_MULTIPLY(true); |
|
|
|
if (ui.encoderPosition != 0) { |
|
|
|
mixer.gradient.start_z += float(int32_t(ui.encoderPosition)) * 0.1; |
|
|
|
ui.encoderPosition = 0; |
|
|
|
NOLESS(mixer.gradient.start_z, 0); |
|
|
|
NOMORE(mixer.gradient.start_z, Z_MAX_POS); |
|
|
|
} |
|
|
|
if (ui.should_draw()) { |
|
|
|
char tmp[21]; |
|
|
|
strcpy_P(tmp, GET_TEXT(MSG_START_Z)); |
|
|
|
sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10); |
|
|
|
SETCURSOR(2, (LCD_HEIGHT - 1) / 2); |
|
|
|
lcd_put_u8str(tmp); |
|
|
|
} |
|
|
|
|
|
|
|
if (ui.lcd_clicked) { |
|
|
|
if (mixer.gradient.start_z > mixer.gradient.end_z) |
|
|
|
mixer.gradient.end_z = mixer.gradient.start_z; |
|
|
|
mixer.refresh_gradient(); |
|
|
|
ui.goto_previous_screen(); |
|
|
|
} |
|
|
|
} |
|
|
|
float &zvar = isend ? mixer.gradient.end_z : mixer.gradient.start_z; |
|
|
|
|
|
|
|
void lcd_mixer_gradient_z_end_edit() { |
|
|
|
ui.defer_status_screen(); |
|
|
|
ENCODER_RATE_MULTIPLY(true); |
|
|
|
if (ui.encoderPosition != 0) { |
|
|
|
mixer.gradient.end_z += float(int32_t(ui.encoderPosition)) * 0.1; |
|
|
|
if (ui.encoderPosition) { |
|
|
|
zvar += float(int32_t(ui.encoderPosition)) * 0.1; |
|
|
|
ui.encoderPosition = 0; |
|
|
|
NOLESS(mixer.gradient.end_z, 0); |
|
|
|
NOMORE(mixer.gradient.end_z, Z_MAX_POS); |
|
|
|
NOLESS(zvar, 0); |
|
|
|
NOMORE(zvar, Z_MAX_POS); |
|
|
|
} |
|
|
|
|
|
|
|
if (ui.should_draw()) { |
|
|
|
char tmp[21]; |
|
|
|
strcpy_P(tmp, GET_TEXT(MSG_END_Z)); |
|
|
|
sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10); |
|
|
|
SETCURSOR(2, (LCD_HEIGHT - 1) / 2); |
|
|
|
char tmp[16]; |
|
|
|
SETCURSOR(1, (LCD_HEIGHT - 1) / 2); |
|
|
|
lcd_put_u8str_P(isend ? GET_TEXT(MSG_END_Z) : GET_TEXT(MSG_START_Z)); |
|
|
|
sprintf_P(tmp, PSTR("%4d.%d mm"), int(zvar), int(zvar * 10) % 10); |
|
|
|
SETCURSOR_RJ(9, (LCD_HEIGHT - 1) / 2); |
|
|
|
lcd_put_u8str(tmp); |
|
|
|
} |
|
|
|
|
|
|
|
if (ui.lcd_clicked) { |
|
|
|
if (mixer.gradient.end_z < mixer.gradient.start_z) |
|
|
|
mixer.gradient.start_z = mixer.gradient.end_z; |
|
|
|
if (isend && zvar < mixer.gradient.start_z) |
|
|
|
mixer.gradient.start_z = zvar; |
|
|
|
else if (!isend && zvar > mixer.gradient.end_z) |
|
|
|
mixer.gradient.end_z = zvar; |
|
|
|
mixer.refresh_gradient(); |
|
|
|
ui.goto_previous_screen(); |
|
|
|
} |
|
|
@ -96,19 +77,21 @@ |
|
|
|
EDIT_ITEM(int8, MSG_END_VTOOL, &mixer.gradient.end_vtool, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); |
|
|
|
|
|
|
|
#if ENABLED(GRADIENT_VTOOL) |
|
|
|
EDIT_ITEM(int8, MSG_GRADIENT_ALIAS, &mixer.gradient.vtool_index, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); |
|
|
|
EDIT_ITEM(int8, MSG_GRADIENT_ALIAS, &mixer.gradient.vtool_index, -1, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); |
|
|
|
#endif |
|
|
|
|
|
|
|
char tmp[18]; |
|
|
|
|
|
|
|
SUBMENU(MSG_START_Z, lcd_mixer_gradient_z_start_edit); |
|
|
|
MENU_ITEM_ADDON_START(9); |
|
|
|
PGM_P const slabel = GET_TEXT(MSG_START_Z); |
|
|
|
SUBMENU_P(slabel, []{ _lcd_mixer_gradient_z_edit(false); }); |
|
|
|
MENU_ITEM_ADDON_START_RJ(11); |
|
|
|
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10); |
|
|
|
lcd_put_u8str(tmp); |
|
|
|
MENU_ITEM_ADDON_END(); |
|
|
|
|
|
|
|
SUBMENU(MSG_END_Z, lcd_mixer_gradient_z_end_edit); |
|
|
|
MENU_ITEM_ADDON_START(9); |
|
|
|
PGM_P const elabel = GET_TEXT(MSG_END_Z); |
|
|
|
SUBMENU_P(elabel, []{ _lcd_mixer_gradient_z_edit(true); }); |
|
|
|
MENU_ITEM_ADDON_START_RJ(11); |
|
|
|
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10); |
|
|
|
lcd_put_u8str(tmp); |
|
|
|
MENU_ITEM_ADDON_END(); |
|
|
@ -125,7 +108,7 @@ static uint8_t v_index; |
|
|
|
char tmp[20]; // "100%_100%"
|
|
|
|
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1])); |
|
|
|
SETCURSOR(2, y); lcd_put_u8str_P(GET_TEXT(MSG_MIX)); |
|
|
|
SETCURSOR_RJ(9, y); lcd_put_u8str(tmp); |
|
|
|
SETCURSOR_RJ(10, y); lcd_put_u8str(tmp); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
@ -157,7 +140,7 @@ void lcd_mixer_mix_edit() { |
|
|
|
#if HAS_DUAL_MIXING && !CHANNEL_MIX_EDITING |
|
|
|
|
|
|
|
// Adjust 2-channel mix from the encoder
|
|
|
|
if (ui.encoderPosition != 0) { |
|
|
|
if (ui.encoderPosition) { |
|
|
|
mixer.mix[0] += int32_t(ui.encoderPosition); |
|
|
|
ui.encoderPosition = 0; |
|
|
|
if (mixer.mix[0] < 0) mixer.mix[0] += 101; |
|
|
@ -241,9 +224,9 @@ void menu_mixer() { |
|
|
|
|
|
|
|
#if HAS_DUAL_MIXING |
|
|
|
{ |
|
|
|
char tmp[10]; |
|
|
|
char tmp[11]; |
|
|
|
SUBMENU(MSG_MIX, lcd_mixer_mix_edit); |
|
|
|
MENU_ITEM_ADDON_START(10); |
|
|
|
MENU_ITEM_ADDON_START_RJ(9); |
|
|
|
mixer.update_mix_from_vtool(); |
|
|
|
sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1])); |
|
|
|
lcd_put_u8str(tmp); |
|
|
@ -272,7 +255,7 @@ void menu_mixer() { |
|
|
|
{ |
|
|
|
char tmp[13]; |
|
|
|
SUBMENU(MSG_GRADIENT, lcd_mixer_edit_gradient_menu); |
|
|
|
MENU_ITEM_ADDON_START(10); |
|
|
|
MENU_ITEM_ADDON_START_RJ(9); |
|
|
|
sprintf_P(tmp, PSTR("T%i->T%i"), mixer.gradient.start_vtool, mixer.gradient.end_vtool); |
|
|
|
lcd_put_u8str(tmp); |
|
|
|
MENU_ITEM_ADDON_END(); |
|
|
|