Skip to content

Commit 6df92f6

Browse files
committed
added support for *system reset* event - clears settings
1 parent 2a97742 commit 6df92f6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ bool sfeIoTNodeLoRaWAN::onSetup()
291291
// Event Callback for lorawan receive status
292292
flxRegisterEventCB(flxEvent::kLoRaWANReceivedMessage, this, &sfeIoTNodeLoRaWAN::onLoRaWANReceiveEvent);
293293

294+
// for system reset event
295+
flxRegisterEventCB(flxEvent::kOnSystemReset, this, &sfeIoTNodeLoRaWAN::onSystemResetEvent);
296+
294297
// Set the default timer interval, before restore of settings
295298
_timer.interval = kDefaultLogInterval;
296299

@@ -567,6 +570,12 @@ void sfeIoTNodeLoRaWAN::onLoRaWANSendEvent(bool bOkay)
567570
else
568571
sfeLED.flash(sfeLED.Red);
569572
}
573+
574+
void sfeIoTNodeLoRaWAN::onSystemResetEvent(void)
575+
{
576+
// The system is being reset - reset our settings
577+
flxSettings.reset();
578+
}
570579
//---------------------------------------------------------------------------
571580
// Callback for LoRaWAN receive events
572581
void sfeIoTNodeLoRaWAN::onLoRaWANReceiveEvent(uint32_t data)

sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ class sfeIoTNodeLoRaWAN : public flxApplication
112112
void onSystemActivity(void);
113113
void onSystemActivityLow(void);
114114

115+
// event callback for system reset
116+
void onSystemResetEvent(void);
117+
115118
void onErrorMessage(uint8_t);
116119
void onLogEvent(void);
117120
void onQwiicButtonEvent(bool);

0 commit comments

Comments
 (0)