Browse Source

tweak logging

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
2fc0ab0a17
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      code/espurna/rfbridge.cpp

+ 7
- 6
code/espurna/rfbridge.cpp View File

@ -458,7 +458,7 @@ RfbRelayMatch _rfbMatch(const char* code) {
void _rfbLearnFromString(std::unique_ptr<RfbLearn>& learn, const char* buffer) { void _rfbLearnFromString(std::unique_ptr<RfbLearn>& learn, const char* buffer) {
if (!learn) return; if (!learn) return;
DEBUG_MSG_P(PSTR("[RF] Learned %s for relay ID %u after %u ms\n"), buffer, learn->id, millis() - learn->ts);
DEBUG_MSG_P(PSTR("[RF] Learned relay ID %u after %u ms\n"), learn->id, millis() - learn->ts);
rfbStore(learn->id, learn->status, buffer); rfbStore(learn->id, learn->status, buffer);
// Websocket update needs to happen right here, since the only time // Websocket update needs to happen right here, since the only time
@ -567,17 +567,16 @@ void _rfbParse(uint8_t code, const std::vector<uint8_t>& payload) {
case CodeLearnTimeout: case CodeLearnTimeout:
_rfbAckImpl(); _rfbAckImpl();
#if RELAY_SUPPORT #if RELAY_SUPPORT
DEBUG_MSG_P(PSTR("[RF] Learn timeout after %u ms\n"), millis() - _rfb_learn->ts);
_rfb_learn.reset(nullptr);
if (_rfb_learn) {
DEBUG_MSG_P(PSTR("[RF] Learn timeout after %u ms\n"), millis() - _rfb_learn->ts);
_rfb_learn.reset(nullptr);
}
#endif #endif
break; break;
case CodeLearnOk: case CodeLearnOk:
case CodeRecvBasic: { case CodeRecvBasic: {
_rfbAckImpl(); _rfbAckImpl();
if (payload.size() != RfbParser::PayloadSizeBasic) {
break;
}
char buffer[(RfbParser::PayloadSizeBasic * 2) + 1] = {0}; char buffer[(RfbParser::PayloadSizeBasic * 2) + 1] = {0};
if (hexEncode(payload.data(), payload.size(), buffer, sizeof(buffer))) { if (hexEncode(payload.data(), payload.size(), buffer, sizeof(buffer))) {
@ -879,6 +878,8 @@ void _rfbSendFromPayload(const char * payload) {
return; return;
} }
DEBUG_MSG_P(PSTR("[RF] Enqueuing MESSAGE '%s' %u time(s)\n"), payload, repeats);
// We postpone the actual sending until the loop, as we may've been called from MQTT or HTTP API // We postpone the actual sending until the loop, as we may've been called from MQTT or HTTP API
// RFB_PROVIDER implementation should select the appropriate de-serialization function // RFB_PROVIDER implementation should select the appropriate de-serialization function
_rfbEnqueue(payload, repeats); _rfbEnqueue(payload, repeats);


Loading…
Cancel
Save