Skip to content

Commit 3673d34

Browse files
committed
Set serial communication speed based on platform
The Postcard can modify its dataPortBaud (2nd port on CH342) independent of the UART2 comm with the ESP32. This allows the platform to set the
1 parent 0fd641f commit 3673d34

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,6 @@ void pinGnssUartTask(void *pvParameters)
10271027
if (settings.printTaskStartStop)
10281028
systemPrintln("Task pinGnssUartTask started");
10291029

1030-
if (productVariant == RTK_TORCH)
1031-
{
1032-
// Override user setting. Required because beginGnssUart() is called before beginBoard().
1033-
settings.dataPortBaud = 115200;
1034-
}
1035-
10361030
if (serialGNSS == nullptr)
10371031
serialGNSS = new HardwareSerial(2); // Use UART2 on the ESP32 for communication with the GNSS module
10381032

@@ -1042,9 +1036,24 @@ void pinGnssUartTask(void *pvParameters)
10421036
if (pin_GnssUart_RX == -1 || pin_GnssUart_TX == -1)
10431037
reportFatalError("Illegal UART pin assignment.");
10441038

1045-
serialGNSS->begin(settings.dataPortBaud, SERIAL_8N1, pin_GnssUart_RX,
1046-
pin_GnssUart_TX); // Start UART on platform depedent pins for SPP. The GNSS will be configured
1047-
// to output NMEA over its UART at the same rate.
1039+
uint32_t platformGnssCommunicationRate =
1040+
settings.dataPortBaud; // Default to 230400bps for ZED. This limits GNSS fixes at 4Hz but allows SD buffer to be
1041+
// reduced to 6k.
1042+
1043+
if (productVariant == RTK_TORCH)
1044+
{
1045+
// Override user setting. Required because beginGnssUart() is called before beginBoard().
1046+
platformGnssCommunicationRate = 115200;
1047+
}
1048+
else if (productVariant == RTK_POSTCARD)
1049+
{
1050+
// LG290P communicates at 460800bps.
1051+
platformGnssCommunicationRate = 115200 * 4;
1052+
}
1053+
1054+
serialGNSS->begin(platformGnssCommunicationRate, SERIAL_8N1, pin_GnssUart_RX,
1055+
pin_GnssUart_TX); // Start UART on platform dependent pins for SPP. The GNSS will be
1056+
// configured to output NMEA over its UART at the same rate.
10481057

10491058
// Reduce threshold value above which RX FIFO full interrupt is generated
10501059
// Allows more time between when the UART interrupt occurs and when the FIFO buffer overruns

0 commit comments

Comments
 (0)