Skip to content

Commit 67e4044

Browse files
authored
Merge pull request #732 from sparkfun/nsUpdates
Add CLI commands and control
2 parents cc7da56 + 5ac5d9a commit 67e4044

29 files changed

+2667
-2326
lines changed

.github/workflows/non-release-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
echo "JSON_ENDING=-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
5252
echo "JSON_FILE_NAME=RTK-Everywhere-RC-Firmware.json" >> "$GITHUB_ENV"
5353
echo "ENABLE_DEVELOPER=true" >> "$GITHUB_ENV"
54-
echo "DEBUG_LEVEL=debug" >> "$GITHUB_ENV"
54+
echo "DEBUG_LEVEL=error" >> "$GITHUB_ENV"
5555
fi
5656
5757
- name: Setup Arduino CLI

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,36 @@ bool bluetoothIsConnected()
118118
return (false);
119119
}
120120

121+
// Return true if the BLE Command channel is connected
122+
bool bluetoothCommandIsConnected()
123+
{
124+
#ifdef COMPILE_BT
125+
if (bluetoothGetState() == BT_OFF)
126+
return (false);
127+
128+
if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
129+
{
130+
if (bluetoothSerialBleCommands->connected() == true)
131+
return (true);
132+
}
133+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP)
134+
{
135+
return (false);
136+
}
137+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
138+
{
139+
if (bluetoothSerialBleCommands->connected() == true)
140+
return (true);
141+
}
142+
else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
143+
{
144+
return (false);
145+
}
146+
#endif // COMPILE_BT
147+
148+
return (false);
149+
}
150+
121151
// Return the Bluetooth state
122152
byte bluetoothGetState()
123153
{
@@ -254,23 +284,19 @@ int bluetoothCommandAvailable()
254284
}
255285

256286
// Pass a command string to the BLE Serial interface
257-
void bluetoothProcessCommand(char *rxData)
287+
void bluetoothSendCommand(char *rxData)
258288
{
259289
#ifdef COMPILE_BT
260290
// Direct output to Bluetooth Command
261291
PrintEndpoint originalPrintEndpoint = printEndpoint;
262292

263-
printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
264-
if (settings.debugCLI == true)
265-
printEndpoint = PRINT_ENDPOINT_ALL;
266-
else
267-
printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
293+
printEndpoint = PRINT_ENDPOINT_ALL;
268294

269-
processCommand(rxData); // Send command proccesor output to BLE
295+
systemPrint(rxData); // Send command output to BLE, SPP, and Serial
270296
printEndpoint = originalPrintEndpoint;
271297

272298
#else // COMPILE_BT
273-
processCommand(rxData); // Send command proccesor output to Serial
299+
systemPrint(rxData); // Send command output to Serial
274300
#endif // COMPILE_BT
275301
}
276302

@@ -534,9 +560,9 @@ void bluetoothStart()
534560
memcpy(record.uuid.uuid.uuid128, UUID_IAP2, sizeof(UUID_IAP2));
535561
record.service_name_length = strlen(sdp_service_name) + 1;
536562
record.service_name = (char *)sdp_service_name;
537-
//record.service_name_length = strlen(deviceName) + 1; // Doesn't seem to help the failed connects
538-
//record.service_name = (char *)deviceName;
539-
//record.rfcomm_channel_number = 1; // Doesn't seem to help the failed connects
563+
// record.service_name_length = strlen(deviceName) + 1; // Doesn't seem to help the failed connects
564+
// record.service_name = (char *)deviceName;
565+
// record.rfcomm_channel_number = 1; // Doesn't seem to help the failed connects
540566
esp_sdp_create_record((esp_bluetooth_sdp_record_t *)&record);
541567
}
542568
}

Firmware/RTK_Everywhere/Display.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,15 @@ void setRadioIcons(std::vector<iconPropertyBlinking> *iconList)
666666
if (present.display_type == DISPLAY_64x48)
667667
{
668668
// There are three spots for icons in the Wireless area, left/center/right
669-
// There are three radios that could be active: Bluetooth (always indicated), WiFi (if enabled), ESP-Now (if
669+
// There are three radios that could be active: Bluetooth (always indicated), WiFi (if enabled), ESP-NOW (if
670670
// enabled) Because of lack of space we will indicate the Base/Rover if only two radios or less are active
671671
//
672672
// Top left corner - Radio icon indicators take three spots (left/center/right)
673673
// Allowed icon combinations:
674674
// Bluetooth + Rover/Base
675675
// WiFi + Bluetooth + Rover/Base
676-
// ESP-Now + Bluetooth + Rover/Base
677-
// ESP-Now + Bluetooth + WiFi
676+
// ESP-NOW + Bluetooth + Rover/Base
677+
// ESP-NOW + Bluetooth + WiFi
678678

679679
// Count the number of radios in use
680680
uint8_t numberOfRadios = 1; // Bluetooth always indicated.
@@ -3091,14 +3091,14 @@ void paintKeyProvisionFail(uint16_t displayTime)
30913091
}
30923092
}
30933093

