Browse Source

Apply ternary macros

Scott Lahteine 4 years ago
parent
commit
c536b8de62

+ 11
- 35
Marlin/src/feature/runout.h View File

100
 
100
 
101
     // Give the response a chance to update its counter.
101
     // Give the response a chance to update its counter.
102
     static inline void run() {
102
     static inline void run() {
103
-      if (enabled && !filament_ran_out && (printingIsActive()
104
-        #if ENABLED(ADVANCED_PAUSE_FEATURE)
105
-          || did_pause_print
106
-        #endif
107
-      )) {
103
+      if ( enabled && !filament_ran_out
104
+        && (printingIsActive() || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print))
105
+      ) {
108
         #ifdef FILAMENT_RUNOUT_DISTANCE_MM
106
         #ifdef FILAMENT_RUNOUT_DISTANCE_MM
109
           cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
107
           cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
110
         #endif
108
         #endif
153
 
151
 
154
     // Return a bitmask of runout flag states (1 bits always indicates runout)
152
     // Return a bitmask of runout flag states (1 bits always indicates runout)
155
     static inline uint8_t poll_runout_states() {
153
     static inline uint8_t poll_runout_states() {
156
-      return (poll_runout_pins()
157
-        #if DISABLED(FIL_RUNOUT_INVERTING)
158
-          ^ uint8_t(_BV(NUM_RUNOUT_SENSORS) - 1)
159
-        #endif
160
-      );
154
+      return poll_runout_pins() ^ uint8_t(TERN0(FIL_RUNOUT_INVERTING, _BV(NUM_RUNOUT_SENSORS) - 1));
161
     }
155
     }
162
 
156
 
163
   #undef INIT_RUNOUT_PIN
157
   #undef INIT_RUNOUT_PIN
217
     private:
211
     private:
218
       static inline bool poll_runout_state(const uint8_t extruder) {
212
       static inline bool poll_runout_state(const uint8_t extruder) {
219
         const uint8_t runout_states = poll_runout_states();
213
         const uint8_t runout_states = poll_runout_states();
220
-
221
         #if NUM_RUNOUT_SENSORS == 1
214
         #if NUM_RUNOUT_SENSORS == 1
222
           UNUSED(extruder);
215
           UNUSED(extruder);
216
+        #else
217
+          if ( !TERN0(DUAL_X_CARRIAGE, dxc_is_duplicating())
218
+            && !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
219
+          ) return TEST(runout_states, extruder); // A specific extruder ran out
223
         #endif
220
         #endif
224
-
225
-        if (true
226
-          #if NUM_RUNOUT_SENSORS > 1
227
-            #if ENABLED(DUAL_X_CARRIAGE)
228
-              && (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_MIRRORED_MODE)
229
-            #elif ENABLED(MULTI_NOZZLE_DUPLICATION)
230
-              && extruder_duplication_enabled
231
-            #else
232
-              && false
233
-            #endif
234
-          #endif
235
-        ) return runout_states;               // Any extruder
236
-
237
-        #if NUM_RUNOUT_SENSORS > 1
238
-          return TEST(runout_states, extruder); // Specific extruder
239
-        #endif
221
+        return !!runout_states;                   // Any extruder ran out
240
       }
222
       }
241
 
223
 
242
     public:
224
     public:
302
 
284
 
303
       static inline void block_completed(const block_t* const b) {
285
       static inline void block_completed(const block_t* const b) {
304
         if (b->steps.x || b->steps.y || b->steps.z
286
         if (b->steps.x || b->steps.y || b->steps.z
305
-          #if ENABLED(ADVANCED_PAUSE_FEATURE)
306
-            || did_pause_print // Allow pause purge move to re-trigger runout state
307
-          #endif
287
+          || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print) // Allow pause purge move to re-trigger runout state
308
         ) {
288
         ) {
309
           // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
289
           // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
310
           const uint8_t e = b->extruder;
290
           const uint8_t e = b->extruder;
338
 typedef TFilamentMonitor<
318
 typedef TFilamentMonitor<
339
   #ifdef FILAMENT_RUNOUT_DISTANCE_MM
319
   #ifdef FILAMENT_RUNOUT_DISTANCE_MM
340
     RunoutResponseDelayed,
320
     RunoutResponseDelayed,
341
-    #if ENABLED(FILAMENT_MOTION_SENSOR)
342
-      FilamentSensorEncoder
343
-    #else
344
-      FilamentSensorSwitch
345
-    #endif
321
+    TERN(FILAMENT_MOTION_SENSOR, FilamentSensorEncoder, FilamentSensorSwitch)
346
   #else
322
   #else
347
     RunoutResponseDebounced, FilamentSensorSwitch
323
     RunoutResponseDebounced, FilamentSensorSwitch
348
   #endif
324
   #endif

+ 2
- 6
Marlin/src/gcode/feature/pause/M600.cpp View File

103
   #if EXTRUDERS > 1
103
   #if EXTRUDERS > 1
104
     // Change toolhead if specified
104
     // Change toolhead if specified
105
     const uint8_t active_extruder_before_filament_change = active_extruder;
105
     const uint8_t active_extruder_before_filament_change = active_extruder;
106
-    if (
107
-      active_extruder != target_extruder
108
-      #if ENABLED(DUAL_X_CARRIAGE)
109
-        && dual_x_carriage_mode != DXC_DUPLICATION_MODE && dual_x_carriage_mode != DXC_MIRRORED_MODE
110
-      #endif
111
-    ) tool_change(target_extruder, false);
106
+    if (active_extruder != target_extruder && TERN1(DUAL_X_CARRIAGE, !dxc_is_duplicating()))
107
+      tool_change(target_extruder, false);
112
   #endif
108
   #endif
113
 
109
 
114
   // Initial retract before move to filament change position
110
   // Initial retract before move to filament change position

+ 21
- 56
Marlin/src/lcd/menu/menu.cpp View File

87
     screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items };
87
     screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items };
88
 }
88
 }
89
 
89
 
90
-void MarlinUI::_goto_previous_screen(
91
-  #if ENABLED(TURBO_BACK_MENU_ITEM)
92
-    const bool is_back/*=false*/
93
-  #endif
94
-) {
90
+void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
95
   #if DISABLED(TURBO_BACK_MENU_ITEM)
91
   #if DISABLED(TURBO_BACK_MENU_ITEM)
96
     constexpr bool is_back = false;
92
     constexpr bool is_back = false;
97
   #endif
93
   #endif
233
           doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
229
           doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
234
       }
230
       }
235
       else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
231
       else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
236
-
237
-        #if ENABLED(BABYSTEP_WITHOUT_HOMING)
238
-          constexpr bool can_babystep = true;
239
-        #else
240
-          const bool can_babystep = all_axes_known();
241
-        #endif
242
-        #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE)
243
-          constexpr bool should_babystep = true;
244
-        #else
245
-          const bool should_babystep = printer_busy();
246
-        #endif
247
-
248
-        if (should_babystep && can_babystep) {
249
-          screen =
250
-            #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
251
-              lcd_babystep_zoffset
252
-            #else
253
-              lcd_babystep_z
254
-            #endif
255
-          ;
256
-        }
257
-        #if ENABLED(MOVE_Z_WHEN_IDLE)
258
-          else {
232
+        if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known())
233
+          && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
234
+          screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
235
+        else {
236
+          #if ENABLED(MOVE_Z_WHEN_IDLE)
259
             move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR;
237
             move_menu_scale = MOVE_Z_IDLE_MULTIPLICATOR;
260
             screen = lcd_move_z;
238
             screen = lcd_move_z;
261
-          }
262
-        #endif
239
+          #endif
240
+        }
263
       }
