Merge pull request #86 from GreyRook/guard-clause-instead-of-goto
prefer guard clause over goto
This commit is contained in:
commit
2c60277737
@ -106,12 +106,15 @@ void printKeys(void) {
|
|||||||
#endif // VERBOSE
|
#endif // VERBOSE
|
||||||
|
|
||||||
void do_send(osjob_t *j) {
|
void do_send(osjob_t *j) {
|
||||||
|
// Schedule next transmission
|
||||||
|
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(cfg.sendcycle * 2),
|
||||||
|
do_send);
|
||||||
|
|
||||||
// Check if there is a pending TX/RX job running
|
// Check if there is a pending TX/RX job running
|
||||||
if (LMIC.opmode & OP_TXRXPEND) {
|
if (LMIC.opmode & OP_TXRXPEND) {
|
||||||
ESP_LOGI(TAG, "LoRa busy, rescheduling");
|
ESP_LOGI(TAG, "LoRa busy, rescheduling");
|
||||||
sprintf(display_lmic, "LORA BUSY");
|
sprintf(display_lmic, "LORA BUSY");
|
||||||
goto end;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare payload with sum of unique WIFI MACs seen
|
// prepare payload with sum of unique WIFI MACs seen
|
||||||
@ -153,18 +156,12 @@ void do_send(osjob_t *j) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end:
|
|
||||||
// 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
|
|
||||||
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(cfg.sendcycle * 2),
|
|
||||||
do_send);
|
|
||||||
|
|
||||||
} // do_send()
|
} // do_send()
|
||||||
|
|
||||||
void onEvent(ev_t ev) {
|
void onEvent(ev_t ev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user