From c251601916c69bf3a67bc62048c5694f03b410e5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 1 Feb 2018 23:58:35 -0600 Subject: [PATCH] Simplified SET_BIT, moved to endstops.cpp --- Marlin/src/core/macros.h | 1 - Marlin/src/module/endstops.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 342b702d76..8f20ced284 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -100,7 +100,6 @@ #define TEST(n,b) !!((n)&_BV(b)) #define SBI(n,b) (n |= _BV(b)) #define CBI(n,b) (n &= ~_BV(b)) -#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b)) #define _BV32(b) (1UL << (b)) #define TEST32(n,b) !!((n)&_BV32(b)) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 3bc9a625dc..c57c71ff8f 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -317,6 +317,7 @@ void Endstops::update() { #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX)) + #define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0) // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST