lorawan.cpp bugfix BLE payload
This commit is contained in:
parent
45066af7c9
commit
776795d75b
@ -108,37 +108,40 @@ void printKeys(void) {
|
|||||||
#endif // VERBOSE
|
#endif // VERBOSE
|
||||||
|
|
||||||
void do_send(osjob_t* j){
|
void do_send(osjob_t* j){
|
||||||
uint8_t mydata[4];
|
|
||||||
|
|
||||||
// Sum of unique WIFI MACs seen
|
// Check if there is a pending TX/RX job running
|
||||||
mydata[0] = (macs_wifi & 0xff00) >> 8;
|
|
||||||
mydata[1] = macs_wifi & 0xff;
|
|
||||||
|
|
||||||
#ifdef BLECOUNTER
|
|
||||||
// Sum of unique BLE MACs seen
|
|
||||||
mydata[2] = (macs_ble & 0xff00) >> 8;
|
|
||||||
mydata[3] = macs_ble & 0xff;
|
|
||||||
#else
|
|
||||||
mydata[2] = 0;
|
|
||||||
mydata[3] = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check if there is not a current TX/RX job running
|
|
||||||
if (LMIC.opmode & OP_TXRXPEND) {
|
if (LMIC.opmode & OP_TXRXPEND) {
|
||||||
ESP_LOGI(TAG, "OP_TXRXPEND, not sending");
|
ESP_LOGI(TAG, "OP_TXRXPEND, not sending");
|
||||||
sprintf(display_lmic, "LORA BUSY");
|
sprintf(display_lmic, "LORA BUSY");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t mydata[4];
|
||||||
|
|
||||||
|
// prepare payload with sum of unique WIFI MACs seen
|
||||||
|
mydata[0] = (macs_wifi & 0xff00) >> 8;
|
||||||
|
mydata[1] = macs_wifi & 0xff;
|
||||||
|
|
||||||
|
if (cfg.blescan) {
|
||||||
|
// append sum of unique BLE MACs seen to payload
|
||||||
|
mydata[2] = (macs_ble & 0xff00) >> 8;
|
||||||
|
mydata[3] = macs_ble & 0xff;
|
||||||
} else {
|
} else {
|
||||||
|
mydata[2] = 0;
|
||||||
|
mydata[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare upstream data transmission at the next possible time.
|
// Prepare upstream data transmission at the next possible time.
|
||||||
LMIC_setTxData2(1, mydata, sizeof(mydata), (cfg.countermode & 0x02));
|
LMIC_setTxData2(1, mydata, sizeof(mydata), (cfg.countermode & 0x02));
|
||||||
ESP_LOGI(TAG, "Packet queued");
|
ESP_LOGI(TAG, "Packet queued");
|
||||||
sprintf(display_lmic, "PACKET QUEUED");
|
sprintf(display_lmic, "PACKET QUEUED");
|
||||||
|
|
||||||
// clear counter if not in cumulative counter mode
|
// clear counter if not in cumulative counter mode
|
||||||
if (cfg.countermode != 1) {
|
if (cfg.countermode != 1) {
|
||||||
reset_counters(); // clear macs container and reset all counters
|
reset_counters(); // clear macs container and reset all counters
|
||||||
reset_salt(); // get new salt for salting hashes
|
reset_salt(); // get new salt for salting hashes
|
||||||
ESP_LOGI(TAG, "Counter cleared (countermode = %d)", cfg.countermode);
|
ESP_LOGI(TAG, "Counter cleared (countermode = %d)", cfg.countermode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Schedule next transmission
|
// Schedule next transmission
|
||||||
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(cfg.sendcycle * 2), do_send);
|
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(cfg.sendcycle * 2), do_send);
|
||||||
|
Loading…
Reference in New Issue
Block a user