diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 66ee334..a7ab774 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -25,7 +25,7 @@ void RATGDOComponent::setup() { this->rollingCodeCounter = 0; } - swSerial.begin(9600, SWSERIAL_8N2, -1, OUTPUT_GDO, true); + this->swSerial.begin(9600, SWSERIAL_8N2, -1, OUTPUT_GDO, true); pinMode(TRIGGER_OPEN, INPUT_PULLUP); pinMode(TRIGGER_CLOSE, INPUT_PULLUP); pinMode(TRIGGER_LIGHT, INPUT_PULLUP); @@ -348,7 +348,7 @@ void RATGDOComponent::transmit(byte *payload, unsigned int length) { digitalWrite(OUTPUT_GDO, LOW); // bring the line low delayMicroseconds(1260); // "LOW" pulse duration before the message start - swSerial.write(payload, length); + this->swSerial.write(payload, length); } void RATGDOComponent::sync() { diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index b0004f3..0c6abf0 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -44,7 +44,6 @@ extern unsigned int rollingCodeCounter; namespace esphome { namespace ratgdo { -SoftwareSerial swSerial; class RATGDOComponent; // this component @@ -56,6 +55,7 @@ class RATGDOComponent : public Component { /********************************** GLOBAL VARS * *****************************************/ unsigned int rollingCodeCounter; + SoftwareSerial swSerial; byte rollingCode[CODE_LENGTH]; String doorState = "unknown"; // will be