241
       }
264
     #endif
242
     #endif
265
 
243
 
277
 
255
 
278
     // Re-initialize custom characters that may be re-used
256
     // Re-initialize custom characters that may be re-used
279
     #if HAS_CHARACTER_LCD
257
     #if HAS_CHARACTER_LCD
280
-      if (true
281
-        #if ENABLED(AUTO_BED_LEVELING_UBL)
282
-          && !ubl.lcd_map_control
283
-        #endif
284
-      ) set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU);
258
+      if (TERN1(AUTO_BED_LEVELING_UBL, !ubl.lcd_map_control))
259
+        set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU);
285
     #endif
260
     #endif
286
 
261
 
287
     refresh(LCDVIEW_CALL_REDRAW_NEXT);
262
     refresh(LCDVIEW_CALL_REDRAW_NEXT);
377
 
352
 
378
       const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
353
       const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
379
                   new_probe_offset = probe.offset.z + diff,
354
                   new_probe_offset = probe.offset.z + diff,
380
-                  new_offs =
381
-                    #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
382
-                      do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff
383
-                    #else
384
-                      new_probe_offset
385
-                    #endif
386
-                  ;
355
+                  new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
356
+                    , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - diff
357
+                    , new_probe_offset
358
+                  );
387
       if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
359
       if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
