From 314a02e2d52aa20bf5ec843b47a27f294c1360f8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 9 Apr 2017 07:58:47 -0500 Subject: [PATCH] Toggle with XOR --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/ubl_G29.cpp | 2 +- Marlin/ultralcd.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index da85f9337..73e8686dc 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4475,7 +4475,7 @@ inline void gcode_G28() { inInc = -1; } - zig = !zig; // zag + zig ^= true; // zag // Inner loop is Y with PROBE_Y_FIRST enabled for (int8_t PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; PR_INNER_VAR += inInc) { @@ -5799,7 +5799,7 @@ inline void gcode_M42() { #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_EDITING) inline void gcode_M49() { - ubl.g26_debug_flag = !ubl.g26_debug_flag; + ubl.g26_debug_flag ^= true; SERIAL_PROTOCOLPGM("UBL Debug Flag turned "); serialprintPGM(ubl.g26_debug_flag ? PSTR("on.") : PSTR("off.")); } diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 5e999a58d..c0b54fc1b 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1551,7 +1551,7 @@ inInc = -1; } - zig = !zig; // zag + zig ^= true; // zag // Inner loop is Y with PROBE_Y_FIRST enabled for (PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; PR_INNER_VAR += inInc) { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index e9c8700b9..0446999b6 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -688,7 +688,7 @@ void kill_screen(const char* lcd_msg) { extern void update_case_light(); void toggle_case_light() { - case_light_on = !case_light_on; + case_light_on ^= true; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; update_case_light(); } @@ -3196,7 +3196,7 @@ void kill_screen(const char* lcd_msg) { #endif //SDSUPPORT - void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; } + void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr ^= true; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; } void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) { menu_action_setting_edit_bool(pstr, ptr); (*callback)();