Browse Source

Toggle with XOR

Scott Lahteine 7 years ago
parent
commit
314a02e2d5
3 changed files with 5 additions and 5 deletions
  1. 2
    2
      Marlin/Marlin_main.cpp
  2. 1
    1
      Marlin/ubl_G29.cpp
  3. 2
    2
      Marlin/ultralcd.cpp

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -4475,7 +4475,7 @@ inline void gcode_G28() {
4475 4475
             inInc = -1;
4476 4476
           }
4477 4477
 
4478
-          zig = !zig; // zag
4478
+          zig ^= true; // zag
4479 4479
 
4480 4480
           // Inner loop is Y with PROBE_Y_FIRST enabled
4481 4481
           for (int8_t PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; PR_INNER_VAR += inInc) {
@@ -5799,7 +5799,7 @@ inline void gcode_M42() {
5799 5799
 #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_EDITING)
5800 5800
 
5801 5801
   inline void gcode_M49() {
5802
-    ubl.g26_debug_flag = !ubl.g26_debug_flag;
5802
+    ubl.g26_debug_flag ^= true;
5803 5803
     SERIAL_PROTOCOLPGM("UBL Debug Flag turned ");
5804 5804
     serialprintPGM(ubl.g26_debug_flag ? PSTR("on.") : PSTR("off."));
5805 5805
   }

+ 1
- 1
Marlin/ubl_G29.cpp View File

@@ -1551,7 +1551,7 @@
1551 1551
           inInc = -1;
1552 1552
         }
1553 1553
 
1554
-        zig = !zig; // zag
1554
+        zig ^= true; // zag
1555 1555
 
1556 1556
         // Inner loop is Y with PROBE_Y_FIRST enabled
1557 1557
         for (PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; PR_INNER_VAR += inInc) {

+ 2
- 2
Marlin/ultralcd.cpp View File

@@ -688,7 +688,7 @@ void kill_screen(const char* lcd_msg) {
688 688
     extern void update_case_light();
689 689
 
690 690
     void toggle_case_light() {
691
-      case_light_on = !case_light_on;
691
+      case_light_on ^= true;
692 692
       lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
693 693
       update_case_light();
694 694
     }
@@ -3196,7 +3196,7 @@ void kill_screen(const char* lcd_msg) {
3196 3196
 
3197 3197
   #endif //SDSUPPORT
3198 3198
 
3199
-  void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
3199
+  void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr ^= true; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
3200 3200
   void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
3201 3201
     menu_action_setting_edit_bool(pstr, ptr);
3202 3202
     (*callback)();

Loading…
Cancel
Save