388
 
360
 
389
         babystep.add_steps(Z_AXIS, babystep_increment);
361
         babystep.add_steps(Z_AXIS, babystep_increment);
397
       }
369
       }
398
     }
370
     }
399
     if (ui.should_draw()) {
371
     if (ui.should_draw()) {
400
-      #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
401
-        if (!do_probe)
402
-          MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
403
-      #endif
404
       if (do_probe) {
372
       if (do_probe) {
405
         MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
373
         MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z));
406
         TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z));
374
         TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z));
407
       }
375
       }
376
+      else {
377
+        #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
378
+          MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr54sign(hotend_offset[active_extruder].z));
379
+        #endif
380
+      }
408
     }
381
     }
409
   }
382
   }
410
 
383
 
411
 #endif // BABYSTEP_ZPROBE_OFFSET
384
 #endif // BABYSTEP_ZPROBE_OFFSET
412
 
385
 
413
 #if ENABLED(EEPROM_SETTINGS)
386
 #if ENABLED(EEPROM_SETTINGS)
414
-  void lcd_store_settings() {
415
-    const bool saved = settings.save();
416
-    ui.completion_feedback(saved);
417
-    UNUSED(saved);
418
-  }
419
-  void lcd_load_settings() {
420
-    const bool loaded = settings.load();
421
-    ui.completion_feedback(loaded);
422
-    UNUSED(loaded);
423
-  }
387
+  void lcd_store_settings() { ui.completion_feedback(settings.save()); }
388
+  void lcd_load_settings()  { ui.completion_feedback(settings.load()); }
424
 #endif
389
 #endif
425
 
390
 
426
 void _lcd_draw_homing() {
391
 void _lcd_draw_homing() {

+ 1
- 7
Marlin/src/lcd/menu/menu_advanced.cpp View File

132
     #endif
132
     #endif
133
 
133
 
134
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
134
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
135
-      constexpr float extrude_maxlength =
136
-        #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
137
-          EXTRUDE_MAXLENGTH
138
-        #else
139
-          999
140
-        #endif
141
-      ;
135
+      constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999);
142
 
136
 
143
       EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength);
137
       EDIT_ITEM_FAST(float3, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength);
144
       #if EXTRUDERS > 1
138
       #if EXTRUDERS > 1

+ 2
- 12
Marlin/src/lcd/menu/menu_configuration.cpp View File

206
   #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
206
   #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU)
