|
|
@ -443,37 +443,47 @@ String rfbRetrieve(unsigned char id, bool status) { |
|
|
|
} |
|
|
|
|
|
|
|
void rfbStatus(unsigned char id, bool status) { |
|
|
|
|
|
|
|
String value = rfbRetrieve(id, status); |
|
|
|
if (value.length() > 0) { |
|
|
|
|
|
|
|
bool same = _rfbSameOnOff(id); |
|
|
|
|
|
|
|
#if RF_RAW_SUPPORT
|
|
|
|
|
|
|
|
byte message[RF_MAX_MESSAGE_SIZE]; |
|
|
|
int len = _rfbToArray(value.c_str(), message, 0); |
|
|
|
|
|
|
|
if (len == RF_MESSAGE_SIZE && // probably a standard msg
|
|
|
|
(message[0] != RF_CODE_START || // raw would start with 0xAA
|
|
|
|
message[1] != RF_CODE_RFOUT_BUCKET || // followed by 0xB0,
|
|
|
|
message[2] + 4 != len || // needs a valid length,
|
|
|
|
message[len-1] != RF_CODE_STOP)) { // and finish with 0x55
|
|
|
|
unsigned char times = RF_SEND_TIMES; |
|
|
|
if (same) times = _rfbin ? 0 : 1; |
|
|
|
_rfbSend(message, times); |
|
|
|
|
|
|
|
if (!_rfbin) { |
|
|
|
unsigned char times = same ? 1 : RF_SEND_TIMES; |
|
|
|
_rfbSend(message, times); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
_rfbSendRawOnce(message, len); // send a raw message
|
|
|
|
} |
|
|
|
|
|
|
|
#else // RF_RAW_SUPPORT
|
|
|
|
|
|
|
|
byte message[RF_MESSAGE_SIZE]; |
|
|
|
_rfbToArray(value.c_str(), message); |
|
|
|
unsigned char times = RF_SEND_TIMES; |
|
|
|
if (same) times = _rfbin ? 0 : 1; |
|
|
|
_rfbSend(message, times); |
|
|
|
if (!_rfbin) { |
|
|
|
byte message[RF_MESSAGE_SIZE]; |
|
|
|
_rfbToArray(value.c_str(), message); |
|
|
|
unsigned char times = same ? 1 : RF_SEND_TIMES; |
|
|
|
_rfbSend(message, times); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // RF_RAW_SUPPORT
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_rfbin = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void rfbLearn(unsigned char id, bool status) { |
|
|
|