Skip to content

Commit

Permalink
The device name can now be as long as it wants.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunorman committed Aug 2, 2018
1 parent 8e6a867 commit 6319d5c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions RadDevice.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#include <Arduino.h>
#include <RadDevice.h>
// NOTE: this must be included in main.cpp to compile
#include <EEPROM.h>

String get_device_id() {
// device id is stored at pos 0 and is 6 bytes long.
EEPROM.begin(6);
// device id is stored at pos 0 and is X bytes long.
// As soon as it hits the first NULL char it bails.
EEPROM.begin(50);
String device_id;
for (int i=0 ; i < 6 ; i++) {

for (int i=0 ; i < 50 ; i++) {
char f = EEPROM.read(i);
if (f == NULL) {
break;
}
device_id += (f);
}
EEPROM.end();
Expand Down

0 comments on commit 6319d5c

Please sign in to comment.