207
     void bltouch_report() {
207
     void bltouch_report() {
208
       SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch.last_written_mode);
208
       SERIAL_ECHOLNPAIR("EEPROM Last BLTouch Mode - ", (int)bltouch.last_written_mode);
209
-      SERIAL_ECHOLNPGM("Configuration BLTouch Mode - "
210
-        #if ENABLED(BLTOUCH_SET_5V_MODE)
211
-          "5V"
212
-        #else
213
-          "OD"
214
-        #endif
215
-      );
209
+      SERIAL_ECHOLNPGM("Configuration BLTouch Mode - " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD"));
216
       char mess[21];
210
       char mess[21];
217
       strcpy_P(mess, PSTR("BLTouch Mode - "));
211
       strcpy_P(mess, PSTR("BLTouch Mode - "));
218
       strcpy_P(&mess[15], bltouch.last_written_mode ? PSTR("5V") : PSTR("OD"));
212
       strcpy_P(&mess[15], bltouch.last_written_mode ? PSTR("5V") : PSTR("OD"));
411
   //
405
   //
412
   #if ENABLED(CASE_LIGHT_MENU)
406
   #if ENABLED(CASE_LIGHT_MENU)
413
     #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
407
     #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
414
-      if (true
415
-        #if DISABLED(CASE_LIGHT_USE_NEOPIXEL)
416
-          && PWM_PIN(CASE_LIGHT_PIN)
417
-        #endif
418
-      )
408
+      if (TERN1(CASE_LIGHT_USE_NEOPIXEL, PWM_PIN(CASE_LIGHT_PIN)))
419
         SUBMENU(MSG_CASE_LIGHT, menu_case_light);
409
         SUBMENU(MSG_CASE_LIGHT, menu_case_light);
420
       else
410
       else
421
     #endif
411
     #endif

+ 1
- 7
Marlin/src/lcd/menu/menu_game.cpp View File

29
 
29
 
30
 void menu_game() {
30
 void menu_game() {
31
   START_MENU();
31
   START_MENU();
32
-  BACK_ITEM(
33
-    #if ENABLED(LCD_INFO_MENU)
34
-      MSG_INFO_MENU
35
-    #else
36
-      MSG_MAIN
37
-    #endif
38
-  );
32
+  BACK_ITEM(TERN(LCD_INFO_MENU, MSG_INFO_MENU, MSG_MAIN));
39
   #if ENABLED(MARLIN_BRICKOUT)
33
   #if ENABLED(MARLIN_BRICKOUT)
40
     SUBMENU(MSG_BRICKOUT, brickout.enter_game);
34
     SUBMENU(MSG_BRICKOUT, brickout.enter_game);
41
   #endif
35
   #endif

+ 17
- 44
Marlin/src/lcd/menu/menu_info.cpp View File

51
 
51
 
52
     printStatistics stats = print_job_timer.getStats();
52
     printStatistics stats = print_job_timer.getStats();
53
 
53
 
54
-    START_SCREEN();                                                                           // 12345678901234567890
55
-    VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT);              // Print Count: 999
56
-    VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT);      // Completed  : 666
54
+    char buffer[21];
55
+
56
+    START_SCREEN();                                                                         // 12345678901234567890
57
+    VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT);            // Print Count: 999
58
+    VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT);    // Completed  : 666
57
 
59
 
58
-    STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT);                                                // Total print Time:
60
+    STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT);                                              // Total print Time:
59
     STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer));         // > 99y 364d 23h 59m 59s
61
     STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer));         // > 99y 364d 23h 59m 59s
60
 
62
 
61
-    STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT);                                             // Longest job time:
63
+    STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT);                                           // Longest job time:
62
     STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer));      // > 99y 364d 23h 59m 59s
64
     STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer));      // > 99y 364d 23h 59m 59s
63
 
65
 
64
-    STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT);                                            // Extruded total:
65
-    sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10);
66
-    STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer);                                               // > 125m
66
+    STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT);                                          // Extruded total:
67
+    sprintf_P(buffer, PSTR("%ld.%im")
68
+      , long(stats.filamentUsed / 1000)
69
+      , int16_t(stats.filamentUsed / 100) % 10
70
+    );
71
+    STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer);                                             // > 125m
67
 
72
 
68
     #if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0
73
     #if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0
69
       strcpy_P(buffer, GET_TEXT(MSG_SERVICE_IN));
74
       strcpy_P(buffer, GET_TEXT(MSG_SERVICE_IN));
171
   #endif
176
   #endif
172
 
177
 
173
   #if EXTRUDERS
178
   #if EXTRUDERS
174
-  {
175
-    STATIC_ITEM(
176
-      #if WATCH_HOTENDS
177
-        MSG_INFO_RUNAWAY_ON
178
-      #else
179
-        MSG_INFO_RUNAWAY_OFF
180
-      #endif
181
-      , SS_LEFT
182
-    );
183
-  }
179
+    STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
184
   #endif
180
   #endif
185
 
181
 
186
   #if HAS_HEATED_BED
182
   #if HAS_HEATED_BED
191
     STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT);
187
     STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT);
192
     VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT);
188
     VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT);
193
     VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT);
189
     VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT);
