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