@@ -77,7 +77,6 @@ void identifyBoard()
77
77
// First, test for devices that do not have ID resistors
78
78
if (productVariant == RTK_UNKNOWN)
79
79
{
80
- // Torch
81
80
// Check if unique ICs are on the I2C bus
82
81
if (i2c_0 == nullptr )
83
82
i2c_0 = new TwoWire (0 );
@@ -95,30 +94,26 @@ void identifyBoard()
95
94
// 0x08 - HUSB238 - USB C PD Sink Controller
96
95
bool husb238Present = i2cIsDevicePresent (i2c_0, 0x08 );
97
96
98
- // Flex has everything a Torch does and a display
99
- // 0x3C - SSD1306 OLED Driver
100
- // If a display is present, it's not a Torch
101
- // bool displayPresent = i2cIsDevicePresent(i2c_0, 0x3C);
102
- bool displayPresent = i2cIsDevicePresent (i2c_0, 0x10 );
97
+ // 0x10 -MFI343S00177 Authentication Coprocessor
98
+ bool mfiPresent = i2cIsDevicePresent (i2c_0, 0x10 );
103
99
104
100
i2c_0->end ();
105
101
106
- // Proceed with Torch ID only if display is absent
107
- if (displayPresent == false )
102
+ // Proceed with Torch ID only if MFi is absent (Torch X2 has MFi, and ID resistors)
103
+ if (mfiPresent == false )
108
104
{
109
105
if (bq40z50Present || mp2762aPresent || husb238Present)
110
106
{
111
107
productVariant = RTK_TORCH;
112
- }
113
-
114
- if (productVariant == RTK_TORCH && bq40z50Present == false )
115
- systemPrintln (" Error: Torch ID'd with no BQ40Z50 present" );
108
+ if (bq40z50Present == false )
109
+ systemPrintln (" Error: Torch ID'd with no BQ40Z50 present" );
116
110
117
- if (productVariant == RTK_TORCH && mp2762aPresent == false )
118
- systemPrintln (" Error: Torch ID'd with no MP2762A present" );
111
+ if ( mp2762aPresent == false )
112
+ systemPrintln (" Error: Torch ID'd with no MP2762A present" );
119
113
120
- if (productVariant == RTK_TORCH && husb238Present == false )
121
- systemPrintln (" Error: Torch ID'd with no HUSB238 present" );
114
+ if (husb238Present == false )
115
+ systemPrintln (" Error: Torch ID'd with no HUSB238 present" );
116
+ }
122
117
}
123
118
}
124
119
@@ -159,11 +154,20 @@ void identifyBoard()
159
154
// Postcard: 3.3/10 --> 2371mV < 2481mV < 2582mV (8.5% tolerance)
160
155
else if (idWithAdc (idValue, 3.3 , 10 , 8.5 ))
161
156
productVariant = RTK_POSTCARD;
162
-
157
+
158
+ // Torch X2: 8.2/3.3 --> 836mV < 947mV < 1067mV (8.5% tolerance)
159
+ else if (idWithAdc (idValue, 8.2 , 3.3 , 8.5 ))
160
+ productVariant = RTK_TORCH_X2;
161
+
163
162
#ifndef NOT_FACET_FLEX
164
163
systemPrintln (" <<<<<<<<<< !!!!!!!!!! FLEX FORCED !!!!!!!!!! >>>>>>>>>>" );
165
164
productVariant = RTK_FLEX; // TODO remove once v1.1 Flex has ID resistors
166
165
#endif
166
+
167
+ #ifndef NOT_TORCH_X2
168
+ systemPrintln (" <<<<<<<<<< !!!!!!!!!! TORCH X2 FORCED !!!!!!!!!! >>>>>>>>>>" );
169
+ productVariant = RTK_TORCH_X2; // TODO remove once v1.1 Torch X2 has ID resistors
170
+ #endif
167
171
}
168
172
169
173
if (ENABLE_DEVELOPER)
@@ -722,7 +726,7 @@ void beginBoard()
722
726
present.fuelgauge_max17048 = true ;
723
727
present.display_i2c0 = true ;
724
728
present.i2c0BusSpeed_400 = true ; // Run display bus at higher speed
725
- present.i2c1 = true ; // Qwiic bus
729
+ present.i2c1 = true ; // Qwiic bus
726
730
present.display_type = DISPLAY_128x64;
727
731
present.microSd = true ;
728
732
present.gpioExpanderButtons = true ;
@@ -849,6 +853,91 @@ void beginBoard()
849
853
850
854
// GNSS receiver type is determined later in gnssDetectReceiverType()
851
855
}
856
+
857
+ else if (productVariant == RTK_TORCH_X2)
858
+ {
859
+ // Specify the GNSS radio
860
+ #ifdef COMPILE_LG290P
861
+ gnss = (GNSS *)new GNSS_LG290P ();
862
+ #else // COMPILE_UM980
863
+ gnss = (GNSS *)new GNSS_None ();
864
+ systemPrintln (" <<<<<<<<<< !!!!!!!!!! LG290P NOT COMPILED !!!!!!!!!! >>>>>>>>>>" );
865
+ #endif // COMPILE_UM980
866
+
867
+ present.brand = BRAND_SPARKPNT;
868
+ present.psram_2mb = true ;
869
+ present.gnss_lg290p = true ;
870
+ present.antennaPhaseCenter_mm = 116.5 ; // Default to Torch helical APC, average of L1/L2
871
+ present.fuelgauge_bq40z50 = true ;
872
+ present.charger_mp2762a = true ;
873
+ present.button_powerHigh = true ; // Button is pressed when high
874
+ present.beeper = true ;
875
+ present.gnss_to_uart = true ;
876
+ present.needsExternalPpl = true ; // Uses the PointPerfect Library
877
+
878
+ // We can't enable GNSS features here because we don't know if lg290pFirmwareVersion is >= v05
879
+ // present.minElevation = true;
880
+ // present.minCno = true;
881
+
882
+ pin_I2C0_SDA = 15 ;
883
+ pin_I2C0_SCL = 4 ;
884
+
885
+ pin_GnssUart_RX = 14 ; // Torch X2 uses UART2 of ESP32 to communicate with LG290P
886
+ pin_GnssUart_TX = 17 ;
887
+ pin_GNSS_DR_Reset = 22 ; // Push low to reset GNSS/DR.
888
+
889
+ pin_GNSS_TimePulse = 39 ; // PPS on UM980
890
+
891
+ pin_muxB = 12 ;
892
+ pin_usbSelect = 12 ; // Controls U18 switch between ESP UART0 to USB or GNSS UART1
893
+ pin_powerAdapterDetect = 36 ; // Goes low when USB cable is plugged in
894
+
895
+ pin_batteryStatusLED = 0 ;
896
+ pin_bluetoothStatusLED = 32 ;
897
+ pin_gnssStatusLED = 13 ;
898
+
899
+ pin_beeper = 33 ;
900
+
901
+ pin_powerButton = 34 ;
902
+ pin_powerSenseAndControl = 18 ; // PWRKILL
903
+
904
+ pin_loraRadio_power = 19 ; // LoRa_EN
905
+ // pin_loraRadio_boot = 23; // LoRa_BOOT0
906
+ // pin_loraRadio_reset = 5; // LoRa_NRST
907
+
908
+ DMW_if systemPrintf (" pin_bluetoothStatusLED: %d\r\n " , pin_bluetoothStatusLED);
909
+ pinMode (pin_bluetoothStatusLED, OUTPUT);
910
+
911
+ DMW_if systemPrintf (" pin_gnssStatusLED: %d\r\n " , pin_gnssStatusLED);
912
+ pinMode (pin_gnssStatusLED, OUTPUT);
913
+
914
+ DMW_if systemPrintf (" pin_batteryStatusLED: %d\r\n " , pin_batteryStatusLED);
915
+ pinMode (pin_batteryStatusLED, OUTPUT);
916
+
917
+ // Turn on Bluetooth, GNSS, and Battery LEDs to indicate power on
918
+ bluetoothLedOn ();
919
+ gnssStatusLedOn ();
920
+ batteryStatusLedOn ();
921
+
922
+ pinMode (pin_beeper, OUTPUT);
923
+ beepOff ();
924
+
925
+ pinMode (pin_powerButton, INPUT);
926
+
927
+ pinMode (pin_GNSS_TimePulse, INPUT);
928
+
929
+ pinMode (pin_GNSS_DR_Reset, OUTPUT);
930
+ gnssBoot (); // Tell GNSS to boot
931
+
932
+ pinMode (pin_powerAdapterDetect, INPUT); // Has 10k pullup
933
+
934
+ pinMode (pin_usbSelect, OUTPUT);
935
+ digitalWrite (pin_usbSelect, LOW); // Keep ESP32 connected to CH342 (not GNSS UART1)
936
+
937
+ // LoRa not mounted in X2, but power down to be sure
938
+ pinMode (pin_loraRadio_power, OUTPUT);
939
+ loraPowerOff (); // Keep LoRa powered down for now
940
+ }
852
941
}
853
942
854
943
void beginVersion ()
@@ -1137,7 +1226,7 @@ void forceGnssCommunicationRate(uint32_t &platformGnssCommunicationRate)
1137
1226
// Override user setting. Required because beginGnssUart() is called before beginBoard().
1138
1227
platformGnssCommunicationRate = 115200 ;
1139
1228
}
1140
- else if (productVariant == RTK_POSTCARD)
1229
+ else if (productVariant == RTK_POSTCARD || productVariant == RTK_TORCH_X2 )
1141
1230
{
1142
1231
// LG290P communicates at 460800bps.
1143
1232
platformGnssCommunicationRate = 115200 * 4 ;
@@ -1553,6 +1642,14 @@ void beginSystemState()
1553
1642
if (systemState == STATE_BASE_NOT_STARTED)
1554
1643
firstRoverStart = false ;
1555
1644
}
1645
+ else if (productVariant == RTK_TORCH_X2)
1646
+ {
1647
+ // Do not allow user to enter test screen during first rover start because there is no screen
1648
+ firstRoverStart = false ;
1649
+
1650
+ // Return to either Base or Rover Not Started. The last state previous to power down.
1651
+ systemState = settings.lastState ;
1652
+ }
1556
1653
else
1557
1654
{
1558
1655
systemPrintf (" beginSystemState: Unknown product variant: %d\r\n " , productVariant);
@@ -1736,13 +1833,15 @@ bool i2cBusInitialization(TwoWire *i2cBus, int sda, int scl, int clockKHz)
1736
1833
break ;
1737
1834
}
1738
1835
1739
- case 0x10 : {
1836
+ case 0x10 :
1837
+ {
1740
1838
systemPrintf (" 0x%02X - MFI343S00177 Authentication Coprocessor\r\n " , addr);
1741
1839
i2cAuthCoPro = i2cBus; // Record the bus
1742
1840
break ;
1743
1841
}
1744
1842
1745
- case 0x18 : {
1843
+ case 0x18 :
1844
+ {
1746
1845
systemPrintf (" 0x%02X - PCA9557 GPIO Expander with Reset\r\n " , addr);
1747
1846
break ;
1748
1847
}
0 commit comments