194
-    STATIC_ITEM(
195
-      #if WATCH_BED
196
-        MSG_INFO_RUNAWAY_ON
197
-      #else
198
-        MSG_INFO_RUNAWAY_OFF
199
-      #endif
200
-      , SS_LEFT
201
-    );
202
-  }
190
+    STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
203
   #endif
191
   #endif
204
 
192
 
205
   #if HAS_HEATED_CHAMBER
193
   #if HAS_HEATED_CHAMBER
206
-  {
207
     #undef THERMISTOR_ID
194
     #undef THERMISTOR_ID
208
     #define THERMISTOR_ID TEMP_SENSOR_CHAMBER
195
     #define THERMISTOR_ID TEMP_SENSOR_CHAMBER
209
     #include "../thermistornames.h"
196
     #include "../thermistornames.h"
210
     STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT);
197
     STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT);
211
     VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT);
198
     VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT);
212
     VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT);
199
     VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT);
213
-    STATIC_ITEM(
214
-      #if WATCH_CHAMBER
215
-        MSG_INFO_RUNAWAY_ON
216
-      #else
217
-        MSG_INFO_RUNAWAY_OFF
218
-      #endif
219
-      , SS_LEFT
220
-    );
221
-  }
200
+    STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
222
   #endif
201
   #endif
223
 
202
 
224
   END_SCREEN();
203
   END_SCREEN();
295
   START_MENU();
274
   START_MENU();
296
   BACK_ITEM(MSG_MAIN);
275
   BACK_ITEM(MSG_MAIN);
297
   #if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN)
276
   #if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN)
298
-    SUBMENU(MSG_INFO_PRINTER_MENU, (
299
-      #if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
300
-        menu_show_custom_bootscreen
301
-      #else
302
-        menu_show_marlin_bootscreen
303
-      #endif
304
-    ));
277
+    SUBMENU(MSG_INFO_PRINTER_MENU, TERN(SHOW_CUSTOM_BOOTSCREEN, menu_show_custom_bootscreen, menu_show_marlin_bootscreen));
305
   #else
278
   #else
306
     SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer);           // Printer Info >
279
     SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer);           // Printer Info >
307
     SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board);               // Board Info >
280
     SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board);               // Board Info >

+ 1
- 5
Marlin/src/lcd/menu/menu_mixer.cpp View File

237
   BACK_ITEM(MSG_MAIN);
237
   BACK_ITEM(MSG_MAIN);
238
 
238
 
239
   v_index = mixer.get_current_vtool();
239
   v_index = mixer.get_current_vtool();
240
-  EDIT_ITEM(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool
241
-    #if HAS_DUAL_MIXING
242
-      , true
243
-    #endif
244
-  );
240
+  EDIT_ITEM(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool, ENABLED(HAS_DUAL_MIXING));
245
 
241
 
246
   #if HAS_DUAL_MIXING
242
   #if HAS_DUAL_MIXING
247
   {
243
   {

+ 1
- 2
Marlin/src/lcd/menu/menu_mmu2.cpp View File

54
   ui.reset_status();
54
   ui.reset_status();
55
 }
55
 }
56
 void action_mmu2_load_all() {
56
 void action_mmu2_load_all() {
57
-  LOOP_L_N(i, EXTRUDERS)
58
-    _mmu2_load_filament(i);
57
+  LOOP_L_N(i, EXTRUDERS) _mmu2_load_filament(i);
59
   ui.return_to_status();
58
   ui.return_to_status();
60
 }
59
 }
61
 
60
 

+ 11
- 33
Marlin/src/lcd/menu/menu_motion.cpp View File

59
 // Tell ui.update() to start a move to current_position" after a short delay.
59
 // Tell ui.update() to start a move to current_position" after a short delay.
60
 //
60
 //
