Skip to content

Commit b4556c1

Browse files
authored
Merge pull request #495 from LeeLeahy2/generate-random-param
Pass settings address to generateRandomKeysID
2 parents 21b0c08 + 628d486 commit b4556c1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Firmware/LoRaSerial/Commands.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ bool commandAT(const char * commandString)
145145
return true;
146146

147147
case ('G'): //ATG - Generate a new netID and encryption key
148-
generateRandomKeysID();
148+
generateRandomKeysID(&tempSettings);
149149
return true;
150150

151151
case ('I'): //ATI

Firmware/LoRaSerial/Train.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void selectTraining()
1010
//Generate new netID/AES key to share
1111
//We assume the user needs to maintain their settings (airSpeed, numberOfChannels, freq min/max, bandwidth/spread/hop)
1212
//but need to be on a different netID/AES key.
13-
void generateRandomKeysID()
13+
void generateRandomKeysID(Settings * radioSettings)
1414
{
1515
if ((settings.debug == true) || (settings.debugTraining == true))
1616
{
@@ -22,24 +22,24 @@ void generateRandomKeysID()
2222
randomSeed(radio.randomByte());
2323

2424
//Generate new NetID
25-
settings.netID = random(0, 256); //Inclusive, exclusive
25+
radioSettings->netID = random(0, 256); //Inclusive, exclusive
2626

2727
//Generate new AES Key. User may not be using AES but we still need both radios to have the same key in case they do enable AES.
2828
for (int x = 0 ; x < 16 ; x++)
29-
settings.encryptionKey[x] = random(0, 256); //Inclusive, exclusive
29+
radioSettings->encryptionKey[x] = random(0, 256); //Inclusive, exclusive
3030

3131
//We do not generate new AES Initial Values here. Those are generated during generateHopTable() based on the unit's settings.
3232

3333
if ((settings.debug == true) || (settings.debugTraining == true))
3434
{
3535
systemPrint("Select new NetID: ");
36-
systemPrintln(settings.netID);
36+
systemPrintln(radioSettings->netID);
3737

3838
systemPrint("Select new Encryption Key:");
3939
for (uint8_t i = 0 ; i < 16 ; i++)
4040
{
4141
systemPrint(" ");
42-
systemPrint(settings.encryptionKey[i], HEX);
42+
systemPrint(radioSettings->encryptionKey[i], HEX);
4343
}
4444
systemPrintln();
4545
outputSerialData(true);

0 commit comments

Comments
 (0)