I have an app that receives serial data via BT, then parses each message and updates multiple gauges/bargraphs on the UI. Problem is that the messages are coming thick and fast and making the UI fairly unresponsive to user input.
I have a flag (rxReady) which I unset on receipt of a complete message while parsing and updating the display, then set on completion. Serial_newData tests this flag and discards incoming while it is unset.
Some improvement, but the UI is still slow unless I disable the BT link.
I have also tried serial1.stoplstening and serial1.listen around the parsing/updating code, but no better.
It appears the underlying BT serial receive is still hogging processor time.
Is there a way to dynamically disable/enable serial rx or the associated asynchstreams buffering
I have a flag (rxReady) which I unset on receipt of a complete message while parsing and updating the display, then set on completion. Serial_newData tests this flag and discards incoming while it is unset.
B4X:
Sub BTin_NewData(inBuf() As Byte)
Dim i As Int
If rxReady Then
For i=0 To inBuf.Length-1
parse_rdac(inBuf(i))
Next
End If
End Sub
Some improvement, but the UI is still slow unless I disable the BT link.
I have also tried serial1.stoplstening and serial1.listen around the parsing/updating code, but no better.
It appears the underlying BT serial receive is still hogging processor time.
Is there a way to dynamically disable/enable serial rx or the associated asynchstreams buffering