Skip to content

Commit cc4c0ff

Browse files
Sonny JeonSonny Jeon
Sonny Jeon
authored and
Sonny Jeon
committed
Update system.c
1 parent b75e557 commit cc4c0ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

grbl/system.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ void system_init()
4040
uint8_t system_control_get_state()
4141
{
4242
uint8_t control_state = 0;
43-
uint8_t pin = (CONTROL_PIN & CONTROL_MASK);
43+
uint8_t pin = (CONTROL_PIN & CONTROL_MASK) ^ CONTROL_MASK;
4444
#ifdef INVERT_CONTROL_PIN_MASK
4545
pin ^= INVERT_CONTROL_PIN_MASK;
4646
#endif
4747
if (pin) {
4848
#ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
49-
if (bit_isfalse(pin,(1<<CONTROL_SAFETY_DOOR_BIT))) { control_state |= CONTROL_PIN_INDEX_SAFETY_DOOR; }
49+
if (bit_istrue(pin,(1<<CONTROL_SAFETY_DOOR_BIT))) { control_state |= CONTROL_PIN_INDEX_SAFETY_DOOR; }
50+
#else
51+
if (bit_istrue(pin,(1<<CONTROL_FEED_HOLD_BIT))) { control_state |= CONTROL_PIN_INDEX_FEED_HOLD; }
5052
#endif
51-
if (bit_isfalse(pin,(1<<CONTROL_RESET_BIT))) { control_state |= CONTROL_PIN_INDEX_RESET; }
52-
if (bit_isfalse(pin,(1<<CONTROL_FEED_HOLD_BIT))) { control_state |= CONTROL_PIN_INDEX_FEED_HOLD; }
53-
if (bit_isfalse(pin,(1<<CONTROL_CYCLE_START_BIT))) { control_state |= CONTROL_PIN_INDEX_CYCLE_START; }
53+
if (bit_istrue(pin,(1<<CONTROL_RESET_BIT))) { control_state |= CONTROL_PIN_INDEX_RESET; }
54+
if (bit_istrue(pin,(1<<CONTROL_CYCLE_START_BIT))) { control_state |= CONTROL_PIN_INDEX_CYCLE_START; }
5455
}
5556
return(control_state);
5657
}

0 commit comments

Comments
 (0)