3094-
// Show screen while ESP-Now is pairing
3094+
// Show screen while ESP-NOW is pairing
30953095
void paintEspNowPairing()
30963096
{
3097-
displayMessage("ESP-Now Pairing", 0);
3097+
displayMessage("ESP-NOW Pairing", 0);
30983098
}
30993099
void paintEspNowPaired()
31003100
{
3101-
displayMessage("ESP-Now Paired", 2000);
3101+
displayMessage("ESP-NOW Paired", 2000);
31023102
}
31033103

31043104
void displayNtpStart(uint16_t displayTime)

Firmware/RTK_Everywhere/ESPNOW.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ esp_err_t espNowAddPeer(const uint8_t *peerMac)
8383
}
8484

8585
//*********************************************************************
86-
// Start ESP-Now if needed, put ESP-Now into broadcast state
86+
// Start ESP-NOW if needed, put ESP-NOW into broadcast state
8787
void espNowBeginPairing()
8888
{
8989
if (settings.enableEspNow == false)
@@ -155,7 +155,7 @@ void espNowOnDataReceived(const esp_now_recv_info *mac, const uint8_t *incomingD
155155
{
156156
espNowRSSI = packetRSSI; // Record this packet's RSSI as an ESP NOW packet
157157

158-
// We've just received ESP-Now data. We assume this is RTCM and push it directly to the GNSS.
158+
// We've just received ESP-NOW data. We assume this is RTCM and push it directly to the GNSS.
159159
// Determine if ESPNOW is the correction source
160160
if (correctionLastSeen(CORR_ESPNOW))
161161
{
@@ -492,7 +492,7 @@ void espNowStaticPairing()
492492
{
493493
systemPrintln("Begin ESP NOW Pairing");
494494

495-
// Start ESP-Now if needed, put ESP-Now into broadcast state
495+
// Start ESP-NOW if needed, put ESP-NOW into broadcast state
496496
espNowBeginPairing();
497497

498498
// Begin sending our MAC every 250ms until a remote device sends us there info

Firmware/RTK_Everywhere/GNSS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ class GNSS
321321
// If LBand is being used, ignore any RTCM that may come in from the GNSS
322322
virtual void rtcmOnGnssDisable();
323323

324-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
324+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
325325
virtual void rtcmOnGnssEnable();
326326

327327
virtual uint16_t rtcmRead(uint8_t *rtcmBuffer, int rtcmBytesToRead);

Firmware/RTK_Everywhere/GNSS_LG290P.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class GNSS_LG290P : GNSS
422422
// If LBand is being used, ignore any RTCM that may come in from the GNSS
423423
void rtcmOnGnssDisable();
424424

425-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
425+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
426426
void rtcmOnGnssEnable();
427427

428428
uint16_t rtcmRead(uint8_t *rtcmBuffer, int rtcmBytesToRead);

Firmware/RTK_Everywhere/GNSS_LG290P.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ void GNSS_LG290P::rtcmOnGnssDisable()
21852185
}
21862186

21872187
//----------------------------------------
2188-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
2188+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
21892189
//----------------------------------------
21902190
void GNSS_LG290P::rtcmOnGnssEnable()
21912191
{

Firmware/RTK_Everywhere/GNSS_Mosaic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ class GNSS_MOSAIC : GNSS
941941
// If LBand is being used, ignore any RTCM that may come in from the GNSS
942942
void rtcmOnGnssDisable();
943943

944-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
944+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
945945
void rtcmOnGnssEnable();
946946

947947
uint16_t rtcmRead(uint8_t *rtcmBuffer, int rtcmBytesToRead);

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,7 @@ void GNSS_MOSAIC::rtcmOnGnssDisable()
20512051
}
20522052

20532053
//----------------------------------------
2054-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
2054+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
20552055
//----------------------------------------
20562056
void GNSS_MOSAIC::rtcmOnGnssEnable()
20572057
{

Firmware/RTK_Everywhere/GNSS_None.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ class GNSS_None : public GNSS
511511
{
512512
}
513513

514-
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-Now) to GNSS receiver
514+
// If L-Band is available, but encrypted, allow RTCM through other sources (radio, ESP-NOW) to GNSS receiver
515515
void rtcmOnGnssEnable()
516516
{
517517
}

0 commit comments

Comments
 (0)