61
 inline void manual_move_to_current(AxisEnum axis
61
 inline void manual_move_to_current(AxisEnum axis
62
-  #if E_MANUAL > 1
62
+  #if MULTI_MANUAL
63
     , const int8_t eindex=-1
63
     , const int8_t eindex=-1
64
   #endif
64
   #endif
65
 ) {
65
 ) {
66
-  #if E_MANUAL > 1
66
+  #if MULTI_MANUAL
67
     if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
67
     if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
68
   #endif
68
   #endif
69
   manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
69
   manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
144
 
144
 
145
 #if E_MANUAL
145
 #if E_MANUAL
146
 
146
 
147
-  static void lcd_move_e(
148
-    #if E_MANUAL > 1
149
-      const int8_t eindex=-1
150
-    #endif
151
-  ) {
147
+  static void lcd_move_e(TERN_(MULTI_MANUAL, const int8_t eindex=-1)) {
152
     if (ui.use_click()) return ui.goto_previous_screen_no_defer();
148
     if (ui.use_click()) return ui.goto_previous_screen_no_defer();
153
     if (ui.encoderPosition) {
149
     if (ui.encoderPosition) {
154
       if (!ui.processing_manual_move) {
150
       if (!ui.processing_manual_move) {
155
         const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
151
         const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
156
-        #if IS_KINEMATIC
157
-          manual_move_offset += diff;
158
-        #else
159
-          current_position.e += diff;
160
-        #endif
152
+        TERN(IS_KINEMATIC, manual_move_offset, current_position.e) += diff;
161
         manual_move_to_current(E_AXIS
153
         manual_move_to_current(E_AXIS
162
-          #if E_MANUAL > 1
154
+          #if MULTI_MANUAL
163
             , eindex
155
             , eindex
164
           #endif
156
           #endif
165
         );
157
         );
168
       ui.encoderPosition = 0;
160
       ui.encoderPosition = 0;
169
     }
161
     }
170
     if (ui.should_draw()) {
162
     if (ui.should_draw()) {
171
-      #if E_MANUAL > 1
163
+      #if MULTI_MANUAL
172
         MenuItemBase::init(eindex);
164
         MenuItemBase::init(eindex);
173
       #endif
165
       #endif
174
       MenuEditItemBase::draw_edit_screen(
166
       MenuEditItemBase::draw_edit_screen(
175
-        GET_TEXT(
176
-          #if E_MANUAL > 1
177
-            MSG_MOVE_EN
178
-          #else
179
-            MSG_MOVE_E
180
-          #endif
181
-        ),
167
+        GET_TEXT(TERN(MULTI_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)),
182
         ftostr41sign(current_position.e
168
         ftostr41sign(current_position.e
183
-          #if IS_KINEMATIC
184
-            + manual_move_offset
185
-          #endif
186
-          #if ENABLED(MANUAL_E_MOVES_RELATIVE)
187
-            - manual_move_e_origin
188
-          #endif
169
+          + TERN0(IS_KINEMATIC, manual_move_offset)
170
+          - TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin)
189
         )
171
         )
190
       );
172
       );
191
     } // should_draw
173
     } // should_draw
261
     EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled);
243
     EDIT_ITEM(bool, MSG_LCD_SOFT_ENDSTOPS, &soft_endstops_enabled);
262
   #endif
244
   #endif
263
 
245
 
264
-  if (true
265
-    #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
266
-      && all_axes_homed()
267
-    #endif
268
-  ) {
246
+  if (NONE(IS_KINEMATIC, NO_MOTION_BEFORE_HOMING) || all_axes_homed()) {
269
     if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) {
247
     if (TERN1(DELTA, current_position.z <= delta_clip_start_height)) {
270
       SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); });
248
       SUBMENU(MSG_MOVE_X, []{ _menu_move_distance(X_AXIS, lcd_move_x); });
271
       SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); });
249
       SUBMENU(MSG_MOVE_Y, []{ _menu_move_distance(Y_AXIS, lcd_move_y); });
332
         SUBMENU_MOVE_E(2);
310
         SUBMENU_MOVE_E(2);
333
       #endif
311
       #endif
334
 
312
 
335
-    #elif E_MANUAL > 1
313
+    #elif MULTI_MANUAL
336
 
314
 
337
       // Independent extruders with one E-stepper per hotend
315
       // Independent extruders with one E-stepper per hotend
338
       LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n);
316
       LOOP_L_N(n, E_MANUAL) SUBMENU_MOVE_E(n);

+ 1
- 1
Marlin/src/lcd/ultralcd.cpp View File

638
     float manual_move_offset = 0;
