1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 10:53:01 +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 (value.has(PinAttributes::InitialOn)) {
__digitalWrite(_index, HIGH ^ _readWriteMask);
} else {
__digitalWrite(_index, LOW ^ _readWriteMask);
if (value.has(PinAttributes::Output)) {
if (value.has(PinAttributes::InitialOn)) {
__digitalWrite(_index, HIGH ^ _readWriteMask);
}
else {
__digitalWrite(_index, LOW ^ _readWriteMask);
}
}
__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) {
Pins::PinAttributes attr = Pins::PinAttributes::None;
if (mode & OUTPUT) {
attr = attr | Pins::PinAttributes::Output;
}
if (mode & INPUT) {
if ((mode & INPUT) == 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;
}
if (mode & INPUT_PULLDOWN) {
if ((mode & PULLDOWN) == PULLDOWN) {
attr = attr | Pins::PinAttributes::PullDown;
}

View File

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