Skip to content

Commit

Permalink
Allow for both BT and RTL_433 Gateways at the same time. (#1491)
Browse files Browse the repository at this point in the history
* Allow for both BT and RTL_433 Gateways at the same time.

* Fix linting error.
  • Loading branch information
SmittyHalibut authored Mar 1, 2023
1 parent 454a062 commit ecd23b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions main/ZgatewayBT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ vector<BLEAction> BLEactions;
vector<BLEdevice*> devices;
int newDevices = 0;

static BLEdevice NO_DEVICE_FOUND = {{0},
0,
false,
false,
false,
false,
TheengsDecoder::BLE_ID_NUM::UNKNOWN_MODEL};
static BLEdevice NO_BT_DEVICE_FOUND = {{0},
0,
false,
false,
false,
false,
TheengsDecoder::BLE_ID_NUM::UNKNOWN_MODEL};
static bool oneWhite = false;

void BTConfig_init() {
Expand Down Expand Up @@ -361,7 +361,7 @@ BLEdevice* getDeviceByMac(const char* mac) {
return *it;
}
}
return &NO_DEVICE_FOUND;
return &NO_BT_DEVICE_FOUND;
}

bool updateWorB(JsonObject& BTdata, bool isWhite) {
Expand All @@ -388,7 +388,7 @@ void createOrUpdateDevice(const char* mac, uint8_t flags, int model, int mac_typ
}

BLEdevice* device = getDeviceByMac(mac);
if (device == &NO_DEVICE_FOUND) {
if (device == &NO_BT_DEVICE_FOUND) {
Log.trace(F("add %s" CR), mac);
//new device
device = new BLEdevice();
Expand Down
12 changes: 6 additions & 6 deletions main/ZgatewayRTL_433.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ SemaphoreHandle_t semaphorecreateOrUpdateDeviceRTL_433;
std::vector<RTL_433device*> RTL_433devices;
int newRTL_433Devices = 0;

static RTL_433device NO_DEVICE_FOUND = {{0},
0,
false};
static RTL_433device NO_RTL_433_DEVICE_FOUND = {{0},
0,
false};

RTL_433device* getDeviceById(const char* id); // Declared here to avoid pre-compilation issue (misplaced auto declaration by pio)
RTL_433device* getDeviceById(const char* id) {
Expand All @@ -60,7 +60,7 @@ RTL_433device* getDeviceById(const char* id) {
return *it;
}
}
return &NO_DEVICE_FOUND;
return &NO_RTL_433_DEVICE_FOUND;
}

void dumpRTL_433Devices() {
Expand All @@ -79,7 +79,7 @@ void createOrUpdateDeviceRTL_433(const char* id, const char* model, uint8_t flag
}

RTL_433device* device = getDeviceById(id);
if (device == &NO_DEVICE_FOUND) {
if (device == &NO_RTL_433_DEVICE_FOUND) {
Log.trace(F("add %s" CR), id);
//new device
device = new RTL_433device();
Expand Down Expand Up @@ -360,4 +360,4 @@ extern int getOOKThresh() {
}
# endif

#endif
#endif

0 comments on commit ecd23b9

Please sign in to comment.