1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 03:13:25 +02:00

Fixed a few bugs (backport)

This commit is contained in:
Stefan de Bruijn
2020-11-07 10:00:36 +01:00
parent 29b4642dd7
commit 87b076bfc1
3 changed files with 15 additions and 12 deletions

View File

@@ -151,10 +151,13 @@ namespace Pins {
} }
// If the pin is ActiveLow, we should take that into account here: // If the pin is ActiveLow, we should take that into account here:
if (value.has(PinAttributes::InitialOn)) { if (value.has(PinAttributes::Output)) {
__digitalWrite(_index, HIGH ^ _readWriteMask); if (value.has(PinAttributes::InitialOn)) {
} else { __digitalWrite(_index, HIGH ^ _readWriteMask);
__digitalWrite(_index, LOW ^ _readWriteMask); }
else {
__digitalWrite(_index, LOW ^ _readWriteMask);
}
} }
__pinMode(_index, pinModeValue); __pinMode(_index, pinModeValue);

View File

@@ -55,16 +55,16 @@ void IRAM_ATTR digitalWrite(uint8_t pin, uint8_t val) {
void IRAM_ATTR pinMode(uint8_t pin, uint8_t mode) { void IRAM_ATTR pinMode(uint8_t pin, uint8_t mode) {
Pins::PinAttributes attr = Pins::PinAttributes::None; Pins::PinAttributes attr = Pins::PinAttributes::None;
if (mode & OUTPUT) { if ((mode & INPUT) == INPUT) {
attr = attr | Pins::PinAttributes::Output;
}
if (mode & INPUT) {
attr = attr | Pins::PinAttributes::Input; attr = attr | Pins::PinAttributes::Input;
} }
if (mode & INPUT_PULLUP) { if ((mode & OUTPUT) == OUTPUT) {
attr = attr | Pins::PinAttributes::Output;
}
if ((mode & PULLUP) == PULLUP) {
attr = attr | Pins::PinAttributes::PullUp; attr = attr | Pins::PinAttributes::PullUp;
} }
if (mode & INPUT_PULLDOWN) { if ((mode & PULLDOWN) == PULLDOWN) {
attr = attr | Pins::PinAttributes::PullDown; attr = attr | Pins::PinAttributes::PullDown;
} }

View File

@@ -24,8 +24,8 @@
// Define status reporting boolean enable bit flags in status_report_mask // Define status reporting boolean enable bit flags in status_report_mask
enum RtStatus { enum RtStatus {
Position = 0, Position = bit(0),
Buffer = 1, Buffer = bit(1),
}; };
const char* errorString(Error errorNumber); const char* errorString(Error errorNumber);