mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-30 09:39:49 +02:00
Merge pull request #53 from gflaser-au/ctrl_inputs
Allow Ctrl inputs to be disabled
This commit is contained in:
@@ -24,16 +24,23 @@
|
|||||||
void system_ini() // Renamed from system_init() due to conflict with esp32 files
|
void system_ini() // Renamed from system_init() due to conflict with esp32 files
|
||||||
{
|
{
|
||||||
// setup control inputs
|
// setup control inputs
|
||||||
|
#ifdef CONTROL_SAFETY_DOOR_PIN
|
||||||
pinMode(CONTROL_SAFETY_DOOR_PIN, INPUT);
|
pinMode(CONTROL_SAFETY_DOOR_PIN, INPUT);
|
||||||
pinMode(CONTROL_RESET_PIN, INPUT);
|
|
||||||
pinMode(CONTROL_FEED_HOLD_PIN, INPUT);
|
|
||||||
pinMode(CONTROL_CYCLE_START_PIN, INPUT);
|
|
||||||
|
|
||||||
// attach interrupt to them
|
|
||||||
attachInterrupt(digitalPinToInterrupt(CONTROL_SAFETY_DOOR_PIN), isr_control_inputs, CHANGE);
|
attachInterrupt(digitalPinToInterrupt(CONTROL_SAFETY_DOOR_PIN), isr_control_inputs, CHANGE);
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_RESET_PIN
|
||||||
|
pinMode(CONTROL_RESET_PIN, INPUT);
|
||||||
attachInterrupt(digitalPinToInterrupt(CONTROL_RESET_PIN), isr_control_inputs, CHANGE);
|
attachInterrupt(digitalPinToInterrupt(CONTROL_RESET_PIN), isr_control_inputs, CHANGE);
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_FEED_HOLD_PIN
|
||||||
|
pinMode(CONTROL_FEED_HOLD_PIN, INPUT);
|
||||||
attachInterrupt(digitalPinToInterrupt(CONTROL_FEED_HOLD_PIN), isr_control_inputs, CHANGE);
|
attachInterrupt(digitalPinToInterrupt(CONTROL_FEED_HOLD_PIN), isr_control_inputs, CHANGE);
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_CYCLE_START_PIN
|
||||||
|
pinMode(CONTROL_CYCLE_START_PIN, INPUT);
|
||||||
attachInterrupt(digitalPinToInterrupt(CONTROL_CYCLE_START_PIN), isr_control_inputs, CHANGE);
|
attachInterrupt(digitalPinToInterrupt(CONTROL_CYCLE_START_PIN), isr_control_inputs, CHANGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRAM_ATTR isr_control_inputs()
|
void IRAM_ATTR isr_control_inputs()
|
||||||
@@ -422,11 +429,18 @@ uint8_t system_control_get_state()
|
|||||||
|
|
||||||
|
|
||||||
uint8_t control_state = 0;
|
uint8_t control_state = 0;
|
||||||
|
#ifdef CONTROL_SAFETY_DOOR_PIN
|
||||||
if (digitalRead(CONTROL_SAFETY_DOOR_PIN)) { control_state |= CONTROL_PIN_INDEX_SAFETY_DOOR; }
|
if (digitalRead(CONTROL_SAFETY_DOOR_PIN)) { control_state |= CONTROL_PIN_INDEX_SAFETY_DOOR; }
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_RESET_PIN
|
||||||
if (digitalRead(CONTROL_RESET_PIN)) { control_state |= CONTROL_PIN_INDEX_RESET; }
|
if (digitalRead(CONTROL_RESET_PIN)) { control_state |= CONTROL_PIN_INDEX_RESET; }
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_FEED_HOLD_PIN
|
||||||
if (digitalRead(CONTROL_FEED_HOLD_PIN)) { control_state |= CONTROL_PIN_INDEX_FEED_HOLD; }
|
if (digitalRead(CONTROL_FEED_HOLD_PIN)) { control_state |= CONTROL_PIN_INDEX_FEED_HOLD; }
|
||||||
|
#endif
|
||||||
|
#ifdef CONTROL_CYCLE_START_PIN
|
||||||
if (digitalRead(CONTROL_CYCLE_START_PIN)) { control_state |= CONTROL_PIN_INDEX_CYCLE_START; }
|
if (digitalRead(CONTROL_CYCLE_START_PIN)) { control_state |= CONTROL_PIN_INDEX_CYCLE_START; }
|
||||||
|
#endif
|
||||||
#ifdef INVERT_CONTROL_PIN_MASK
|
#ifdef INVERT_CONTROL_PIN_MASK
|
||||||
control_state ^= INVERT_CONTROL_PIN_MASK;
|
control_state ^= INVERT_CONTROL_PIN_MASK;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user