Skip to content

Commit a647e0e

Browse files
committed
Add Flex v1.1 support for LG290P
1 parent 66d86d4 commit a647e0e

File tree

4 files changed

+39
-31
lines changed

4 files changed

+39
-31
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ void identifyBoard()
158158
// Torch X2: 8.2/3.3 --> 836mV < 947mV < 1067mV (8.5% tolerance)
159159
else if (idWithAdc(idValue, 8.2, 3.3, 8.5))
160160
productVariant = RTK_TORCH_X2;
161-
162-
#ifdef FLEX_OVERRIDE
163-
systemPrintln("<<<<<<<<<< !!!!!!!!!! FLEX OVERRIDE !!!!!!!!!! >>>>>>>>>>");
164-
productVariant = RTK_FLEX; // TODO remove once v1.1 Flex has ID resistors
165-
#endif
166161
}
167162

168163
if (ENABLE_DEVELOPER)
@@ -777,7 +772,6 @@ void beginBoard()
777772
present.antennaPhaseCenter_mm = 62.0; // APC from drawings
778773
present.radio_lora = true;
779774
present.fuelgauge_bq40z50 = true;
780-
present.charger_mp2762a = true;
781775

782776
present.button_powerLow = true; // Button is pressed when high
783777
present.button_mode = true;
@@ -1526,6 +1520,12 @@ void beginButtons()
15261520
buttonCount++;
15271521
if (present.gpioExpanderButtons == true)
15281522
buttonCount++;
1523+
if (productVariant == RTK_FLEX)
1524+
{
1525+
Serial.println("<<<<<<<<<<<<<<<<<<<< Deal with Flex buttons >>>>>>>>>>>>>>");
1526+
buttonCount = 1;
1527+
}
1528+
15291529
if (buttonCount > 1)
15301530
reportFatalError("Illegal button assignment.");
15311531

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,6 @@ void gnssDetectReceiverType()
558558

559559
gnssBoot(); // Tell GNSS to run
560560

561-
// TODO remove after testing, force retest on each boot
562-
// Note: with this in place, the X5 detection will take a lot longer due to the baud rate change
563-
#ifdef FLEX_OVERRIDE
564-
systemPrintln("<<<<<<<<<< !!!!!!!!!! FLEX FORCED !!!!!!!!!! >>>>>>>>>>");
565-
// settings.detectedGnssReceiver = GNSS_RECEIVER_UNKNOWN; // This may be causing weirdness on the LG290P.
566-
// Commenting for now
567-
#endif
568-
569561
// Start auto-detect if NVM is not yet set
570562
if (settings.detectedGnssReceiver == GNSS_RECEIVER_UNKNOWN)
571563
{
@@ -574,7 +566,8 @@ void gnssDetectReceiverType()
574566
do
575567
{
576568
#ifdef COMPILE_LG290P
577-
if (lg290pIsPresent() == true)
569+
systemPrintln("Testing for LG290P");
570+
if (lg290pIsPresentOnFlex() == true)
578571
{
579572
systemPrintln("Auto-detected GNSS receiver: LG290P");
580573
settings.detectedGnssReceiver = GNSS_RECEIVER_LG290P;
@@ -586,6 +579,7 @@ void gnssDetectReceiverType()
586579
#endif // COMPILE_LGP290P
587580

588581
#ifdef COMPILE_MOSAICX5
582+
systemPrintln("Testing for mosaic-X5");
589583
if (mosaicIsPresentOnFlex() == true) // Note: this changes the COM1 baud from 115200 to 460800
590584
{
591585
systemPrintln("Auto-detected GNSS receiver: mosaic-X5");

Firmware/RTK_Everywhere/GNSS_LG290P.ino

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -668,16 +668,21 @@ uint32_t GNSS_LG290P::getDataBaudRate()
668668
// This is nicknamed the DATA port
669669
dataUart = 1;
670670
}
671+
else if (productVariant == RTK_FLEX)
672+
{
673+
// On the Flex, the DATA connector is not connected to the GNSS
674+
// Return 0.
675+
return (0);
676+
}
671677
else if (productVariant == RTK_TORCH_X2)
672678
{
673679
// UART3 of the LG290P is connected to USB CH342 (Port A)
674680
// This is nicknamed the DATA port
675681
dataUart = 3;
676682
}
677683
else
678-
{
679684
systemPrintln("getDataBaudRate: Uncaught platform");
680-
}
685+
681686
return (getBaudRate(dataUart));
682687
}
683688

@@ -700,20 +705,20 @@ bool GNSS_LG290P::setBaudRateData(uint32_t baud)
700705
// This is nicknamed the DATA port
701706
return (setBaudRate(1, baud));
702707
}
703-
else if (productVariant == RTK_TORCH_X2)
708+
else if (productVariant == RTK_FLEX)
704709
{
705-
if (getDataBaudRate() != baud)
706-
{
707-
// UART3 of the LG290P is connected to USB CH342 (Port A)
708-
// This is nicknamed the DATA port
709-
return (setBaudRate(3, baud));
710-
}
710+
// On the Flex, the DATA connector is not connected to the GNSS
711+
// Return true so that configuration can proceed.
712+
return (true);
711713
}
712-
else
714+
else if (productVariant == RTK_TORCH_X2)
713715
{
714-
// On products that don't have a DATA port (Flex), act as if we have set the baud successfully
715-
return (true);
716+
// UART3 of the LG290P is connected to USB CH342 (Port A)
717+
// This is nicknamed the DATA port
718+
return (setBaudRate(3, baud));
716719
}
720+
else
721+
systemPrintln("setDataBaudRate: Uncaught platform");
717722
}
718723
}
719724
return (false);
@@ -741,6 +746,9 @@ uint32_t GNSS_LG290P::getRadioBaudRate()
741746
// Not really used at this time but available for configuration
742747
radioUart = 1;
743748
}
749+
else
750+
systemPrintln("getDataBaudRate: Uncaught platform");
751+
744752
return (getBaudRate(radioUart));
745753
}
746754

