@@ -14,11 +14,11 @@ void F9PSerialWriteTask(void *e)
1414 {
1515 // Pass bytes to GNSS receiver
1616 int s = bluetoothReadBytes (wBuffer, sizeof (wBuffer));
17-
17+
1818 // TODO - control if this RTCM source should be listened to or not
1919 serialGNSS.write (wBuffer, s);
2020 bluetoothIncomingRTCM = true ;
21- if (!inMainMenu) log_d (" Bluetooth received %d RTCM bytes, sent to ZED" , s);
21+ if (!inMainMenu) log_d (" Bluetooth received %d RTCM bytes, sent to ZED" , s);
2222
2323 if (settings.enableTaskReports == true )
2424 Serial.printf (" SerialWriteTask High watermark: %d\n\r " , uxTaskGetStackHighWaterMark (NULL ));
@@ -170,34 +170,17 @@ void F9PSerialReadTask(void *e)
170170 if ((btTail + btBytesToSend) >= sizeof (rBuffer))
171171 btBytesToSend = sizeof (rBuffer) - btTail;
172172
173- if ((bluetoothIsCongested () == false ) || (settings.throttleDuringSPPCongestion == false ))
173+ // Push new data to BT SPP if not congested or not throttling
174+ btBytesToSend = bluetoothWriteBytes (&rBuffer[btTail], btBytesToSend);
175+ if (btBytesToSend > 0 )
174176 {
175- // Push new data to BT SPP if not congested or not throttling
176- btBytesToSend = bluetoothWriteBytes (&rBuffer[btTail], btBytesToSend);
177- if (btBytesToSend > 0 )
178- {
179- // If we are in base mode, assume part of the outgoing data is RTCM
180- if (systemState >= STATE_BASE_NOT_STARTED && systemState <= STATE_BASE_FIXED_TRANSMITTING)
181- bluetoothOutgoingRTCM = true ;
182- }
183- else
184- log_w (" BT failed to send" );
177+ // If we are in base mode, assume part of the outgoing data is RTCM
178+ if (systemState >= STATE_BASE_NOT_STARTED && systemState <= STATE_BASE_FIXED_TRANSMITTING)
179+ bluetoothOutgoingRTCM = true ;
185180 }
186181 else
187- {
188- // Don't push data to BT SPP if there is congestion to prevent heap hits.
189- if (btBytesToSend >= (sizeof (rBuffer) - 1 ))
190- {
191- // Error - no more room in the buffer, drop a buffer's worth of data
192- btTail = dataHead;
193- Serial.printf (" ERROR - BT congestion dropped %d bytes: GNSS --> Bluetooth\r\n " , btBytesToSend);
194- }
195- else
196- {
197- log_w (" BT congestion delayed %d bytes, Tasks.ino line %d" , btBytesToSend, __LINE__);
198- btBytesToSend = 0 ;
199- }
200- }
182+ log_w (" BT failed to send" );
183+
201184
202185 // Account for the sent or dropped data
203186 btTail += btBytesToSend;
0 commit comments