|
@@ -37,52 +37,33 @@
|
37
|
37
|
|
38
|
38
|
#if ENABLED(GRADIENT_MIX)
|
39
|
39
|
|
40
|
|
- void lcd_mixer_gradient_z_start_edit() {
|
|
40
|
+ void _lcd_mixer_gradient_z_edit(const bool isend) {
|
41
|
41
|
ui.defer_status_screen();
|
42
|
42
|
ENCODER_RATE_MULTIPLY(true);
|
43
|
|
- if (ui.encoderPosition != 0) {
|
44
|
|
- mixer.gradient.start_z += float(int32_t(ui.encoderPosition)) * 0.1;
|
45
|
|
- ui.encoderPosition = 0;
|
46
|
|
- NOLESS(mixer.gradient.start_z, 0);
|
47
|
|
- NOMORE(mixer.gradient.start_z, Z_MAX_POS);
|
48
|
|
- }
|
49
|
|
- if (ui.should_draw()) {
|
50
|
|
- char tmp[21];
|
51
|
|
- strcpy_P(tmp, GET_TEXT(MSG_START_Z));
|
52
|
|
- sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10);
|
53
|
|
- SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
|
54
|
|
- lcd_put_u8str(tmp);
|
55
|
|
- }
|
56
|
43
|
|
57
|
|
- if (ui.lcd_clicked) {
|
58
|
|
- if (mixer.gradient.start_z > mixer.gradient.end_z)
|
59
|
|
- mixer.gradient.end_z = mixer.gradient.start_z;
|
60
|
|
- mixer.refresh_gradient();
|
61
|
|
- ui.goto_previous_screen();
|
62
|
|
- }
|
63
|
|
- }
|
|
44
|
+ float &zvar = isend ? mixer.gradient.end_z : mixer.gradient.start_z;
|
64
|
45
|
|
65
|
|
- void lcd_mixer_gradient_z_end_edit() {
|
66
|
|
- ui.defer_status_screen();
|
67
|
|
- ENCODER_RATE_MULTIPLY(true);
|
68
|
|
- if (ui.encoderPosition != 0) {
|
69
|
|
- mixer.gradient.end_z += float(int32_t(ui.encoderPosition)) * 0.1;
|
|
46
|
+ if (ui.encoderPosition) {
|
|
47
|
+ zvar += float(int32_t(ui.encoderPosition)) * 0.1;
|
70
|
48
|
ui.encoderPosition = 0;
|
71
|
|
- NOLESS(mixer.gradient.end_z, 0);
|
72
|
|
- NOMORE(mixer.gradient.end_z, Z_MAX_POS);
|
|
49
|
+ NOLESS(zvar, 0);
|
|
50
|
+ NOMORE(zvar, Z_MAX_POS);
|
73
|
51
|
}
|
74
|
52
|
|
75
|
53
|
if (ui.should_draw()) {
|
76
|
|
- char tmp[21];
|
77
|
|
- strcpy_P(tmp, GET_TEXT(MSG_END_Z));
|
78
|
|
- sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10);
|
79
|
|
- SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
|
|
54
|
+ char tmp[16];
|
|
55
|
+ SETCURSOR(1, (LCD_HEIGHT - 1) / 2);
|
|
56
|
+ lcd_put_u8str_P(isend ? GET_TEXT(MSG_END_Z) : GET_TEXT(MSG_START_Z));
|
|
57
|
+ sprintf_P(tmp, PSTR("%4d.%d mm"), int(zvar), int(zvar * 10) % 10);
|
|
58
|
+ SETCURSOR_RJ(9, (LCD_HEIGHT - 1) / 2);
|
80
|
59
|
lcd_put_u8str(tmp);
|
81
|
60
|
}
|
82
|
61
|
|
83
|
62
|
if (ui.lcd_clicked) {
|
84
|
|
- if (mixer.gradient.end_z < mixer.gradient.start_z)
|
85
|
|
- mixer.gradient.start_z = mixer.gradient.end_z;
|
|
63
|
+ if (isend && zvar < mixer.gradient.start_z)
|
|
64
|
+ mixer.gradient.start_z = zvar;
|
|
65
|
+ else if (!isend && zvar > mixer.gradient.end_z)
|
|
66
|
+ mixer.gradient.end_z = zvar;
|
86
|
67
|
mixer.refresh_gradient();
|
87
|
68
|
ui.goto_previous_screen();
|
88
|
69
|
}
|
|
@@ -96,19 +77,21 @@
|
96
|
77
|
EDIT_ITEM(int8, MSG_END_VTOOL, &mixer.gradient.end_vtool, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient);
|
97
|
78
|
|
98
|
79
|
#if ENABLED(GRADIENT_VTOOL)
|
99
|
|
- EDIT_ITEM(int8, MSG_GRADIENT_ALIAS, &mixer.gradient.vtool_index, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient);
|
|
80
|
+ EDIT_ITEM(int8, MSG_GRADIENT_ALIAS, &mixer.gradient.vtool_index, -1, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient);
|
100
|
81
|
#endif
|
101
|
82
|
|
102
|
83
|
char tmp[18];
|
103
|
84
|
|
104
|
|
- SUBMENU(MSG_START_Z, lcd_mixer_gradient_z_start_edit);
|
105
|
|
- MENU_ITEM_ADDON_START(9);
|
|
85
|
+ PGM_P const slabel = GET_TEXT(MSG_START_Z);
|
|
86
|
+ SUBMENU_P(slabel, []{ _lcd_mixer_gradient_z_edit(false); });
|
|
87
|
+ MENU_ITEM_ADDON_START_RJ(11);
|
106
|
88
|
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10);
|
107
|
89
|
lcd_put_u8str(tmp);
|
108
|
90
|
MENU_ITEM_ADDON_END();
|
109
|
91
|
|
110
|
|
- SUBMENU(MSG_END_Z, lcd_mixer_gradient_z_end_edit);
|
111
|
|
- MENU_ITEM_ADDON_START(9);
|
|
92
|
+ PGM_P const elabel = GET_TEXT(MSG_END_Z);
|
|
93
|
+ SUBMENU_P(elabel, []{ _lcd_mixer_gradient_z_edit(true); });
|
|
94
|
+ MENU_ITEM_ADDON_START_RJ(11);
|
112
|
95
|
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10);
|
113
|
96
|
lcd_put_u8str(tmp);
|
114
|
97
|
MENU_ITEM_ADDON_END();
|
|
@@ -125,7 +108,7 @@ static uint8_t v_index;
|
125
|
108
|
char tmp[20]; // "100%_100%"
|
126
|
109
|
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
127
|
110
|
SETCURSOR(2, y); lcd_put_u8str_P(GET_TEXT(MSG_MIX));
|
128
|
|
- SETCURSOR_RJ(9, y); lcd_put_u8str(tmp);
|
|
111
|
+ SETCURSOR_RJ(10, y); lcd_put_u8str(tmp);
|
129
|
112
|
}
|
130
|
113
|
#endif
|
131
|
114
|
|
|
@@ -157,7 +140,7 @@ void lcd_mixer_mix_edit() {
|
157
|
140
|
#if HAS_DUAL_MIXING && !CHANNEL_MIX_EDITING
|
158
|
141
|
|
159
|
142
|
// Adjust 2-channel mix from the encoder
|
160
|
|
- if (ui.encoderPosition != 0) {
|
|
143
|
+ if (ui.encoderPosition) {
|
161
|
144
|
mixer.mix[0] += int32_t(ui.encoderPosition);
|
162
|
145
|
ui.encoderPosition = 0;
|
163
|
146
|
if (mixer.mix[0] < 0) mixer.mix[0] += 101;
|
|
@@ -241,9 +224,9 @@ void menu_mixer() {
|
241
|
224
|
|
242
|
225
|
#if HAS_DUAL_MIXING
|
243
|
226
|
{
|
244
|
|
- char tmp[10];
|
|
227
|
+ char tmp[11];
|
245
|
228
|
SUBMENU(MSG_MIX, lcd_mixer_mix_edit);
|
246
|
|
- MENU_ITEM_ADDON_START(10);
|
|
229
|
+ MENU_ITEM_ADDON_START_RJ(9);
|
247
|
230
|
mixer.update_mix_from_vtool();
|
248
|
231
|
sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
249
|
232
|
lcd_put_u8str(tmp);
|
|
@@ -272,7 +255,7 @@ void menu_mixer() {
|
272
|
255
|
{
|
273
|
256
|
char tmp[13];
|
274
|
257
|
SUBMENU(MSG_GRADIENT, lcd_mixer_edit_gradient_menu);
|
275
|
|
- MENU_ITEM_ADDON_START(10);
|
|
258
|
+ MENU_ITEM_ADDON_START_RJ(9);
|
276
|
259
|
sprintf_P(tmp, PSTR("T%i->T%i"), mixer.gradient.start_vtool, mixer.gradient.end_vtool);
|
277
|
260
|
lcd_put_u8str(tmp);
|
278
|
261
|
MENU_ITEM_ADDON_END();
|