lorawan.cpp code sanitizations

This commit is contained in:
Verkehrsrot 2019-09-19 17:06:37 +02:00
parent 50ff7977d6
commit af0fd577d3

View File

@ -234,13 +234,10 @@ void onEvent(ev_t ev) {
sprintf(display_line6, " "); // clear previous lmic status
// set data rate adaptation according to saved setting
LMIC_setAdrMode(cfg.adrmode);
// set cyclic lmic link check to off if no ADR because is not supported by
// ttn (but enabled by lmic after join)
LMIC_setLinkCheckMode(cfg.adrmode);
// Set data rate and transmit power (note: txpower seems to be ignored by
// the library)
switch_lora(cfg.lorasf, cfg.txpower);
// show effective LoRa parameters after join
// set data rate and transmit power if we have no ADR
if (!cfg.adrmode)
switch_lora(cfg.lorasf, cfg.txpower);
// show current devaddr
ESP_LOGI(TAG, "DEVaddr=%08X", LMIC.devaddr);
break;
@ -540,7 +537,7 @@ void lmictask(void *pvParameters) {
os_init(); // initialize lmic run-time environment
LMIC_reset(); // initialize lmic MAC
// LMIC_setLinkCheckMode(0);
LMIC_setLinkCheckMode(0);
// This tells LMIC to make the receive windows bigger, in case your clock is
// faster or slower. This causes the transceiver to be earlier switched on,
@ -550,7 +547,8 @@ void lmictask(void *pvParameters) {
LMIC_setClockError(MAX_CLOCK_ERROR * CLOCK_ERROR_PROCENTAGE / 100);
#endif
#if defined(CFG_US915) || defined(CFG_au921)
//#if defined(CFG_US915) || defined(CFG_au921)
#if CFG_LMIC_US_like
// in the US, with TTN, it saves join time if we start on subband 1
// (channels 8-15). This will get overridden after the join by parameters
// from the network. If working with other networks or in other regions,
@ -561,7 +559,7 @@ void lmictask(void *pvParameters) {
// Set the data rate to Spreading Factor 7. This is the fastest supported
// rate for 125 kHz channels, and it minimizes air time and battery power.
// Set the transmission power to 14 dBi (25 mW).
// LMIC_setDrTxpow(DR_SF7, 14);
LMIC_setDrTxpow(DR_SF7, 14);
// register a callback for downlink messages. We aren't trying to write
// reentrant code, so pUserData is NULL.