Skip to content

Commit 668a945

Browse files
committed
Tweak the gpioExpander function names
1 parent fa520bc commit 668a945

File tree

4 files changed

+49
-33
lines changed

4 files changed

+49
-33
lines changed

Firmware/RTK_Everywhere/LoRa.ino

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void loraEnterBootloader()
377377
if (productVariant == RTK_TORCH)
378378
digitalWrite(pin_loraRadio_boot, HIGH); // Enter bootload mode
379379
else if (productVariant == RTK_FLEX)
380-
gpioExpanderEnableLoraBoot();
380+
gpioExpanderLoraBootEnable();
381381

382382
loraReset();
383383
}
@@ -387,7 +387,7 @@ void loraExitBootloader()
387387
if (productVariant == RTK_TORCH)
388388
digitalWrite(pin_loraRadio_boot, LOW); // Exit bootload mode
389389
else if (productVariant == RTK_FLEX)
390-
gpioExpanderDisableLoraBoot();
390+
gpioExpanderLoraBootDisable();
391391

392392
loraReset();
393393
}
@@ -403,9 +403,9 @@ void loraReset()
403403
}
404404
else if (productVariant == RTK_FLEX)
405405
{
406-
gpioExpanderDisableLora();
406+
gpioExpanderLoraDisable();
407407
delay(15);
408-
gpioExpanderEnableLora();
408+
gpioExpanderLoraEnable();
409409
delay(15);
410410
}
411411
}
@@ -415,15 +415,15 @@ void loraPowerOn()
415415
if (productVariant == RTK_TORCH)
416416
digitalWrite(pin_loraRadio_power, HIGH); // Power STM32/radio
417417
else if (productVariant == RTK_FLEX)
418-
gpioExpanderEnableLora();
418+
gpioExpanderLoraEnable();
419419
}
420420

421421
void loraPowerOff()
422422
{
423423
if (productVariant == RTK_TORCH)
424424
digitalWrite(pin_loraRadio_power, LOW); // Power off STM32/radio
425425
else if (productVariant == RTK_FLEX)
426-
gpioExpanderDisableLora();
426+
gpioExpanderLoraDisable();
427427
}
428428

429429
bool loraIsOn()
@@ -802,15 +802,15 @@ void loraWrite(uint8_t *data, uint16_t dataLength)
802802
if (productVariant == RTK_TORCH)
803803
Serial.write(data, dataLength);
804804
else if (productVariant == RTK_FLEX)
805-
SerialForLoRa.write(data, dataLength);
805+
SerialForLoRa->write(data, dataLength);
806806
}
807807

808808
void loraPrint(const char *data)
809809
{
810810
if (productVariant == RTK_TORCH)
811811
Serial.print(data);
812812
else if (productVariant == RTK_FLEX)
813-
SerialForLoRa.print(data);
813+
SerialForLoRa->print(data);
814814
}
815815

816816
void loraPrintf(const char *format, ...)
@@ -827,7 +827,7 @@ void loraPrintf(const char *format, ...)
827827
if (productVariant == RTK_TORCH)
828828
Serial.printf(buf);
829829
else if (productVariant == RTK_FLEX)
830-
SerialForLoRa.printf(buf);
830+
SerialForLoRa->printf(buf);
831831

832832
va_end(args);
833833
va_end(args2);
@@ -838,13 +838,19 @@ uint16_t loraAvailable()
838838
if (productVariant == RTK_TORCH)
839839
return (Serial.available());
840840
else if (productVariant == RTK_FLEX)
841-
return (SerialForLoRa.available());
841+
return (SerialForLoRa->available());
842+
843+
systemPrintln("loraAvailable - invalid ProductVariant");
844+
return 0;
842845
}
843846

844847
uint16_t loraRead()
845848
{
846849
if (productVariant == RTK_TORCH)
847850
return (Serial.read());
848851
else if (productVariant == RTK_FLEX)
849-
return (SerialForLoRa.read());
852+
return (SerialForLoRa->read());
853+
854+
systemPrintln("loraRead - invalid ProductVariant");
855+
return 0;
850856
}

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@
7979
*/
8080

8181
// While we wait for the next hardware revision, Facet Flex needs to be manually forced:
82-
#define NOT_FACET_FLEX // Comment to force support for Facet Flex
82+
//#define NOT_FACET_FLEX // Comment to force support for Facet Flex
8383

8484
// To reduce compile times, various parts of the firmware can be disabled/removed if they are not
8585
// needed during development
86-
#define COMPILE_BT // Comment out to remove Bluetooth functionality
87-
#define COMPILE_WIFI // Comment out to remove WiFi functionality
88-
#define COMPILE_ETHERNET // Comment out to remove Ethernet (W5500) support
89-
#define COMPILE_CELLULAR // Comment out to remove cellular modem support
86+
//#define COMPILE_BT // Comment out to remove Bluetooth functionality
87+
//#define COMPILE_WIFI // Comment out to remove WiFi functionality
88+
//#define COMPILE_ETHERNET // Comment out to remove Ethernet (W5500) support
89+
//#define COMPILE_CELLULAR // Comment out to remove cellular modem support
9090

9191
#ifdef COMPILE_BT
9292
#define COMPILE_AUTHENTICATION // Comment out to disable MFi authentication
@@ -98,9 +98,9 @@
9898
#endif // COMPILE_WIFI
9999

100100
#define COMPILE_LG290P // Comment out to remove LG290P functionality
101-
#define COMPILE_MOSAICX5 // Comment out to remove mosaic-X5 functionality
102-
#define COMPILE_UM980 // Comment out to remove UM980 functionality
103-
#define COMPILE_ZED // Comment out to remove ZED-F9x functionality
101+
//#define COMPILE_MOSAICX5 // Comment out to remove mosaic-X5 functionality
102+
//#define COMPILE_UM980 // Comment out to remove UM980 functionality
103+
//#define COMPILE_ZED // Comment out to remove ZED-F9x functionality
104104

105105
#ifdef COMPILE_ZED
106106
#define COMPILE_L_BAND // Comment out to remove L-Band functionality
@@ -285,14 +285,15 @@ int gpioExpander_left = 3;
285285
int gpioExpander_center = 4;
286286
int gpioExpander_cardDetect = 5;
287287

288-
int gpioExpanderSwitch_S1 = 0; // Controls U16 switch 1: connect ESP UART0 to CH342 or SW2
289-
int gpioExpanderSwitch_S2 = 1; // Controls U17 switch 2: connect SW1 to RS232 Output or GNSS UART4
290-
int gpioExpanderSwitch_S3 = 2; // Controls U18 switch 3: connect ESP UART2 to GNSS UART3 or LoRa UART2
291-
int gpioExpanderSwitch_S4 = 3; // Controls U19 switch 4: connect GNSS UART2 to 4-pin JST TTL Serial or LoRa UART0
292-
int gpioExpanderSwitch_LoraEnable = 4; // LoRa_EN
293-
int gpioExpanderSwitch_GNSS_Reset = 5; // RST_GNSS
294-
int gpioExpanderSwitch_LoraBoot = 6; // LoRa_BOOT0 - Used for bootloading the STM32 radio IC
295-
int gpioExpanderSwitch_PowerFastOff = 7; // PWRKILL
288+
const int gpioExpanderSwitch_S1 = 0; // Controls U16 switch 1: connect ESP UART0 to CH342 or SW2
289+
const int gpioExpanderSwitch_S2 = 1; // Controls U17 switch 2: connect SW1 to RS232 Output or GNSS UART4
290+
const int gpioExpanderSwitch_S3 = 2; // Controls U18 switch 3: connect ESP UART2 to GNSS UART3 or LoRa UART2
291+
const int gpioExpanderSwitch_S4 = 3; // Controls U19 switch 4: connect GNSS UART2 to 4-pin JST TTL Serial or LoRa UART0
292+
const int gpioExpanderSwitch_LoraEnable = 4; // LoRa_EN
293+
const int gpioExpanderSwitch_GNSS_Reset = 5; // RST_GNSS
294+
const int gpioExpanderSwitch_LoraBoot = 6; // LoRa_BOOT0 - Used for bootloading the STM32 radio IC
295+
const int gpioExpanderSwitch_PowerFastOff = 7; // PWRKILL
296+
const int gpioExpanderNumSwitches = gpioExpanderSwitch_PowerFastOff;
296297

297298
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
298299

Firmware/RTK_Everywhere/System.ino

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,10 @@ void beginGpioExpanderSwitches()
906906
// SW1 is on pin 0. Driving it high will disconnect the ESP32 from USB
907907
// GNSS_RST is on pin 5. Driving it low when an LG290P is connected will kill the I2C bus.
908908
// PWRKILL is on pin 7. Driving it low will turn off the system
909-
for (int i = 0; i < 8; i++)
909+
for (int i = 0; i <= gpioExpanderNumSwitches; i++)
910910
{
911911
// Set all pins to low except GNSS RESET and PWRKILL
912-
if (i == 5 || i == 7)
912+
if (i == gpioExpanderSwitch_GNSS_Reset || i == gpioExpanderSwitch_PowerFastOff)
913913
gpioExpanderSwitches->digitalWrite(i, HIGH);
914914
else
915915
gpioExpanderSwitches->digitalWrite(i, LOW);
@@ -965,13 +965,20 @@ void gpioExpanderSelectLoraCommunication()
965965
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_S4, HIGH);
966966
}
967967

968+
// Connect Flex GNSS UART2 to 4-pin JST RADIO port
969+
void gpioExpanderSelectRadioPort()
970+
{
971+
if (online.gpioExpanderSwitches == true)
972+
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_S4, LOW);
973+
}
974+
968975
// Drive GPIO pin high to enable LoRa Radio
969-
void gpioExpanderEnableLora()
976+
void gpioExpanderLoraEnable()
970977
{
971978
if (online.gpioExpanderSwitches == true)
972979
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_LoraEnable, HIGH);
973980
}
974-
void gpioExpanderDisableLora()
981+
void gpioExpanderLoraDisable()
975982
{
976983
if (online.gpioExpanderSwitches == true)
977984
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_LoraEnable, LOW);
@@ -985,12 +992,12 @@ bool gpioExpanderLoraIsOn()
985992
}
986993
return(false);
987994
}
988-
void gpioExpanderEnableLoraBoot()
995+
void gpioExpanderLoraBootEnable()
989996
{
990997
if (online.gpioExpanderSwitches == true)
991998
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_LoraBoot, HIGH);
992999
}
993-
void gpioExpanderDisableLoraBoot()
1000+
void gpioExpanderLoraBootDisable()
9941001
{
9951002
if (online.gpioExpanderSwitches == true)
9961003
gpioExpanderSwitches->digitalWrite(gpioExpanderSwitch_LoraBoot, LOW);

Firmware/RTK_Everywhere/menuMessages.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ void menuLogSelection()
33
{
44
if (present.microSd && !present.mosaicMicroSd)
55
menuLog();
6+
#ifdef COMPILE_MOSAICX5
67
if (!present.microSd && present.mosaicMicroSd)
78
menuLogMosaic();
9+
#endif
810
if (present.microSd && present.mosaicMicroSd)
911
{
1012
while (1)

0 commit comments

Comments
 (0)