Skip to content

Commit

Permalink
added support for *system reset* event - clears settings
Browse files Browse the repository at this point in the history
  • Loading branch information
gigapod committed Dec 13, 2024
1 parent 2a97742 commit 6df92f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ bool sfeIoTNodeLoRaWAN::onSetup()
// Event Callback for lorawan receive status
flxRegisterEventCB(flxEvent::kLoRaWANReceivedMessage, this, &sfeIoTNodeLoRaWAN::onLoRaWANReceiveEvent);

// for system reset event
flxRegisterEventCB(flxEvent::kOnSystemReset, this, &sfeIoTNodeLoRaWAN::onSystemResetEvent);

// Set the default timer interval, before restore of settings
_timer.interval = kDefaultLogInterval;

Expand Down Expand Up @@ -567,6 +570,12 @@ void sfeIoTNodeLoRaWAN::onLoRaWANSendEvent(bool bOkay)
else
sfeLED.flash(sfeLED.Red);
}

void sfeIoTNodeLoRaWAN::onSystemResetEvent(void)
{
// The system is being reset - reset our settings
flxSettings.reset();
}
//---------------------------------------------------------------------------
// Callback for LoRaWAN receive events
void sfeIoTNodeLoRaWAN::onLoRaWANReceiveEvent(uint32_t data)
Expand Down
3 changes: 3 additions & 0 deletions sfeIoTNodeLoRaWAN/sfeIoTNodeLoRaWAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class sfeIoTNodeLoRaWAN : public flxApplication
void onSystemActivity(void);
void onSystemActivityLow(void);

// event callback for system reset
void onSystemResetEvent(void);

void onErrorMessage(uint8_t);
void onLogEvent(void);
void onQwiicButtonEvent(bool);
Expand Down

0 comments on commit 6df92f6

Please sign in to comment.