Android Question BT serial/admin- how to disable/enable?

sparxfly

Member
Licensed User
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.
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
 

sparxfly

Member
Licensed User
Belay that post....I have confirmed the issue is NOT the underlying serial comms rx, but the display updating in response to the incoming.
 
Upvote 0

sparxfly

Member
Licensed User
All sorted- I was updating so frequently the display had no idle time to respond.
I put in a timer to pace processing the received data and all is good.
 
Upvote 0
Top