Skip to content

Commit d39fcad

Browse files
authored
Merge pull request #712 from sparkfun/AddFlex
Merging AddFlex into release_candidate - with latest release_candidate updates
2 parents 0b439d6 + 02971b8 commit d39fcad

26 files changed

+2650
-1553
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 231 additions & 65 deletions
Large diffs are not rendered by default.

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 21 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ void bluetoothStart()
598598

599599
if (pin_bluetoothStatusLED != PIN_UNDEFINED)
600600
{
601-
bluetoothLedTask.detach(); // Reset BT LED blinker task rate to 2Hz
601+
bluetoothLedTask.detach(); // Reset BT LED blinker task rate to 2Hz
602602
bluetoothLedTask.attach(bluetoothLedTaskPace2Hz, tickerBluetoothLedUpdate); // Rate in seconds, callback
603603
}
604604

@@ -608,11 +608,11 @@ void bluetoothStart()
608608
{
609609
if (bluetoothCommandTaskHandle == nullptr)
610610
xTaskCreatePinnedToCore(
611-
bluetoothCommandTask, // Function to run
612-
"BluetoothCommandTask", // Just for humans
613-
4000, // Stack Size - must be ~4000
614-
nullptr, // Task input parameter
615-
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
611+
bluetoothCommandTask, // Function to run
612+
"BluetoothCommandTask", // Just for humans
613+
4000, // Stack Size - must be ~4000
614+
nullptr, // Task input parameter
615+
0, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest
616616
&bluetoothCommandTaskHandle, // Task handle
617617
settings.bluetoothInterruptsCore); // Core where task should run, 0 = core, 1 = Arduino
618618
}
@@ -696,53 +696,10 @@ void bluetoothStop()
696696
bluetoothIncomingRTCM = false;
697697
}
698698

699-
// Test the bidirectional communication through UART connected to GNSS
700-
// TODO Make this not ZED centric
701-
void bluetoothTest(bool runTest)
699+
// Print the current Bluetooth radio configuration and connection status
700+
void bluetoothPrintStatus()
702701
{
703-
// Verify the ESP UART can communicate TX/RX to ZED UART1
704-
const char *bluetoothStatusText;
705-
706-
if (online.gnss == true)
707-
{
708-
if (runTest && (zedUartPassed == false))
709-
{
710-
tasksStopGnssUart(); // Stop absorbing serial via task from GNSS receiver
711-
712-
gnss->setBaudrate(115200 * 2);
713-
714-
serialGNSS->begin(115200 * 2, SERIAL_8N1, pin_GnssUart_RX,
715-
pin_GnssUart_TX); // Start UART on platform depedent pins for SPP. The GNSS will be
716-
// configured to output NMEA over its UART at the same rate.
717-
718-
#ifdef COMPILE_ZED
719-
SFE_UBLOX_GNSS_SERIAL myGNSS;
720-
if (myGNSS.begin(*serialGNSS) == true) // begin() attempts 3 connections
721-
{
722-
zedUartPassed = true;
723-
bluetoothStatusText = (settings.bluetoothRadioType == BLUETOOTH_RADIO_OFF) ? "Off" : "Online";
724-
}
725-
else
726-
bluetoothStatusText = "Offline";
727-
#endif // COMPILE_ZED
728-
729-
gnss->setBaudrate(settings.dataPortBaud);
730-
731-
serialGNSS->begin(settings.dataPortBaud, SERIAL_8N1, pin_GnssUart_RX,
732-
pin_GnssUart_TX); // Start UART on platform depedent pins for SPP. The GNSS will be
733-
// configured to output NMEA over its UART at the same rate.
734-
735-
tasksStartGnssUart(); // Return to normal operation
736-
}
737-
else
738-
bluetoothStatusText = (settings.bluetoothRadioType == BLUETOOTH_RADIO_OFF) ? "Off" : "Online";
739-
}
740-
else
741-
bluetoothStatusText = "GNSS Offline";
742-
743702
// Display Bluetooth MAC address and test results
744-
char macAddress[5];
745-
snprintf(macAddress, sizeof(macAddress), "%02X%02X", btMACAddress[4], btMACAddress[5]);
746703
systemPrint("Bluetooth ");
747704
if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
748705
systemPrint("SPP and Low Energy ");
@@ -755,8 +712,19 @@ void bluetoothTest(bool runTest)
755712
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_OFF)
756713
systemPrint("Off ");
757714

