Skip to content

Commit e3c3f24

Browse files
authored
Merge pull request #420 from sparkfun/release_candidate
Enable developer settings based on github action
2 parents 36feded + 0d9ae25 commit e3c3f24

File tree

10 files changed

+121
-113
lines changed

10 files changed

+121
-113
lines changed

.github/workflows/compile-rtk-firmware.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@master
2121

22+
#File_Name_v3_1.bin
23+
#File_Name_RC-Jan_26_2023.bin
24+
- name: Create file ending and compiler flags based on branch
25+
run: |
26+
if [[ $BRANCH == 'main' ]]; then
27+
echo "FILE_ENDING_UNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}_${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
28+
echo "FILE_ENDING_NOUNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}.${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
29+
echo "JSON_ENDING=" >> "$GITHUB_ENV"
30+
echo "JSON_FILE_NAME=RTK-Firmware.json" >> "$GITHUB_ENV"
31+
echo "ENABLE_DEVELOPER=false" >> "$GITHUB_ENV"
32+
else
33+
echo "FILE_ENDING_UNDERSCORE=_RC-${{ steps.date.outputs.date }}" >> "$GITHUB_ENV"
34+
echo "FILE_ENDING_NOUNDERSCORE=_RC-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
35+
echo "JSON_ENDING=-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
36+
echo "JSON_FILE_NAME=RTK-RC-Firmware.json" >> "$GITHUB_ENV"
37+
echo "ENABLE_DEVELOPER=true" >> "$GITHUB_ENV"
38+
fi
39+
2240
- name: Setup Arduino CLI
2341
uses: arduino/setup-arduino-cli@v1
2442

@@ -64,7 +82,7 @@ jobs:
6482
run: arduino-cli compile --fqbn esp32:esp32:esp32 ./Firmware/RTK_Surveyor/RTK_Surveyor.ino
6583
--build-property build.partitions=partitions
6684
--build-property upload.maximum_size=3145728
67-
--build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECT_TOKEN=$POINTPERFECT_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\""
85+
--build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECT_TOKEN=$POINTPERFECT_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\"" \"-DENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }}\""
6886
--export-binaries
6987

7088
- name: Get current date
@@ -78,22 +96,6 @@ jobs:
7896
- name: Extract branch name
7997
run: echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV
8098

81-
#File_Name_v3_1.bin
82-
#File_Name_RC-Jan_26_2023.bin
83-
- name: Create file ending based on branch
84-
run: |
85-
if [[ $BRANCH == 'main' ]]; then
86-
echo "FILE_ENDING_UNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}_${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
87-
echo "FILE_ENDING_NOUNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}.${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
88-
echo "JSON_ENDING=" >> "$GITHUB_ENV"
89-
echo "JSON_FILE_NAME=RTK-Firmware.json" >> "$GITHUB_ENV"
90-
else
91-
echo "FILE_ENDING_UNDERSCORE=_RC-${{ steps.date.outputs.date }}" >> "$GITHUB_ENV"
92-
echo "FILE_ENDING_NOUNDERSCORE=_RC-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
93-
echo "JSON_ENDING=-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
94-
echo "JSON_FILE_NAME=RTK-RC-Firmware.json" >> "$GITHUB_ENV"
95-
fi
96-
9799
- name: Rename binary
98100
run: |
99101
cd Firmware/RTK_Surveyor/build/esp32.esp32.esp32/

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ void pinUART2Task( void *pvParameters )
529529
//Note: ESP32 2.0.6 does some strange auto-bauding thing here which takes 20s to complete if there is no data for it to auto-baud.
530530
// That's fine for most RTK products, but causes the Ref Stn to stall for 20s. However, it doesn't stall with ESP32 2.0.2...
531531
// Uncomment these lines to prevent the stall if/when we upgrade to ESP32 ~2.0.6.
532-
//#if defined(ENABLE_DEVELOPER) && defined(REF_STN_GNSS_DEBUG)
533-
// if (productVariant == REFERENCE_STATION)
532+
//#if defined(REF_STN_GNSS_DEBUG)
533+
// if (ENABLE_DEVELOPER && productVariant == REFERENCE_STATION)
534534
//#else
535535
// if (USE_I2C_GNSS)
536536
//#endif

