Skip to content
Snippets Groups Projects
Commit c9e4ab5c authored by Max Horn's avatar Max Horn
Browse files

Simplify RCSwitch::transmit() code

parent 6d19fe13
No related branches found
No related tags found
No related merge requests found
......@@ -481,15 +481,11 @@ void RCSwitch::send(const char* sCodeWord) {
}
void RCSwitch::transmit(int nHighPulses, int nLowPulses) {
#if not defined ( RCSwitchDisableReceiving )
boolean disabled_Receive = false;
int nReceiverInterrupt_backup = nReceiverInterrupt;
#endif
if (this->nTransmitterPin != -1) {
#if not defined( RCSwitchDisableReceiving )
if (this->nReceiverInterrupt != -1) {
int nReceiverInterrupt_backup = nReceiverInterrupt;
if (nReceiverInterrupt_backup != -1) {
this->disableReceive();
disabled_Receive = true;
}
#endif
digitalWrite(this->nTransmitterPin, HIGH);
......@@ -498,7 +494,7 @@ void RCSwitch::transmit(int nHighPulses, int nLowPulses) {
delayMicroseconds( this->protocol.pulseLength * nLowPulses);
#if not defined( RCSwitchDisableReceiving )
if(disabled_Receive) {
if (nReceiverInterrupt_backup != -1) {
this->enableReceive(nReceiverInterrupt_backup);
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment