Skip to content

Commit 2021f64

Browse files
committed
Write incoming Bluetooth data over I2C to avoid UART2 corruptions
See issue 469
1 parent 3202cc5 commit 2021f64

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ void btReadTask(void *e)
3939
{
4040
// Ignore this escape character, passing along to output
4141
if (USE_I2C_GNSS)
42-
serialGNSS.write(incoming);
42+
{
43+
// serialGNSS.write(incoming);
44+
theGNSS.pushRawData(&incoming, 1);
45+
}
4346
else
4447
theGNSS.pushRawData(&incoming, 1);
4548
}
@@ -50,7 +53,11 @@ void btReadTask(void *e)
5053
while (btEscapeCharsReceived-- > 0)
5154
{
5255
if (USE_I2C_GNSS)
53-
serialGNSS.write(btEscapeCharacter);
56+
{
57+
// serialGNSS.write(btEscapeCharacter);
58+
uint8_t escChar = btEscapeCharacter;
59+
theGNSS.pushRawData(&escChar, 1);
60+
}
5461
else
5562
{
5663
uint8_t escChar = btEscapeCharacter;
@@ -61,7 +68,12 @@ void btReadTask(void *e)
6168
// Pass byte to GNSS receiver or to system
6269
// TODO - control if this RTCM source should be listened to or not
6370
if (USE_I2C_GNSS)
64-
serialGNSS.write(incoming);
71+
{
72+
// UART RX can be corrupted by UART TX
73+
// See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/469
74+
// serialGNSS.write(incoming);
75+
theGNSS.pushRawData(&incoming, 1);
76+
}
6577
else
6678
theGNSS.pushRawData(&incoming, 1);
6779

0 commit comments

Comments
 (0)