Firmware/RTK_Surveyor/Buttons.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ void powerOnCheck()
88
if (digitalRead(pin_powerSenseAndControl) == LOW)
99
delay(500);
1010

11-
#ifndef ENABLE_DEVELOPER
12-
if (pin_powerSenseAndControl >= 0)
13-
if (digitalRead(pin_powerSenseAndControl) != LOW)
14-
powerDown(false); //Power button tap. Returning to off state.
15-
#endif
16-
11+
if (ENABLE_DEVELOPER)
12+
{
13+
if (pin_powerSenseAndControl >= 0)
14+
if (digitalRead(pin_powerSenseAndControl) != LOW)
15+
powerDown(false); //Power button tap. Returning to off state.
16+
}
17+
1718
powerPressedStartTime = 0; //Reset var to return to normal 'on' state
1819
}
1920

Firmware/RTK_Surveyor/Display.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,11 @@ void displaySplash()
522522

523523
yPos = yPos + fontHeight + 7;
524524
char unitFirmware[50];
525-
#ifdef ENABLE_DEVELOPER
526-
snprintf(unitFirmware, sizeof(unitFirmware), "v%d.%d-DEV", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
527-
#else
528-
snprintf(unitFirmware, sizeof(unitFirmware), "v%d.%d", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
529-
#endif
525+
if (ENABLE_DEVELOPER)
526+
snprintf(unitFirmware, sizeof(unitFirmware), "v%d.%d-DEV", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
527+
else
528+
snprintf(unitFirmware, sizeof(unitFirmware), "v%d.%d", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
529+
530530
printTextCenter(unitFirmware, yPos, QW_FONT_5X7, 1, false);
531531

532532
oled.display();

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
#define COMPILE_BT //Comment out to remove Bluetooth functionality
3232
#define COMPILE_L_BAND //Comment out to remove L-Band functionality
3333
#define COMPILE_SD_MMC //Comment out to remove REFERENCE_STATION microSD SD_MMC support
34-
#define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
3534
//#define REF_STN_GNSS_DEBUG //Uncomment this line to output GNSS library debug messages on serialGNSS. Ref Stn only. Needs ENABLE_DEVELOPER
3635

36+
//Always define ENABLE_DEVELOPER to enable its use in conditional statements
37+
#ifndef ENABLE_DEVELOPER
38+
#define ENABLE_DEVELOPER true //This enable specials developer modes (don't check power button at startup). Passed in from compiler flags
39+
#endif
40+
3741
//Define the RTK board identifier:
3842
// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
3943
// to make sure that the settings stored in flash (LittleFS) are correct for this version of the RTK

Firmware/RTK_Surveyor/System.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ bool configureUbloxModule()
1010
//Turn on/off debug messages
1111
if (settings.enableI2Cdebug)
1212
{
13-
#if defined(ENABLE_DEVELOPER) && defined(REF_STN_GNSS_DEBUG)
14-
if (productVariant == REFERENCE_STATION)
13+
#if defined(REF_STN_GNSS_DEBUG)
14+
if (ENABLE_DEVELOPER && productVariant == REFERENCE_STATION)
1515
theGNSS.enableDebugging(serialGNSS); //Output all debug messages over serialGNSS
1616
else
1717
#endif

Firmware/RTK_Surveyor/menuBase.ino

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,12 @@ void menuBase()
197197
{
198198
systemPrint("Enter the number of meters for survey-in required position accuracy (1.0 to 5.0m): ");
199199
float observationPositionAccuracy = getDouble();
200-
#ifdef ENABLE_DEVELOPER
201-
if (observationPositionAccuracy < 1.0 || observationPositionAccuracy > 10.0) //Arbitrary 1m minimum
202-
#else
203-
if (observationPositionAccuracy < 1.0 || observationPositionAccuracy > 5.0) //Arbitrary 1m minimum
204-
#endif
200+
201+
float maxObservationPositionAccuracy = 5.0;
202+
if (ENABLE_DEVELOPER)
203+
maxObservationPositionAccuracy = 10.0;
204+
205+
if (observationPositionAccuracy < 1.0 || observationPositionAccuracy > maxObservationPositionAccuracy) //Arbitrary 1m minimum
205206
systemPrintln("Error: Observation positional accuracy requirement out of range");
206207
else
207208
settings.observationPositionAccuracy = observationPositionAccuracy; //Recorded to NVM and file at main menu exit
@@ -422,9 +423,9 @@ bool getFileLineSD(const char* fileName, int lineToFind, char* lineData, int lin
422423
log_d("File %s not found", fileName);
423424
break;
424425
}
425-
426+
426427
int lineNumber = 0;
427-
428+
428429
while (file.available())
429430
{
430431
//Get the next line from the file
@@ -442,26 +443,26 @@ bool getFileLineSD(const char* fileName, int lineToFind, char* lineData, int lin
442443
break;
443444
}
444445
}
445-
446+
446447
if (strlen(lineData) > 0) //Ignore single \n or \r
447448
lineNumber++;
448449
}
449-
450+
450451
file.close();
451452
}
452453
#ifdef COMPILE_SD_MMC
453454
else
454455
{
455456
File file = SD_MMC.open(fileName, FILE_READ);
456-
457+
457458
if (!file)
458459
{
459460
log_d("File %s not found", fileName);
460461
break;
461462
}
462-
463+
463464
int lineNumber = 0;
464-
465+
465466
while (file.available())
466467
{
467468
//Get the next line from the file
@@ -479,12 +480,12 @@ bool getFileLineSD(const char* fileName, int lineToFind, char* lineData, int lin
479480
break;
480481
}
481482
}
482-
483+
483484
if (strlen(lineData) > 0) //Ignore single \n or \r
484485
lineNumber++;
485486
}
486-
487-
file.close();
487+
488+
file.close();
488489
}
489490
#endif
490491
break;
@@ -554,7 +555,7 @@ bool removeFileSD(const char* fileName)
554555
log_d("Removing from SD: %s", fileName);
555556
SD_MMC.remove(fileName);
556557
removed = true;
557-
}
558+
}
558559
}
559560
#endif
560561

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ void menuMain()
2626
while (1)
2727
{
2828
systemPrintln();
29-
#ifdef ENABLE_DEVELOPER
30-
systemPrintf("SparkFun RTK %s v%d.%d-RC-%s\r\n", platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);
31-
#else
32-
systemPrintf("SparkFun RTK %s v%d.%d-%s\r\n", platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);
33-
#endif
29+
if (ENABLE_DEVELOPER)
30+
systemPrintf("SparkFun RTK %s v%d.%d-RC-%s\r\n", platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);
31+
else
32+
systemPrintf("SparkFun RTK %s v%d.%d-%s\r\n", platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);
3433

3534
#ifdef COMPILE_BT
3635
systemPrint("** Bluetooth broadcasting as: ");
@@ -242,7 +241,7 @@ void menuUserProfiles()
242241
else
243242
{
244243
if (SD_MMC.exists(settingsFileName))
245-
SD_MMC.remove(settingsFileName);
244+
SD_MMC.remove(settingsFileName);
246245
}
247246
#endif
248247
}
@@ -331,15 +330,15 @@ void factoryReset()
331330
{
332331
//Remove this specific settings file. Don't remove the other profiles.
333332
sd->remove(settingsFileName);
334-
333+
335334
sd->remove(stationCoordinateECEFFileName); //Remove station files
336335
sd->remove(stationCoordinateGeodeticFileName);
337336
}
338337
#ifdef COMPILE_SD_MMC
339338
else
340339
{
341340
SD_MMC.remove(settingsFileName);
342-
341+
343342
SD_MMC.remove(stationCoordinateECEFFileName); //Remove station files
344343
SD_MMC.remove(stationCoordinateGeodeticFileName);
345344
}
@@ -404,11 +403,12 @@ void menuRadio()
404403

405404
systemPrintln("2) Pair radios");
406405
systemPrintln("3) Forget all radios");
407-
#ifdef ENABLE_DEVELOPER
408-
systemPrintln("4) Add dummy radio");
409-
systemPrintln("5) Send dummy data");
410-
systemPrintln("6) Broadcast dummy data");
411-
#endif
406+
if (ENABLE_DEVELOPER)
407+
{
408+
systemPrintln("4) Add dummy radio");
409+
systemPrintln("5) Send dummy data");
410+
systemPrintln("6) Broadcast dummy data");
411+
}
412412
}
413413

414414
systemPrintln("x) Exit");
@@ -439,8 +439,7 @@ void menuRadio()
439439
systemPrintln("Radios forgotten");
440440
}
441441
}
442-
#ifdef ENABLE_DEVELOPER
443-
else if (settings.radioType == RADIO_ESPNOW && incoming == 4)
442+
else if (ENABLE_DEVELOPER && settings.radioType == RADIO_ESPNOW && incoming == 4)
444443
{
445444
uint8_t peer1[] = {0xB8, 0xD6, 0x1A, 0x0D, 0x8F, 0x9C}; //Random MAC
446445
if (esp_now_is_peer_exist(peer1) == true)
@@ -459,18 +458,17 @@ void menuRadio()
459458

460459
espnowSetState(ESPNOW_PAIRED);
461460
}
462-
else if (settings.radioType == RADIO_ESPNOW && incoming == 5)
461+
else if (ENABLE_DEVELOPER && settings.radioType == RADIO_ESPNOW && incoming == 5)
463462
{
464463
uint8_t espnowData[] = "This is the long string to test how quickly we can send one string to the other unit. I am going to need a much longer sentence if I want to get a long amount of data into one transmission. This is nearing 200 characters but needs to be near 250.";
465464
esp_now_send(0, (uint8_t *) &espnowData, sizeof(espnowData)); //Send packet to all peers
466465
}
467-
else if (settings.radioType == RADIO_ESPNOW && incoming == 6)
466+
else if (ENABLE_DEVELOPER && settings.radioType == RADIO_ESPNOW && incoming == 6)
468467
{
469468
uint8_t espnowData[] = "This is the long string to test how quickly we can send one string to the other unit. I am going to need a much longer sentence if I want to get a long amount of data into one transmission. This is nearing 200 characters but needs to be near 250.";
470469
uint8_t broadcastMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
471470
esp_now_send(broadcastMac, (uint8_t *) &espnowData, sizeof(espnowData)); //Send packet to all peers
472471
}
473-
#endif
474472

