Skip to content

Commit 31e4028

Browse files
committed
Add ATI13, ATI14 and ATI15 commands to display seed and channel table
1 parent 3cf302a commit 31e4028

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

Firmware/LoRaSerial/Commands.ino

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ bool commandAT(const char * commandString)
226226
systemPrintln(" ATI10 - Display radio metrics");
227227
systemPrintln(" ATI11 - Display the system runtime");
228228
systemPrintln(" ATI12 - Set programming complete");
229+
systemPrintln(" ATI13 - Display the random seed");
230+
systemPrintln(" ATI14 - Display the channel table by channel");
231+
systemPrintln(" ATI15 - Display the channel table by frequency");
229232

230233
//Virtual circuit information commands
231234
systemPrintln(" ATI30 - Return myVc value");
@@ -637,6 +640,69 @@ bool commandAT(const char * commandString)
637640
systemWrite(*data++);
638641
}
639642
return true;
643+
644+
case ('3'): //ATI13 - Display the random seed
645+
systemPrint("myRandSeed: ");
646+
systemPrintln(myRandSeed);
647+
return true;
648+
649+
case ('4'): //ATI14 - Display the channel table by channel
650+
systemPrintln("Channel Table");
651+
if (!channels)
652+
systemPrintln(" Channel table not allocated!");
653+
else
654+
{
655+
for (int index = 0; index < settings.numberOfChannels; index++)
656+
{
657+
systemPrint(" Channel ");
658+
if ((index <= 9) && (settings.numberOfChannels >= 10))
659+
systemPrint(" ");
660+
systemPrint(index);
661+
systemPrint(": ");
662+
systemPrint(channels[index],3);
663+
systemPrintln(" MHz");
664+
}
665+
}
666+
return true;
667+
668+
case ('5'): //ATI14 - Display the channel table by frequency
669+
systemPrintln("Channel Table by Frequency");
670+
if (!channels)
671+
systemPrintln(" Channel table not allocated!");
672+
else
673+
{
674+
//Initialize the channel array
675+
uint8_t chanIndex[settings.numberOfChannels];
676+
for (int index = 0; index < settings.numberOfChannels; index++)
677+
chanIndex[index] = index;
678+
679+
//Sort the channel numbers by frequency
680+
for (int index = 0; index < (settings.numberOfChannels - 1); index++)
681+
{
682+
for (int x = index + 1; x < settings.numberOfChannels; x++)
683+
{
684+
if (channels[chanIndex[index]] > channels[chanIndex[x]])
685+
{
686+
uint8_t f = chanIndex[index];
687+
chanIndex[index] = chanIndex[x];
688+
chanIndex[x] = f;
689+
}
690+
}
691+
}
692+
693+
//Display the frequencies
694+
for (int index = 0; index < settings.numberOfChannels; index++)
695+
{
696+
systemPrint(" Channel ");
697+
if ((chanIndex[index] <= 9) && (settings.numberOfChannels >= 10))
698+
systemPrint(" ");
699+
systemPrint(chanIndex[index]);
700+
systemPrint(": ");
701+
systemPrint(channels[chanIndex[index]],3);
702+
systemPrintln(" MHz");
703+
}
704+
}
705+
return true;
640706
}
641707
}
642708
if ((commandString[2] == 'I') && (commandString[3] == '3') && (commandLength == 5))

Firmware/LoRaSerial/LoRaSerial.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ float *channels;
152152
uint8_t channelNumber = 0;
153153
uint32_t airSpeed;
154154

155+
uint16_t myRandSeed;
156+
bool myRandBit;
157+
155158
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
156159

157160
//Encryption

Firmware/LoRaSerial/Radio.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,6 @@ uint16_t calcMaxThroughput()
482482
return (mostBytesPerSecond);
483483
}
484484

485-
uint16_t myRandSeed;
486-
bool myRandBit;
487-
488485
//Generate unique hop table based on radio settings
489486
void generateHopTable()
490487
{

0 commit comments

Comments
 (0)