LMIC key storage moved to event handler
This commit is contained in:
parent
b786323036
commit
3cbda10f40
@ -22,8 +22,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern TaskHandle_t lmicTask, lorasendTask;
|
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
|
// table of LORAWAN MAC commands
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -108,6 +108,8 @@ void lora_setupForNetwork(bool preJoin) {
|
|||||||
getSfName(updr2rps(LMIC.datarate)),
|
getSfName(updr2rps(LMIC.datarate)),
|
||||||
getBwName(updr2rps(LMIC.datarate)),
|
getBwName(updr2rps(LMIC.datarate)),
|
||||||
getCrName(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) {
|
void do_reset(bool warmstart) {
|
||||||
if (warmstart) {
|
if (warmstart) {
|
||||||
// store LMIC keys and counters in RTC memory
|
// 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",
|
ESP_LOGI(TAG, "restarting device (warmstart), keeping runmode %d",
|
||||||
RTC_runmode);
|
RTC_runmode);
|
||||||
} else {
|
} 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);
|
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
|
// halt interrupts accessing i2c bus
|
||||||
mask_user_IRQ();
|
mask_user_IRQ();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user