475473
else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
476474
break;

Firmware/RTK_Surveyor/menuPP.ino

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ void menuPointPerfectKeys()
126126
settings.pointPerfectNextKeyStart = settings.pointPerfectCurrentKeyStart + settings.pointPerfectCurrentKeyDuration + 1; //Next key starts after current key
127127
settings.pointPerfectNextKeyDuration = settings.pointPerfectCurrentKeyDuration;
128128

129-
#ifdef ENABLE_DEVELOPER
130-
systemPrintf(" settings.pointPerfectNextKeyStart: %lld\r\n", settings.pointPerfectNextKeyStart);
131-
systemPrintf(" settings.pointPerfectNextKeyDuration: %lld\r\n", settings.pointPerfectNextKeyDuration);
132-
#endif
129+
if (ENABLE_DEVELOPER)
130+
{
131+
systemPrintf(" settings.pointPerfectNextKeyStart: %lld\r\n", settings.pointPerfectNextKeyStart);
132+
systemPrintf(" settings.pointPerfectNextKeyDuration: %lld\r\n", settings.pointPerfectNextKeyDuration);
133+
}
133134
}
134135
}
135136
else if (incoming == 4)
@@ -659,12 +660,13 @@ void dateToKeyStartDuration(uint8_t expDay, uint8_t expMonth, uint16_t expYear,
659660
long long unixEpoch = thingstreamEpochToGPSEpoch(*settingsKeyStart, *settingsKeyDuration);
660661
unixEpochToWeekToW(unixEpoch, &keyGPSWeek, &keyGPSToW);
661662

662-
#ifdef ENABLE_DEVELOPER
663-
systemPrintf(" KeyStart: %lld\r\n", *settingsKeyStart);
664-
systemPrintf(" KeyDuration: %lld\r\n", *settingsKeyDuration);
665-
systemPrintf(" keyGPSWeek: %d\r\n", keyGPSWeek);
666-
systemPrintf(" keyGPSToW: %d\r\n", keyGPSToW);
667-
#endif
663+
if (ENABLE_DEVELOPER)
664+
{
665+
systemPrintf(" KeyStart: %lld\r\n", *settingsKeyStart);
666+
systemPrintf(" KeyDuration: %lld\r\n", *settingsKeyDuration);
667+
systemPrintf(" keyGPSWeek: %d\r\n", keyGPSWeek);
668+
systemPrintf(" keyGPSToW: %d\r\n", keyGPSToW);
669+
}
668670
}
669671

670672
/*

0 commit comments

Comments
 (0)