Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Firmware/LoRaSerial/Commands.ino
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool commandAT(const char * commandString)
return true;

case ('F'): //ATF - Restore default parameters
settings = defaultSettings; //Overwrite all system settings with defaults
getDefaultSettings(&settings); //Overwrite all system settings with defaults

validateSettings(); //Modify defaults for each radio type (915, 868, 433, etc)

Expand Down
10 changes: 9 additions & 1 deletion Firmware/LoRaSerial/LoRaSerial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ unsigned long retransmitTimeout = 0; //Throttle back re-transmits

//Global variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
const Settings defaultSettings;
Settings settings; //Active settings used by the radio
Settings tempSettings; //Temporary settings used for command processing
Settings trainingSettings; //Settings used for training other radios
Expand Down Expand Up @@ -629,6 +628,15 @@ void setup()
arch.beginBoard(); //Initialize the board specific hardware, and ID platform type

loadSettings(); //Load settings from EEPROM

//Use the current radio settings if they are already set
if (!settings.radioBandwidth)
{
//Set the initial radio parameters
getDefaultSettings(&settings);
recordSystemSettings();
}

serialOperatingMode = settings.operatingMode;

beginSerial(settings.serialSpeed);
Expand Down
12 changes: 12 additions & 0 deletions Firmware/LoRaSerial/NVM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ void loadSettings()
{
arch.eepromBegin();

//Use the default settings
getDefaultSettings(&settings);

//Check to see if EEPROM is blank
uint32_t testRead = 0;
if (EEPROM.get(0, testRead) == 0xFFFFFFFF)
Expand Down Expand Up @@ -55,6 +58,15 @@ void loadSettings()
recordSystemSettings();
}

//Merge the default settings with the default radio settings
void getDefaultSettings(Settings * newSettings)
{
const Settings defaultSettings;

//Set the initial radio parameters
*newSettings = defaultSettings;
}

//Modify defaults for each radio type (915, 868, 433, etc)
//Confirm various settings are within regulatory bounds
void validateSettings()
Expand Down
9 changes: 3 additions & 6 deletions Firmware/LoRaSerial/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,7 @@ void multiPointLeds()
blinkRadioRssiLed();

//Update the hop LED
if ((millis() - radioCallHistory[RADIO_CALL_hopChannel]) >= RADIO_USE_BLINK_MILLIS)
digitalWrite(YELLOW_LED, LED_OFF);
blinkChannelHopLed(false);

//Update the HEARTBEAT LED
blinkHeartbeatLed(false);
Expand All @@ -1006,8 +1005,7 @@ void p2pLeds()
//Leave the LINK LED (GREEN_LED_2) off

//Update the hop LED
if ((millis() - radioCallHistory[RADIO_CALL_hopChannel]) >= RADIO_USE_BLINK_MILLIS)
digitalWrite(YELLOW_LED, LED_OFF);
blinkChannelHopLed(false);

//Update the HEARTBEAT LED
blinkHeartbeatLed(false);
Expand Down Expand Up @@ -1049,8 +1047,7 @@ void vcLeds()
//Serial RX displayed on the LINK LED (GREEN_LED_2) by blinkSerialRxLed

//Update the hop LED
if ((millis() - radioCallHistory[RADIO_CALL_hopChannel]) >= RADIO_USE_BLINK_MILLIS)
digitalWrite(YELLOW_LED, LED_OFF);
blinkChannelHopLed(false);

//Update the HEARTBEAT LED
blinkHeartbeatLed(false);
Expand Down
2 changes: 1 addition & 1 deletion Firmware/LoRaSerial/Train.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void beginTrainingServer()
void commonTrainingInitialization()
{
//Use common radio settings between the client and server for training
settings = defaultSettings;
getDefaultSettings(&settings);
settings.dataScrambling = true; //Scramble the data
settings.enableCRC16 = true; //Use CRC-16
settings.encryptData = true; //Enable packet encryption
Expand Down