Skip to content

Commit f55b2a9

Browse files
authored
Merge pull request #599 from LeeLeahy2/default-settings
Use a constant array for the default settings
2 parents 8b49a46 + 81dc112 commit f55b2a9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Firmware/RTK_Surveyor/System.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,8 @@ void createNMEASentence(customNmeaType_e textID, char *nmeaMessage, size_t sizeO
579579
// Reset settings struct to default initializers
580580
void settingsToDefaults()
581581
{
582-
Settings *defaultSettings = new Settings;
583-
memcpy(&settings, defaultSettings, sizeof(Settings));
584-
delete defaultSettings;
582+
static const Settings defaultSettings;
583+
memcpy(&settings, &defaultSettings, sizeof(defaultSettings));
585584
}
586585

587586
// Given a spot in the ubxMsg array, return true if this message is supported on this platform and firmware version

Firmware/RTK_Surveyor/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ typedef struct
908908
bool enablePrintDuplicateStates = false;
909909
bool enablePrintRtcSync = false;
910910
RadioType_e radioType = RADIO_EXTERNAL;
911-
uint8_t espnowPeers[5][6]; // Max of 5 peers. Contains the MAC addresses (6 bytes) of paired units
911+
uint8_t espnowPeers[5][6] = {0}; // Max of 5 peers. Contains the MAC addresses (6 bytes) of paired units
912912
uint8_t espnowPeerCount = 0;
913913
bool enableRtcmMessageChecking = false;
914914
BluetoothRadioType_e bluetoothRadioType = BLUETOOTH_RADIO_SPP;

0 commit comments

Comments
 (0)