@@ -774,6 +782,9 @@ bool GNSS_LG290P::setBaudRateRadio(uint32_t baud)
774782
// Not really used at this time but available for configuration
775783
radioUart = 1;
776784
}
785+
else
786+
systemPrintln("setBaudRateRadio: Uncaught platform");
787+
777788
return (setBaudRate(radioUart, baud));
778789
}
779790
}
@@ -1781,6 +1792,9 @@ bool GNSS_LG290P::setBaudRateComm(uint32_t baud)
17811792
// UART1 of the LG290P is connected to the ESP32 for the main config/comm
17821793
commUart = 1;
17831794
}
1795+
else
1796+
systemPrintln("setBaudRateComm: Uncaught platform");
1797+
17841798
return (setBaudRate(commUart, baud));
17851799
}
17861800
}
@@ -1803,6 +1817,9 @@ uint32_t GNSS_LG290P::getCommBaudRate()
18031817
// On the Flex, the ESP32 UART1 is connected to LG290P UART1
18041818
commUart = 1;
18051819
}
1820+
else
1821+
systemPrintln("getCommBaudRate: Uncaught platform");
1822+
18061823
return (getBaudRate(commUart));
18071824
}
18081825

@@ -2630,7 +2647,7 @@ bool lg290pMessageEnabled(char *nmeaSentence, int sentenceLength)
26302647
}
26312648

26322649
// Return true if we detect this receiver type
2633-
bool lg290pIsPresent()
2650+
bool lg290pIsPresentOnFlex()
26342651
{
26352652
// Locally instantiate the hardware and library so it will release on exit
26362653

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
7979
*/
8080

81-
// While we wait for the next hardware revisions, Flex and Torch can be manually enabled:
82-
//#define FLEX_OVERRIDE // Uncomment to force support for Flex
83-
8481
// To reduce compile times, various parts of the firmware can be disabled/removed if they are not
8582
// needed during development
8683
#define COMPILE_BT // Comment out to remove Bluetooth functionality

0 commit comments

Comments
 (0)