Skip to content

v2.0 Release #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 88 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
aa0efc0
Add the WiFiConnect test sketch
LeeLeahy2 Apr 29, 2022
fe7eb17
Add the WebServer test sketch
LeeLeahy2 Apr 30, 2022
e5c34e7
Webserver: Use SdCardServer library
LeeLeahy2 May 4, 2022
712bae3
WebServer: Remove unwanted code
LeeLeahy2 May 4, 2022
29a6527
WebServer: Break out print routines, beginSD
LeeLeahy2 May 4, 2022
c752bd6
Add read file support to SD_FileListing
LeeLeahy2 May 1, 2022
16a06e7
Add RTK Surveyor states
LeeLeahy2 May 8, 2022
7d4d817
Add Base state diagram
LeeLeahy2 May 8, 2022
4690964
Add Rover state diagram
LeeLeahy2 May 8, 2022
84c2c1b
Update ZED settings when profiles, AP, menus, or settings file changes.
nseidle May 9, 2022
3323517
Update Battery_Check.ino
nseidle May 9, 2022
1332991
Add initial PointPerfect LBand support
nseidle May 9, 2022
b959140
Add mode switch options to system menu
LeeLeahy2 May 9, 2022
692d716
Re-write NVM to store clear text to LittleFS
nseidle May 11, 2022
7d3da2d
Remove the deletion of profiles during firmware update
nseidle May 11, 2022
659ca02
Do not overwrite rtkID when reading from files
nseidle May 11, 2022
29ceb65
Fix profile name editing
nseidle May 11, 2022
d40dcc6
Add lost functions
nseidle May 11, 2022
7f6d596
Fix #111 - BT if no WiFi NTRIP Client
nseidle May 12, 2022
e91bf0d
Merge pull request #115 from LeeLeahy2/sd-card-listing
nseidle May 12, 2022
a708fb2
Merge pull request #114 from LeeLeahy2/rtk-surveyor-states
nseidle May 12, 2022
830fad0
Merge pull request #113 from LeeLeahy2/base-states
nseidle May 12, 2022
31db4df
Merge pull request #112 from LeeLeahy2/rover-states
nseidle May 12, 2022
d3442a4
Merge pull request #104 from LeeLeahy2/webserver
nseidle May 12, 2022
ef623b6
Merge pull request #103 from LeeLeahy2/wifi-connect
nseidle May 12, 2022
639b8b9
Display WiFi failed helper screen
nseidle May 12, 2022
054de4c
Allow carve out of Access Point for firmware size reduction
nseidle May 12, 2022
257b0f1
Add LBand test to system status menu
nseidle May 12, 2022
15fe85c
Merge branch 'release_candidate' of https://github.com/sparkfun/Spark…
nseidle May 12, 2022
00848bb
Typo fix
nseidle May 12, 2022
81ce988
Update compilation instructions to use 16MB partition
nseidle May 12, 2022
b1cf889
Mark repeated states with a leading asterisk
LeeLeahy2 May 10, 2022
5584432
Move to v2.0
nseidle May 12, 2022
ed6967f
Add LBand support
nseidle May 13, 2022
ecdb958
Add LBand to test screen
nseidle May 13, 2022
3bf28ad
Add test screen entry to debug menu
nseidle May 13, 2022
e4b9baf
Record settings after obtaining keys
nseidle May 13, 2022
01c1ac7
Add LBand to test screen
nseidle May 13, 2022
d40a728
Initialize arrays in setting struct
nseidle May 13, 2022
201004e
Correctly parse setting with mixed number/alpha. Avoid Strings in NVM.
nseidle May 13, 2022
3635832
Skip keys if no home WiFi credentials.
nseidle May 13, 2022
b38666a
Adjust LBand freq based on initial location
nseidle May 13, 2022
ac1cc04
Add LBand certificate check
nseidle May 13, 2022
c7d12b4
Set profile to default when creating new.
nseidle May 14, 2022
d02d403
Exit ublox check at boot if no response
nseidle May 14, 2022
1e2fb32
Make start/stop Bluetooth/WiFi reentrant.
nseidle May 15, 2022
be2c50d
Separate the BT and WiFi radio states.
nseidle May 15, 2022
aa4e55c
Update BTSerial library with ESP32 core v2.0.2
nseidle May 15, 2022
daae599
Add Uploader GUI
PaulZC May 16, 2022
9b68e43
Merge pull request #123 from sparkfun/Uploader_GUI
PaulZC May 16, 2022
33b00ce
Correct command echo
PaulZC May 16, 2022
23717cc
Fix compilation error when tokens.h is not available
LeeLeahy2 May 16, 2022
006a28f
Switch to esptool.py
PaulZC May 16, 2022
0fae077
Add reportHeapNow function
LeeLeahy2 May 13, 2022
6354260
Report heap useage after Bluetooth and WiFi get stopped
LeeLeahy2 May 13, 2022
8d163c0
Report heap useage after Bluetooth and WiFi get started
LeeLeahy2 May 16, 2022
25b289e
Merge pull request #126 from sparkfun/Uploader_GUI
PaulZC May 16, 2022
dad7cc1
Report heap usage at state change
LeeLeahy2 May 16, 2022
60d1eb5
Tidy up Uploader
PaulZC May 16, 2022
9ea3482
Merge pull request #128 from sparkfun/Uploader_GUI
PaulZC May 16, 2022
a470519
Merge pull request #127 from LeeLeahy2/heap-sparkfun
nseidle May 16, 2022
074f7c9
Merge pull request #125 from LeeLeahy2/build-error
nseidle May 16, 2022
4dfc4e5
Fix #131 - save settings before debug reset
nseidle May 16, 2022
7e9bc43
Add delete profile feature
nseidle May 16, 2022
05f6015
Call esptool.main . Divert stdout and stderr to messageBox
PaulZC May 17, 2022
55d6ae1
Merge branch 'release_candidate' of https://github.com/sparkfun/Spark…
PaulZC May 17, 2022
bf95ce5
Add Windows GUI to firmware update readme
nseidle May 17, 2022
4b02e78
Add readme to GUI
nseidle May 17, 2022
42ec4c7
Fix profile assignment if empty profile exists. Add delete profile.
nseidle May 17, 2022
6bf9290
Change semaphore name from xFATSemaphore to sdCardSemaphore
LeeLeahy2 May 19, 2022
c02fc13
Output semaphore take failures via serial
LeeLeahy2 May 19, 2022
6ded685
Update readme with v1.32 ZED-F9P firmware changes
nseidle May 19, 2022
676c1e9
Add debounce to powerOnCheck - #84 fix
nseidle May 19, 2022
78bbfc1
Rename start/stopWebServer. Add stopWebServer.
nseidle May 19, 2022
eded1ed
Merge pull request #136 from LeeLeahy2/semaphore
nseidle May 19, 2022
e6964c9
Merge branch 'release_candidate' into repeated-states
nseidle May 19, 2022
c5d3dca
Merge pull request #120 from LeeLeahy2/repeated-states
nseidle May 19, 2022
f8029da
Merge pull request #116 from LeeLeahy2/mode-switch
nseidle May 19, 2022
d92e529
Add firmwareID for v1.32 ZED-F9P firmware
nseidle May 19, 2022
5f19e58
Correct L-Band spelling
nseidle May 19, 2022
0072bc0
Correctly print device ID in error message
nseidle May 20, 2022
a45c50c
Turn on/off BT when attempting key WiFi connection
nseidle May 20, 2022
c1afa45
Fix buffer overrun with longer device name
nseidle May 20, 2022
4e4d650
Fix device ID and token selection
nseidle May 20, 2022
2bda331
Fix profile name change
nseidle May 20, 2022
c84b591
Change test display for LBand
nseidle May 26, 2022
563c90c
Add v2.0 binary
nseidle May 26, 2022
d9bd587
Merge branch 'main' into release_candidate
nseidle May 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Binaries/RTK_Surveyor_Firmware_v2_0.bin
Binary file not shown.
15 changes: 14 additions & 1 deletion Binaries/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
This folder contains the various firmware versions for RTK Products (Surveyor, Express, Express+, and Facet). Each binary is created by exporting a sketch binary from Arduino. The sketch binary is then uploaded to the ESP32 along with boot_app0.bin, RTK_Surveyor.ino.bootloader.bin, and RTK_Surveyor.ino.partitions.bin. You can update the firmware on a device by loading a binary onto the SD card and inserting it into the RTK Surveyor (see more information [here](https://learn.sparkfun.com/tutorials/sparkfun-rtk-surveyor-hookup-guide/firmware-updates-and-customization)) or by using the following CLI:
This folder contains the various firmware versions for RTK Products (Surveyor, Express, Express+, and Facet).

Updating the firmware can be achieved by using one of the following methods:

* Load the firmware on an SD card, then use a serial terminal with *Firmware Upgrade* menu
* Load the firmware over WiFi when the device is in WiFi AP Config Mode
* Use the [Windows GUI](https://github.com/sparkfun/SparkFun_RTK_Firmware/Uploader_GUI) and a USB cable. (This method is python based which can also be used on Linux, Mac OS, and Raspberry Pi)
* Use the command line *batch_program.bat* (see below)

The SD method is generally recommended. For more information see [here](https://learn.sparkfun.com/tutorials/sparkfun-rtk-surveyor-hookup-guide/firmware-updates-and-customization).

Each binary is created by exporting a sketch binary from Arduino. The sketch binary is then uploaded to the ESP32 along with boot_app0.bin, RTK_Surveyor.ino.bootloader.bin, and RTK_Surveyor.ino.partitions.bin. You can update the firmware on a device by loading a binary onto the SD card and inserting it into the RTK Surveyor ) or by using the included 'batch_program.bat' along with the binary file name and COM port. For example *batch_program.bat RTK_Surveyor_Firmware_v2_0.bin COM3*.

The batch file runs the following commands:

esptool.exe --chip esp32 --port COM4 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 ./bin/RTK_Surveyor.ino.bootloader.bin 0x8000 ./bin/RTK_Surveyor.ino.partitions.bin 0xe000 ./bin/boot_app0.bin 0x10000 ./RTK_Surveyor_Firmware_vxx.bin

Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/Base.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bool configureUbloxModuleBase()
int maxWait = 2000;

//If our settings haven't changed, and this is first config since power on, trust ZED's settings
if (updateZEDSettings == false && firstPowerOn == true)
if (settings.updateZEDSettings == false && firstPowerOn == true)
{
firstPowerOn = false; //Next time user switches modes, new settings will be applied
log_d("Skipping ZED Base configuration");
Expand Down
158 changes: 129 additions & 29 deletions Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ void beginBoard()
{
//Use ADC to check 50% resistor divider
int pin_adc_rtk_facet = 35;
if (analogReadMilliVolts(pin_adc_rtk_facet) > (3300 / 2 * 0.9) && analogReadMilliVolts(pin_adc_rtk_facet) < (3300 / 2 * 1.1))
uint16_t idValue = analogReadMilliVolts(pin_adc_rtk_facet);
log_d("Board ADC ID: %d", idValue);

if (idValue > (3300 / 2 * 0.9) && idValue < (3300 / 2 * 1.1))
{
productVariant = RTK_FACET;
}
else if (idValue > (3300 * 2 / 3 * 0.9) && idValue < (3300 * 2 / 3 * 1.1))
{
productVariant = RTK_FACET_LBAND;
}
else if (isConnected(0x19) == true) //Check for accelerometer
{
if (zedModuleType == PLATFORM_F9P) productVariant = RTK_EXPRESS;
Expand Down Expand Up @@ -77,7 +84,7 @@ void beginBoard()
strcpy(platformPrefix, "Express Plus");
}
}
else if (productVariant == RTK_FACET)
else if (productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
{
//v11
pin_muxA = 2;
Expand Down Expand Up @@ -113,12 +120,24 @@ void beginBoard()
pinMode(pin_radio_cts, OUTPUT);
digitalWrite(pin_radio_cts, LOW);

strcpy(platformFilePrefix, "SFE_Facet");
strcpy(platformPrefix, "Facet");
if (productVariant == RTK_FACET)
{
strcpy(platformFilePrefix, "SFE_Facet");
strcpy(platformPrefix, "Facet");
}
else if (productVariant == RTK_FACET_LBAND)
{
strcpy(platformFilePrefix, "SFE_Facet_LBand");
strcpy(platformPrefix, "Facet L-Band");
}
}

Serial.printf("SparkFun RTK %s v%d.%d-%s\r\n", platformPrefix, FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, __DATE__);

//Get unit MAC address
esp_read_mac(unitMACAddress, ESP_MAC_WIFI_STA);
unitMACAddress[5] += 2; //Convert MAC address to Bluetooth MAC (add 2): https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#mac-address

//For all boards, check reset reason. If reset was due to wdt or panic, append last log
if (esp_reset_reason() == ESP_RST_POWERON)
{
Expand All @@ -139,8 +158,8 @@ void beginBoard()
if (settings.enableResetDisplay == true)
{
settings.resetCount++;
recordSystemSettings(); //Record to NVM
Serial.printf("resetCount: %d\n\r", settings.resetCount);
recordSystemSettings(); //Record to NVM
}

Serial.print("Reset reason: ");
Expand Down Expand Up @@ -222,11 +241,11 @@ void beginSD()
}

//Setup FAT file access semaphore
if (xFATSemaphore == NULL)
if (sdCardSemaphore == NULL)
{
xFATSemaphore = xSemaphoreCreateMutex();
if (xFATSemaphore != NULL)
xSemaphoreGive(xFATSemaphore); //Make the file system available for use
sdCardSemaphore = xSemaphoreCreateMutex();
if (sdCardSemaphore != NULL)
xSemaphoreGive(sdCardSemaphore); //Make the file system available for use
}

if (createTestFile() == false)
Expand Down Expand Up @@ -320,16 +339,14 @@ void stopUART2Tasks()

void beginFS()
{
#define FORMAT_LITTLEFS_IF_FAILED true

if (online.fs == false)
{
Serial.println("Starting FS");

if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED)) {
if (!LittleFS.begin(true)) //Format LittleFS if begin fails
{
log_d("Error: LittleFS not online");
return;
}
Serial.println("LittleFS Started");
online.fs = true;
}
}
Expand All @@ -350,7 +367,7 @@ void beginDisplay()
{
Serial.println(F("Display not detected"));
}
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS || productVariant == RTK_FACET)
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS || productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
{
Serial.println(F("Display Error: Not detected."));
}
Expand Down Expand Up @@ -401,19 +418,25 @@ void beginGNSS()
zedFirmwareVersionInt = 121;
else if (strstr(zedFirmwareVersion, "1.30") != NULL) //ZED-F9P released Dec, 2021
zedFirmwareVersionInt = 130;
else if (strstr(zedFirmwareVersion, "1.32") != NULL) //ZED-F9P released May, 2022
zedFirmwareVersionInt = 132;
else
{
Serial.printf("Unknown firmware version: %s\n\r", zedFirmwareVersion);
zedFirmwareVersionInt = 99; //0.99 invalid firmware version
}

//Determine if we have a ZED-F9P (Express/Facet) or an ZED-F9R (Express Plus/Facet Plus)
if (strstr(i2cGNSS.minfo.extension[3], "ZED-F9P") != NULL)
{
zedModuleType = PLATFORM_F9P;
}
else if (strstr(i2cGNSS.minfo.extension[3], "ZED-F9R") != NULL)
{
zedModuleType = PLATFORM_F9R;
else
{
Serial.printf("Unknown ZED module: %s\n\r", i2cGNSS.minfo.extension[3]);
zedModuleType = PLATFORM_F9P;
}

printModuleInfo(); //Print module type and firmware version
}

Expand All @@ -429,7 +452,7 @@ void configureGNSS()
//Configuring the ZED can take more than 2000ms. We save configuration to
//ZED so there is no need to update settings unless user has modified
//the settings file or internal settings.
if (updateZEDSettings == false)
if (settings.updateZEDSettings == false)
{
log_d("Skipping ZED configuration");
return;
Expand Down Expand Up @@ -549,16 +572,22 @@ void beginSystemState()
{
//If the rocker switch was moved while off, force module settings
//When switch is set to '1' = BASE, pin will be shorted to ground
if (settings.lastState == STATE_ROVER_NOT_STARTED && digitalRead(pin_setupButton) == LOW) updateZEDSettings = true;
else if (settings.lastState == STATE_BASE_NOT_STARTED && digitalRead(pin_setupButton) == HIGH) updateZEDSettings = true;
if (settings.lastState == STATE_ROVER_NOT_STARTED && digitalRead(pin_setupButton) == LOW) settings.updateZEDSettings = true;
else if (settings.lastState == STATE_BASE_NOT_STARTED && digitalRead(pin_setupButton) == HIGH) settings.updateZEDSettings = true;

systemState = STATE_ROVER_NOT_STARTED; //Assume Rover. ButtonCheckTask() will correct as needed.
if (online.lband == false)
systemState = STATE_ROVER_NOT_STARTED; //Assume Rover. ButtonCheckTask() will correct as needed.
else
systemState = STATE_KEYS_STARTED; //Begin process for getting new keys

setupBtn = new Button(pin_setupButton); //Create the button in memory
}
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
{
systemState = settings.lastState; //Return to system state previous to power down.
if (online.lband == false)
systemState = settings.lastState; //Return to either Rover or Base Not Started. The last state previous to power down.
else
systemState = STATE_KEYS_STARTED; //Begin process for getting new keys

if (systemState > STATE_SHUTDOWN)
{
Expand All @@ -569,18 +598,20 @@ void beginSystemState()
setupBtn = new Button(pin_setupButton); //Create the button in memory
powerBtn = new Button(pin_powerSenseAndControl); //Create the button in memory
}
else if (productVariant == RTK_FACET)
else if (productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
{
systemState = settings.lastState; //Return to system state previous to power down.
if (online.lband == false)
systemState = settings.lastState; //Return to either Rover or Base Not Started. The last state previous to power down.
else
systemState = STATE_KEYS_STARTED; //Begin process for getting new keys

if (systemState > STATE_SHUTDOWN)
{
Serial.println("Unknown state - factory reset");
factoryReset();
}

if (systemState == STATE_ROVER_NOT_STARTED)
firstRoverStart = true; //Allow user to enter test screen during first rover start
firstRoverStart = true; //Allow user to enter test screen during first rover start

powerBtn = new Button(pin_powerSenseAndControl); //Create the button in memory
}
Expand All @@ -603,7 +634,7 @@ bool beginExternalTriggers()
if (online.gnss == false) return (false);

//If our settings haven't changed, trust ZED's settings
if (updateZEDSettings == false)
if (settings.updateZEDSettings == false)
{
log_d("Skipping ZED Trigger configuration");
return (true);
Expand Down Expand Up @@ -644,3 +675,72 @@ bool beginExternalTriggers()

return (response);
}

//Check if NEO-D9S is connected. Configure if available.
void beginLBand()
{
if (i2cLBand.begin(Wire, 0x43) == false) //Connect to the u-blox NEO-D9S using Wire port. The D9S default I2C address is 0x43 (not 0x42)
{
log_d("L-Band not detected");
return;
}

if (online.gnss == true)
{
i2cGNSS.checkUblox(); //Regularly poll to get latest data and any RTCM
i2cGNSS.checkCallbacks(); //Process any callbacks: ie, eventTriggerReceived
}

//If we have a fix, check which frequency to use
if (fixType == 2 || fixType == 3 || fixType == 4 || fixType == 5) //2D, 3D, 3D+DR, or Time
{
if ( (longitude > -125 && longitude < -67) && (latitude > -90 && latitude < 90))
{
log_d("Setting L-Band to US");
settings.LBandFreq = 1556290000; //We are in US band
}
else if ( (longitude > -25 && longitude < 70) && (latitude > -90 && latitude < 90))
{
log_d("Setting L-Band to EU");
settings.LBandFreq = 1545260000; //We are in EU band
}
else
{
Serial.println("Unknown band area");
settings.LBandFreq = 1556290000; //Default to US
}
recordSystemSettings();
}
else
log_d("No fix available for L-Band frequency determination");

bool response = true;
response &= i2cLBand.setVal32(UBLOX_CFG_PMP_CENTER_FREQUENCY, settings.LBandFreq); // Default 1539812500 Hz
response &= i2cLBand.setVal16(UBLOX_CFG_PMP_SEARCH_WINDOW, 2200); // Default 2200 Hz
response &= i2cLBand.setVal8(UBLOX_CFG_PMP_USE_SERVICE_ID, 0); // Default 1
response &= i2cLBand.setVal16(UBLOX_CFG_PMP_SERVICE_ID, 21845); // Default 50821
response &= i2cLBand.setVal16(UBLOX_CFG_PMP_DATA_RATE, 2400); // Default 2400 bps
response &= i2cLBand.setVal8(UBLOX_CFG_PMP_USE_DESCRAMBLER, 1); // Default 1
response &= i2cLBand.setVal16(UBLOX_CFG_PMP_DESCRAMBLER_INIT, 26969); // Default 23560
response &= i2cLBand.setVal8(UBLOX_CFG_PMP_USE_PRESCRAMBLING, 0); // Default 0
response &= i2cLBand.setVal64(UBLOX_CFG_PMP_UNIQUE_WORD, 16238547128276412563ull);
response &= i2cLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_I2C, 1); // Ensure UBX-RXM-PMP is enabled on the I2C port
response &= i2cLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART1, 1); // Output UBX-RXM-PMP on UART1
response &= i2cLBand.setVal(UBLOX_CFG_UART2OUTPROT_UBX, 1); // Enable UBX output on UART2
response &= i2cLBand.setVal(UBLOX_CFG_MSGOUT_UBX_RXM_PMP_UART2, 1); // Output UBX-RXM-PMP on UART2
response &= i2cLBand.setVal32(UBLOX_CFG_UART1_BAUDRATE, 38400); // match baudrate with ZED default
response &= i2cLBand.setVal32(UBLOX_CFG_UART2_BAUDRATE, 38400); // match baudrate with ZED default

if (response == false)
Serial.println("L-Band failed to configure");

i2cLBand.softwareResetGNSSOnly(); // Do a restart

i2cLBand.setRXMPMPmessageCallbackPtr(&pushRXMPMP); // Call pushRXMPMP when new PMP data arrives. Push it to the GNSS

i2cGNSS.setRXMCORcallbackPtr(&checkRXMCOR); // Check if the PMP data is being decrypted successfully

log_d("L-Band online");

online.lband = true;
}
28 changes: 12 additions & 16 deletions Firmware/RTK_Surveyor/Buttons.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@
//Let's make sure they continue to press for 500ms
void powerOnCheck()
{
#ifdef ENABLE_DEVELOPER
return;
#endif

powerPressedStartTime = millis();
if (digitalRead(pin_powerSenseAndControl) == LOW)
delay(500);

while (digitalRead(pin_powerSenseAndControl) == LOW)
{
delay(10);

if (millis() - powerPressedStartTime > 500)
break;
}

if (millis() - powerPressedStartTime < 500)
#ifndef ENABLE_DEVELOPER
if (digitalRead(pin_powerSenseAndControl) != LOW)
powerDown(false); //Power button tap. Returning to off state.
#endif

powerPressedStartTime = 0; //Reset var to return to normal 'on' state
}
Expand All @@ -31,13 +23,17 @@ void powerDown(bool displayInfo)
{
//Attempt to write to file system. This avoids collisions with file writing from other functions like recordSystemSettingsToFile()
//Wait up to 1000ms
if (xSemaphoreTake(xFATSemaphore, 1000 / portTICK_PERIOD_MS) == pdPASS)
if (xSemaphoreTake(sdCardSemaphore, 1000 / portTICK_PERIOD_MS) == pdPASS)
{
//Close down file system
ubxFile.sync();
ubxFile.close();
//xSemaphoreGive(xFATSemaphore); //Do not release semaphore
} //End xFATSemaphore
//xSemaphoreGive(sdCardSemaphore); //Do not release semaphore
} //End sdCardSemaphore
else
{
Serial.printf("sdCardSemaphore failed to yield, %s line %d\r\n", __FILE__, __LINE__);
}

online.logging = false;
}
Expand Down
Loading