Merge pull request #474 from cyberman54/development

LMIC key storage moved to event handler
This commit is contained in:
Verkehrsrot 2019-10-22 08:19:14 +02:00 committed by GitHub
commit 32dac134de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 10 deletions

View File

@ -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 {

View File

@ -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);
}
}

View File

@ -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();