638
     float manual_move_offset = 0;
639
   #endif
639
   #endif
640
 
640
 
641
-  #if E_MANUAL > 1
641
+  #if MULTI_MANUAL
642
     int8_t MarlinUI::manual_move_e_index = 0;
642
     int8_t MarlinUI::manual_move_e_index = 0;
643
   #endif
643
   #endif
644
 
644
 

+ 9
- 19
Marlin/src/lcd/ultralcd.h View File

45
   #define HAS_SLOW_BUTTONS 1
45
   #define HAS_SLOW_BUTTONS 1
46
 #endif
46
 #endif
47
 
47
 
48
+#if E_MANUAL > 1
49
+  #define MULTI_MANUAL 1
50
+#endif
51
+
48
 #if HAS_SPI_LCD
52
 #if HAS_SPI_LCD
49
 
53
 
50
   #include "../MarlinCore.h"
54
   #include "../MarlinCore.h"
491
     static void save_previous_screen();
495
     static void save_previous_screen();
492
 
496
 
493
     // goto_previous_screen and go_back may also be used as menu item callbacks
497
     // goto_previous_screen and go_back may also be used as menu item callbacks
494
-    #if ENABLED(TURBO_BACK_MENU_ITEM)
495
-      static void _goto_previous_screen(const bool is_back);
496
-      static inline void goto_previous_screen() { _goto_previous_screen(false); }
497
-      static inline void go_back()              { _goto_previous_screen(true); }
498
-    #else
499
-      static void _goto_previous_screen();
500
-      FORCE_INLINE static void goto_previous_screen() { _goto_previous_screen(); }
501
-      FORCE_INLINE static void go_back()              { _goto_previous_screen(); }
502
-    #endif
498
+    static void _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back));
499
+    static inline void goto_previous_screen() { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, false)); }
500
+    static inline void go_back()              { _goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, true)); }
503
 
501
 
504
     static void return_to_status();
502
     static void return_to_status();
505
     static inline bool on_status_screen() { return currentScreen == status_screen; }
503
     static inline bool on_status_screen() { return currentScreen == status_screen; }
510
     #endif
508
     #endif
511
 
509
 
512
     FORCE_INLINE static void defer_status_screen(const bool defer=true) {
510
     FORCE_INLINE static void defer_status_screen(const bool defer=true) {
513
-      #if LCD_TIMEOUT_TO_STATUS
514
-        defer_return_to_status = defer;
515
-      #else
516
-        UNUSED(defer);
517
-      #endif
511
+      TERN(LCD_TIMEOUT_TO_STATUS, defer_return_to_status = defer, UNUSED(defer));
518
     }
512
     }
519
 
513
 
520
     static inline void goto_previous_screen_no_defer() {
514
     static inline void goto_previous_screen_no_defer() {
582
 
576
 
583
     static uint32_t encoderPosition;
577
     static uint32_t encoderPosition;
584
 
578
 
585
-    #if ENABLED(REVERSE_ENCODER_DIRECTION)
586
-      #define ENCODERBASE -1
587
-    #else
588
-      #define ENCODERBASE +1
589
-    #endif
579
+    #define ENCODERBASE (TERN(REVERSE_ENCODER_DIRECTION, -1, +1))
590
 
580
 
591
     #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
581
     #if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
592
       static int8_t encoderDirection;
582
       static int8_t encoderDirection;

+ 1
- 3
Marlin/src/module/planner.h View File

137
     static constexpr uint8_t extruder = 0;
137
     static constexpr uint8_t extruder = 0;
138
   #endif
138
   #endif
139
 
139
 
140
-  #if ENABLED(MIXING_EXTRUDER)
141
-    MIXER_BLOCK_FIELD;                      // Normalized color for the mixing steppers
142
-  #endif
140
+  TERN_(MIXING_EXTRUDER, MIXER_BLOCK_FIELD); // Normalized color for the mixing steppers
143
 
141
 
144
   // Settings for the trapezoid generator
142
   // Settings for the trapezoid generator
145
   uint32_t accelerate_until,                // The index of the step event on which to stop acceleration
143
   uint32_t accelerate_until,                // The index of the step event on which to stop acceleration

Loading…
Cancel
Save