Skip to content

Commit 6a190c2

Browse files
committed
Make power button work. Detect CoAuth if it's alone on the bus.
1 parent dc746fb commit 6a190c2

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void identifyBoard()
9494
// 0x08 - HUSB238 - USB C PD Sink Controller
9595
bool husb238Present = i2cIsDevicePresent(i2c_0, 0x08);
9696

97-
// 0x10 -MFI343S00177 Authentication Coprocessor
97+
// 0x10 - MFI343S00177 Authentication Coprocessor
9898
bool mfiPresent = i2cIsDevicePresent(i2c_0, 0x10);
9999

100100
i2c_0->end();
@@ -447,7 +447,6 @@ void beginBoard()
447447
// Facet V2 is based on the ESP32-WROVER
448448
// ZED-F9P is interfaced via I2C and UART1
449449
// NEO-D9S is interfaced via I2C. UART2 TX is also connected to ESP32 pin 4
450-
// TODO: pass PMP over serial to save I2C traffic?
451450

452451
// Specify the GNSS radio
453452
#ifdef COMPILE_ZED
@@ -872,6 +871,8 @@ void beginBoard()
872871
present.beeper = true;
873872
present.gnss_to_uart = true;
874873
present.needsExternalPpl = true; // Uses the PointPerfect Library
874+
present.fastPowerOff = true;
875+
present.invertedFastPowerOff = true; // Driving PWRKILL high will cause powerdown
875876

876877
// We can't enable GNSS features here because we don't know if lg290pFirmwareVersion is >= v05
877878
// present.minElevation = true;
@@ -884,7 +885,7 @@ void beginBoard()
884885
pin_GnssUart_TX = 17;
885886
pin_GNSS_DR_Reset = 22; // Push low to reset GNSS/DR.
886887

887-
pin_GNSS_TimePulse = 39; // PPS on UM980
888+
pin_GNSS_TimePulse = 39; // PPS on LG290P
888889

889890
pin_usbSelect = 12; // Controls U18 switch between ESP UART0 to USB or GNSS UART1
890891
pin_powerAdapterDetect = 36; // Goes low when USB cable is plugged in
@@ -896,12 +897,14 @@ void beginBoard()
896897
pin_beeper = 33;
897898

898899
pin_powerButton = 34;
899-
// pin_powerSenseAndControl = 18; // PWRKILL
900+
pin_powerFastOff = 18; // PWRKILL
900901

901902
pin_loraRadio_power = 19; // LoRa_EN
902903
// pin_loraRadio_boot = 23; // LoRa_BOOT0
903904
// pin_loraRadio_reset = 5; // LoRa_NRST
904905

906+
pinMode(pin_powerFastOff, INPUT); // Leave this as an input. powerDown() will drive high for fast power off
907+
905908
DMW_if systemPrintf("pin_bluetoothStatusLED: %d\r\n", pin_bluetoothStatusLED);
906909
pinMode(pin_bluetoothStatusLED, OUTPUT);
907910

@@ -1808,6 +1811,12 @@ bool i2cBusInitialization(TwoWire *i2cBus, int sda, int scl, int clockKHz)
18081811
// SDA/VCC shorted: 1000ms, response 5
18091812
// SDA/GND shorted: 14ms, response 5
18101813
timer = millis();
1814+
1815+
// If there is nothing else on the bus, the authentication coprocessor can be asleep
1816+
// Ping it twice to be sure
1817+
if (addr == 0x10)
1818+
i2cIsDevicePresent(i2cBus, addr); // Throw away result. Just wake it up.
1819+
18111820
if (i2cIsDevicePresent(i2cBus, addr))
18121821
{
18131822
if (deviceFound == false)

Firmware/RTK_Everywhere/menuMessages.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,9 +809,13 @@ void checkGNSSArrayDefaults()
809809
#ifdef COMPILE_LG290P
810810
else if (present.gnss_lg290p)
811811
{
812+
// This setting is not supported on the Torch X2 nor is it in the command array
813+
// so it does not get used nor recorded to NVM leading to the defaults being
814+
// applied at every boot.
812815
if (settings.enableExtCorrRadio == 254)
813816
{
814-
defaultsApplied = true;
817+
if(productVariant != RTK_TORCH_X2) // Prevent defaults from being applied if this *is* a Torch X2
818+
defaultsApplied = true;
815819
settings.enableExtCorrRadio = false;
816820
}
817821

Firmware/RTK_Everywhere/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,13 +1779,13 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
17791779
// i d i v V i c n r e X
17801780
// g s x k 2 c h d d x 2 Type Qual Variable Name afterSetCmd
17811781

1782-
// UM980 GNSS Receiver - TODO these apply to more than UM980
17831782
{ 1, 1, 0, 0, 0, 0, 1, 0, 1, HAS, 1, _bool, 0, & settings.enableGalileoHas, "enableGalileoHas", nullptr, },
17841783
{ 1, 1, 0, 0, 0, 0, 1, 0, 0, ALL, 0, _bool, 3, & settings.enableMultipathMitigation, "enableMultipathMitigation", nullptr, },
17851784
{ 0, 0, 0, 0, 0, 0, 1, 0, 0, ALL, 0, _bool, 0, & settings.enableImuCompensationDebug, "enableImuCompensationDebug", nullptr, },
17861785
{ 0, 0, 0, 0, 0, 0, 1, 0, 0, ALL, 0, _bool, 0, & settings.enableImuDebug, "enableImuDebug", nullptr, },
17871786
{ 1, 1, 0, 0, 0, 0, 1, 0, 0, ALL, 0, _bool, 0, & settings.enableTiltCompensation, "enableTiltCompensation", nullptr, },
17881787

1788+
// UM980 GNSS Receiver
17891789
#ifdef COMPILE_UM980
17901790
{ 1, 1, 1, 0, 0, 0, 1, 0, 0, U98, 0, tUmConst, MAX_UM980_CONSTELLATIONS, & settings.um980Constellations, "constellation_", gnssCmdUpdateConstellations, },
17911791
{ 0, 1, 1, 0, 0, 0, 1, 0, 0, U98, 0, tUmMRNmea, MAX_UM980_NMEA_MSG, & settings.um980MessageRatesNMEA, "messageRateNMEA_", gnssCmdUpdateMessageRates, },

0 commit comments

Comments
 (0)