Browse Source

rfb: #2335 follow-up (#2337)

* rfb: fix unused repeats setting
* rfb: rename TIMES -> REPEATS
* rfb: use out as first arg
mcspr-patch-1
Max Prokhorov 3 years ago
committed by GitHub
parent
commit
6a2d57e547
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 18 deletions
  1. +5
    -3
      code/espurna/config/deprecated.h
  2. +7
    -7
      code/espurna/config/general.h
  3. +8
    -8
      code/espurna/rfbridge.cpp

+ 5
- 3
code/espurna/config/deprecated.h View File

@ -109,6 +109,8 @@
#define WIFI_AP_MODE ((1 == WIFI_FALLBACK_APMODE) ? WiFiApMode::Fallback : WiFiApMode::Disabled)
#endif
// 1.15.0 uses RFB_... instead of RF_...
#ifdef RFB_DIRECT
#warning "RFB_DIRECT is deprecated! Please use RFB_PROVIDER=RFB_PROVIDER_..."
#undef RFB_PROVIDER
@ -126,9 +128,9 @@
#endif
#ifdef RF_SEND_TIMES
#warning "RF_SEND_TIMES is deprecated! Please use RFB_SEND_TIMES"
#undef RFB_SEND_TIMES
#define RFB_SEND_TIMES RF_SEND_TIMES
#warning "RF_SEND_TIMES is deprecated! Please use RFB_SEND_REPEATS"
#undef RFB_SEND_REPEATS
#define RFB_SEND_REPEATS RF_SEND_TIMES
#endif
#ifdef RF_SEND_DELAY


+ 7
- 7
code/espurna/config/general.h View File

@ -1624,8 +1624,8 @@
#define RFB_SUPPORT 0
#endif
#ifndef RFB_SEND_TIMES
#define RFB_SEND_TIMES 1 // How many times to send the message
#ifndef RFB_SEND_REPEATS
#define RFB_SEND_REPEATS 1 // How many times to send the message
#endif
// - RFB_PROVIDER_EFM8BB1
@ -1648,19 +1648,19 @@
#endif
#ifndef RFB_LEARN_TIMEOUT
#define RFB_LEARN_TIMEOUT 15000
#define RFB_LEARN_TIMEOUT 15000
#endif
#ifndef RFB_SEND_DELAY
#define RFB_SEND_DELAY 500 // Interval between sendings in ms
#define RFB_SEND_DELAY 500 // Interval between sendings in ms
#endif
#ifndef RFB_RECEIVE_DELAY
#define RFB_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid bouncing)
#define RFB_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid bouncing)
#endif
#ifndef RFB_TRANSMIT_TIMES
#define RFB_TRANSMIT_TIMES 5 // How many times RCSwitch will repeat the message
#ifndef RFB_TRANSMIT_REPEATS
#define RFB_TRANSMIT_REPEATS 5 // How many times RCSwitch will repeat the message
#endif
// -----------------------------------------------------------------------------


+ 8
- 8
code/espurna/rfbridge.cpp View File

@ -29,7 +29,7 @@ BrokerBind(RfbridgeBroker);
// GLOBALS TO THE MODULE
// -----------------------------------------------------------------------------
unsigned char _rfb_repeat = RFB_SEND_TIMES;
unsigned char _rfb_repeats = RFB_SEND_REPEATS;
#if RFB_PROVIDER == RFB_PROVIDER_RCSWITCH
@ -345,7 +345,7 @@ void _rfbWebSocketOnVisible(JsonObject& root) {
}
void _rfbWebSocketOnConnected(JsonObject& root) {
root["rfbRepeat"] = getSetting("rfbRepeat", RFB_SEND_TIMES);
root["rfbRepeat"] = getSetting("rfbRepeat", RFB_SEND_REPEATS);
root["rfbCount"] = relayCount();
#if RFB_PROVIDER == RFB_PROVIDER_RCSWITCH
root["rfbdirectVisible"] = 1;
@ -884,7 +884,7 @@ void _rfbSendQueued() {
// Check if the payload looks like a HEX code (plus comma, specifying the 'repeats' arg for the queue)
void _rfbSendFromPayload(const char * payload) {
size_t repeats { 1ul };
decltype(_rfb_repeats) repeats { _rfb_repeats };
size_t len { strlen(payload) };
const char* sep { strchr(payload, ',') };
@ -1168,7 +1168,7 @@ void _rfbSettingsMigrate(int version) {
return;
}
auto migrate_code = [](const String& in, String& out) -> bool {
auto migrate_code = [](String& out, const String& in) -> bool {
out = "";
if (18 == in.length()) {
@ -1191,12 +1191,12 @@ void _rfbSettingsMigrate(int version) {
for (unsigned char index = 0; index < relayCount(); ++index) {
const settings_key_t on_key {F("rfbON"), index};
if (migrate_code(getSetting(on_key), buffer)) {
if (migrate_code(buffer, getSetting(on_key))) {
setSetting(on_key, buffer);
}
const settings_key_t off_key {F("rfbOFF"), index};
if (migrate_code(getSetting(off_key), buffer)) {
if (migrate_code(buffer, getSetting(off_key))) {
setSetting(off_key, buffer);
}
}
@ -1232,7 +1232,7 @@ void rfbSetup() {
DEBUG_MSG_P(PSTR("[RF] RF receiver on GPIO %u\n"), rx);
}
if (_rfb_transmit) {
auto transmit = getSetting("rfbTransmit", RFB_TRANSMIT_TIMES);
auto transmit = getSetting("rfbTransmit", RFB_TRANSMIT_REPEATS);
_rfb_modem->enableTransmit(tx);
_rfb_modem->setRepeatTransmit(transmit);
DEBUG_MSG_P(PSTR("[RF] RF transmitter on GPIO %u\n"), tx);
@ -1262,7 +1262,7 @@ void rfbSetup() {
_rfbInitCommands();
#endif
_rfb_repeat = getSetting("rfbRepeat", RFB_SEND_TIMES);
_rfb_repeats = getSetting("rfbRepeat", RFB_SEND_REPEATS);
// Note: as rfbridge protocol is simplistic enough, we rely on Serial queue to deliver timely updates
// learn / command acks / etc. are not queued, only RF messages are


Loading…
Cancel
Save