1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 10:53:01 +02:00

Removed obsolete fields from ControlPin class

This commit is contained in:
Mitch Bradley
2021-05-25 08:12:30 -10:00
parent 44c02e7e5b
commit 0f9fbf0b21
3 changed files with 17 additions and 30 deletions

View File

@@ -49,13 +49,6 @@ Some features should not be changed. See notes below.
// Note: HOMING_CYCLES are now settings // Note: HOMING_CYCLES are now settings
#define SUPPORT_TASK_CORE 1 // Reference: CONFIG_ARDUINO_RUNNING_CORE = 1 #define SUPPORT_TASK_CORE 1 // Reference: CONFIG_ARDUINO_RUNNING_CORE = 1
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
// normally-closed switches on the specified pins, rather than the default normally-open switches.
// The mask order is ...
// Macro3 | Macro2 | Macro 1| Macr0 |Cycle Start | Feed Hold | Reset | Safety Door
// For example B1101 will invert the function of the Reset pin.
#define INVERT_CONTROL_PIN_MASK B00001111
// #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable. // #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds #define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds

View File

@@ -26,9 +26,9 @@
#include "System.h" #include "System.h"
Control::Control() : Control::Control() :
_safetyDoor(0, rtSafetyDoor, "Door", 'D'), _reset(1, rtReset, "Reset", 'R'), _feedHold(2, rtFeedHold, "FeedHold", 'H'), _safetyDoor(rtSafetyDoor, "Door", 'D'), _reset(rtReset, "Reset", 'R'), _feedHold(rtFeedHold, "FeedHold", 'H'),
_cycleStart(3, rtCycleStart, "CycleStart", 'S'), _macro0(4, rtButtonMacro0, "Macro 0", '0'), _macro1(5, rtButtonMacro1, "Macro 1", '1'), _cycleStart(rtCycleStart, "CycleStart", 'S'), _macro0(rtButtonMacro0, "Macro 0", '0'), _macro1(rtButtonMacro1, "Macro 1", '1'),
_macro2(6, rtButtonMacro2, "Macro 2", '2'), _macro3(7, rtButtonMacro3, "Macro 3", '3') {} _macro2(rtButtonMacro2, "Macro 2", '2'), _macro3(rtButtonMacro3, "Macro 3", '3') {}
void Control::init() { void Control::init() {
_safetyDoor.init(); _safetyDoor.init();
@@ -44,7 +44,7 @@ void Control::init() {
void Control::validate() const {} void Control::validate() const {}
void Control::handle(Configuration::HandlerBase& handler) { void Control::handle(Configuration::HandlerBase& handler) {
handler.handle("safetyDoor", _safetyDoor._pin); handler.handle("safety_door", _safetyDoor._pin);
handler.handle("reset", _reset._pin); handler.handle("reset", _reset._pin);
handler.handle("feed_hold", _feedHold._pin); handler.handle("feed_hold", _feedHold._pin);
handler.handle("cycle_start", _cycleStart._pin); handler.handle("cycle_start", _cycleStart._pin);
@@ -54,15 +54,15 @@ void Control::handle(Configuration::HandlerBase& handler) {
handler.handle("macro3", _macro3._pin); handler.handle("macro3", _macro3._pin);
} }
void Control::report(char* status, bool& pinReportStarted) { void Control::report(char* status) {
_safetyDoor.report(status, pinReportStarted); _safetyDoor.report(status);
_reset.report(status, pinReportStarted); _reset.report(status);
_feedHold.report(status, pinReportStarted); _feedHold.report(status);
_cycleStart.report(status, pinReportStarted); _cycleStart.report(status);
_macro0.report(status, pinReportStarted); _macro0.report(status);
_macro1.report(status, pinReportStarted); _macro1.report(status);
_macro2.report(status, pinReportStarted); _macro2.report(status);
_macro3.report(status, pinReportStarted); _macro3.report(status);
} }
// Returns if safety door is ajar(T) or closed(F), based on pin state. // Returns if safety door is ajar(T) or closed(F), based on pin state.

View File

@@ -4,9 +4,6 @@
class ControlPin { class ControlPin {
private: private:
// invertBitNum refers to a bit in INVERT_CONTROL_PIN_MASK. It is a
// short-term hack to reduce the extent of the patch.
bool _invertBitNum;
bool _value; bool _value;
const char _letter; const char _letter;
volatile bool& _rtVariable; volatile bool& _rtVariable;
@@ -15,18 +12,15 @@ private:
void IRAM_ATTR handleISR(); void IRAM_ATTR handleISR();
public: public:
ControlPin(uint8_t bitNum, volatile bool& rtVariable, const char* legend, char letter) : ControlPin(volatile bool& rtVariable, const char* legend, char letter) :
_invertBitNum(bitNum), _value(false), _letter(letter), _rtVariable(rtVariable), _legend(legend) { _value(false), _letter(letter), _rtVariable(rtVariable), _legend(legend) {
_rtVariable = _value; _rtVariable = _value;
} }
Pin _pin; Pin _pin;
void init(); void init();
bool get() { return _value; } bool get() { return _value; }
const char* legend() { return _legend; }
// char invertBitNum() { return _invertBitNum; }
char letter() { return _letter; }
void report(char* status); void report(char* status);