Skip to content

Commit 806abeb

Browse files
committed
Add blinking base LED
1 parent f587f89 commit 806abeb

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

Firmware/RTK_Surveyor/Buttons.ino

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ void checkSetupButton()
1717
//Configure for base mode
1818
Serial.println(F("Base Mode"));
1919

20-
//Configure for base mode
21-
Serial.println(F("Base Mode"));
22-
2320
//Restart Bluetooth with 'Base' name
2421
//We start BT regardless of Ntrip Server in case user wants to transmit survey-in stats over BT
2522
beginBluetooth();
@@ -52,6 +49,7 @@ void checkSetupButton()
5249
}
5350
}
5451

52+
digitalWrite(baseStatusLED, HIGH);
5553
displayBaseSuccess();
5654
delay(500);
5755
}
@@ -87,9 +85,9 @@ void checkSetupButton()
8785

8886
beginBluetooth(); //Restart Bluetooth with 'Rover' name
8987

90-
digitalWrite(baseStatusLED, LOW);
91-
9288
changeState(STATE_ROVER_NO_FIX);
89+
90+
digitalWrite(baseStatusLED, LOW);
9391
displayRoverSuccess();
9492
delay(500);
9593
}

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
const int FIRMWARE_VERSION_MAJOR = 1;
4343
const int FIRMWARE_VERSION_MINOR = 2;
4444

45-
//Define the RTK Surveyor board identifier:
46-
// This is an int which is unique to this variant of the RTK Surveyor and which allows us
47-
// to make sure that the settings in EEPROM are correct for this version of the RTK Surveyor
45+
//Define the RTK board identifier:
46+
// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
47+
// to make sure that the settings in EEPROM are correct for this version of the RTK
4848
// (sizeOfSettings is not necessarily unique and we want to avoid problems when swapping from one variant to another)
4949
// It is the sum of:
5050
// the major firmware version * 0x10
@@ -222,8 +222,6 @@ const byte menuTimeout = 15; //Menus will exit/timeout after this number of seco
222222
bool inTestMode = false; //Used to re-route BT traffic while in test sub menu
223223
long systemTime_minutes = 0; //Used to test if logging is less than max minutes
224224

225-
//uint32_t lastRoverUpdate = 0;
226-
//uint32_t lastBaseUpdate = 0;
227225
uint32_t lastBattUpdate = 0;
228226
uint32_t lastDisplayUpdate = 0;
229227
uint32_t lastSystemStateUpdate = 0;
@@ -247,7 +245,7 @@ uint32_t casterResponseWaitStartTime = 0; //Used to detect if caster service tim
247245

248246
uint32_t maxSurveyInWait_s = 60L * 15L; //Re-start survey-in after X seconds
249247

250-
bool setupByPowerButton = false; //We can change setup via tapping power button
248+
uint32_t lastBaseLEDupdate = 0; //Controls the blinking of the Base LED
251249

252250
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
253251

Firmware/RTK_Surveyor/States.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ void updateSystemState()
5454
//Wait for horz acc of 5m or less before starting survey in
5555
case (STATE_BASE_TEMP_SURVEY_NOT_STARTED):
5656
{
57+
//Blink base LED slowly while we wait for first fix
58+
if (millis() - lastBaseLEDupdate > 1000)
59+
{
60+
lastBaseLEDupdate = millis();
61+
digitalWrite(baseStatusLED, !digitalRead(baseStatusLED));
62+
}
63+
5764
//Check for <5m horz accuracy
5865
uint32_t accuracy = i2cGNSS.getHorizontalAccuracy();
5966

@@ -64,7 +71,7 @@ void updateSystemState()
6471

6572
if (f_accuracy > 0.0 && f_accuracy < settings.surveyInStartingAccuracy)
6673
{
67-
displaySurveyStart(); //Show 'Survey'
74+
displaySurveyStart(); //Show 'Survey Started'
6875
if (configureUbloxModuleBase() == true)
6976
{
7077
if (surveyIn() == true) //Begin survey
@@ -80,9 +87,17 @@ void updateSystemState()
8087
//Check survey status until it completes or 15 minutes elapses and we go back to rover
8188
case (STATE_BASE_TEMP_SURVEY_STARTED):
8289
{
90+
//Blink base LED quickly during survey in
91+
if (millis() - lastBaseLEDupdate > 500)
92+
{
93+
lastBaseLEDupdate = millis();
94+
digitalWrite(baseStatusLED, !digitalRead(baseStatusLED));
95+
}
96+
8397
if (i2cGNSS.getFixType() == 5) //We have a TIME fix which is survey in complete
8498
{
8599
Serial.println(F("Base survey complete! RTCM now broadcasting."));
100+
digitalWrite(baseStatusLED, HIGH); //Indicate survey complete
86101
changeState(STATE_BASE_TEMP_TRANSMITTING);
87102
}
88103
else
@@ -116,6 +131,7 @@ void updateSystemState()
116131

117132
beginBluetooth(); //Restart Bluetooth with 'Rover' name
118133

134+
digitalWrite(baseStatusLED, LOW); //Indicate rover mode
119135
changeState(STATE_ROVER_NO_FIX);
120136
displayRoverSuccess();
121137
}

Firmware/RTK_Surveyor/System.ino

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,17 +508,9 @@ void updateBattLEDs()
508508
//And outputs a serial message to USB
509509
void checkBatteryLevels()
510510
{
511-
//long startTime = millis();
512-
513-
//Check I2C semaphore
514-
// if (xSemaphoreTake(xI2CSemaphore, i2cSemaphore_maxWait) == pdPASS)
515-
// {
516511
battLevel = lipo.getSOC();
517512
battVoltage = lipo.getVoltage();
518513
battChangeRate = lipo.getChangeRate();
519-
// xSemaphoreGive(xI2CSemaphore);
520-
// }
521-
//Serial.printf("Batt time to update: %d\n", millis() - startTime);
522514

523515
Serial.printf("Batt (%d%%): Voltage: %0.02fV", battLevel, battVoltage);
524516

0 commit comments

Comments
 (0)