Browse Source

rfm69: fix types of settings (#2141)

* rfm69: fix types of settings

* down
mcspr-patch-1
Max Prokhorov 4 years ago
committed by GitHub
parent
commit
d9482b917b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions
  1. +12
    -12
      code/espurna/rfm69.ino
  2. +1
    -0
      code/test/build/nondefault.h

+ 12
- 12
code/espurna/rfm69.ino View File

@ -73,20 +73,20 @@ void _rfm69WebSocketOnAction(uint32_t client_id, const char * action, JsonObject
void _rfm69CleanNodes(unsigned char num) {
// Look for the last defined node
int i = 0;
while (i < num) {
if (0 == getSetting({"node", i}, 0)) break;
if (!getSetting({"key", i}).length()) break;
if (!getSetting({"topic", i}).length()) break;
++i;
unsigned char id = 0;
while (id < num) {
if (0 == getSetting({"node", id}, 0)) break;
if (!getSetting({"key", id}).length()) break;
if (!getSetting({"topic", id}).length()) break;
++id;
}
// Delete all other settings
while (i < WIFI_MAX_NETWORKS) {
delSetting("node", i);
delSetting("key", i);
delSetting("topic", i);
++i;
while (id < SETTINGS_MAX_LIST_COUNT) {
delSetting({"node", id});
delSetting({"key", id});
delSetting({"topic", id});
++id;
}
}
@ -166,7 +166,7 @@ void _rfm69Process(packet_t * data) {
if (!RFM69_PROMISCUOUS_SENDS && (RFM69_GATEWAY_ID != data->targetID)) return;
// Try to find a matching mapping
for (unsigned int i=0; i<RFM69_MAX_TOPICS; i++) {
for (unsigned char i=0; i<RFM69_MAX_TOPICS; i++) {
auto node = getSetting({"node", i}, 0);
if (0 == node) break;
if ((node == data->senderID) && (getSetting({"key", i}).equals(data->key))) {


+ 1
- 0
code/test/build/nondefault.h View File

@ -9,3 +9,4 @@
#define INFLUXDB_SUPPORT 1
#define OTA_MQTT_SUPPORT 1
#define RPN_RULES_SUPPORT 1
#define RFM69_SUPPORT 1

Loading…
Cancel
Save