715+
char macAddress[5];
716+
snprintf(macAddress, sizeof(macAddress), "%02X%02X", btMACAddress[4], btMACAddress[5]);
758717
systemPrint("(");
759718
systemPrint(macAddress);
760-
systemPrint("): ");
761-
systemPrintln(bluetoothStatusText);
719+
systemPrint(")");
720+
721+
if (settings.bluetoothRadioType != BLUETOOTH_RADIO_OFF)
722+
{
723+
systemPrint(": ");
724+
if (bluetoothIsConnected() == false)
725+
systemPrint("Not ");
726+
systemPrint("Connected");
727+
}
728+
729+
systemPrintln();
762730
}

Firmware/RTK_Everywhere/Buttons.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void IRAM_ATTR gpioExpanderISR()
8282
}
8383

8484
// Start the I2C expander if possible
85-
bool beginGpioExpander(uint8_t padAddress)
85+
bool beginGpioExpanderButtons(uint8_t padAddress)
8686
{
8787
// Initialize the PCA95xx with its default I2C address
8888
if (io.begin(padAddress, *i2c_0) == true)
@@ -99,7 +99,7 @@ bool beginGpioExpander(uint8_t padAddress)
9999

100100
systemPrintln("Directional pad online");
101101

102-
online.gpioExpander = true;
102+
online.gpioExpanderButtons = true;
103103
return (true);
104104
}
105105
return (false);
@@ -114,7 +114,7 @@ void buttonRead()
114114
userBtn->read();
115115

116116
// Check directional pad once interrupt has occurred
117-
if (online.gpioExpander == true && gpioChanged == true)
117+
if (online.gpioExpanderButtons == true && gpioChanged == true)
118118
{
119119
gpioChanged = false;
120120

@@ -155,7 +155,7 @@ bool buttonReleased()
155155
return (userBtn->wasReleased());
156156

157157
// Check directional pad
158-
if (online.gpioExpander == true)
158+
if (online.gpioExpanderButtons == true)
159159
{
160160
// Check for any button press on the directional pad
161161
for (int buttonNumber = 0; buttonNumber < 5; buttonNumber++)
@@ -179,7 +179,7 @@ bool buttonReleased(uint8_t buttonNumber)
179179
return (false);
180180

181181
// Check directional pad
182-
if (online.gpioExpander == true)
182+
if (online.gpioExpanderButtons == true)
183183
{
184184
if (gpioExpander_wasReleased[buttonNumber] == true)
185185
{
@@ -206,7 +206,7 @@ bool buttonPressedFor(uint16_t maxTime)
206206
bool buttonPressedFor(uint8_t buttonNumber, uint16_t maxTime)
207207
{
208208
// Check directional pad
209-
if (online.gpioExpander == true)
209+
if (online.gpioExpanderButtons == true)
210210
{
211211
// Check if the time has started for this button
212212
if (gpioExpander_holdStart[buttonNumber] > 0)

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,8 @@ void pointperfectPrintKeyInformation(const char *requestedBy) {systemPrintln("**
291291

292292
#ifndef COMPILE_LG290P
293293

294-
void lg290pBoot() {}
295294
void lg290pHandler(uint8_t * buffer, int length) {}
296295
bool lg290pMessageEnabled(char *nmeaSentence, int sentenceLength) {return false;}
297-
void lg290pReset() {}
298296

299297
#endif // COMPILE_LG290P
300298

0 commit comments

Comments
 (0)