Merge pull request #474 from cyberman54/development
LMIC key storage moved to event handler
This commit is contained in:
commit
32dac134de
@ -22,8 +22,6 @@
|
||||
#endif
|
||||
|
||||
extern TaskHandle_t lmicTask, lorasendTask;
|
||||
extern RTC_NOINIT_ATTR u4_t RTCnetid, RTCdevaddr;
|
||||
extern RTC_NOINIT_ATTR u1_t RTCnwkKey[16], RTCartKey[16];
|
||||
|
||||
// table of LORAWAN MAC commands
|
||||
typedef struct {
|
||||
|
@ -108,6 +108,8 @@ void lora_setupForNetwork(bool preJoin) {
|
||||
getSfName(updr2rps(LMIC.datarate)),
|
||||
getBwName(updr2rps(LMIC.datarate)),
|
||||
getCrName(updr2rps(LMIC.datarate)));
|
||||
// store LMIC keys and counters in RTC memory
|
||||
LMIC_getSessionKeys(&RTCnetid, &RTCdevaddr, RTCnwkKey, RTCartKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,6 @@ RTC_NOINIT_ATTR runmode_t RTC_runmode;
|
||||
void do_reset(bool warmstart) {
|
||||
if (warmstart) {
|
||||
// store LMIC keys and counters in RTC memory
|
||||
#if (HAS_LORA)
|
||||
LMIC_getSessionKeys(&RTCnetid, &RTCdevaddr, RTCnwkKey, RTCartKey);
|
||||
#endif
|
||||
ESP_LOGI(TAG, "restarting device (warmstart), keeping runmode %d",
|
||||
RTC_runmode);
|
||||
} else {
|
||||
@ -84,11 +81,6 @@ void enter_deepsleep(const int wakeup_sec, const gpio_num_t wakeup_gpio) {
|
||||
esp_sleep_enable_ext1_wakeup(1ULL << wakeup_gpio, ESP_EXT1_WAKEUP_ALL_LOW);
|
||||
}
|
||||
|
||||
// store LMIC keys and counters in RTC memory
|
||||
#if (HAS_LORA)
|
||||
LMIC_getSessionKeys(&RTCnetid, &RTCdevaddr, RTCnwkKey, RTCartKey);
|
||||
#endif
|
||||
|
||||
// halt interrupts accessing i2c bus
|
||||
mask_user_IRQ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user