-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo: Transmitting audio to the radio over RFCOMM #5
base: demo/audiorx_demo_unescape
Are you sure you want to change the base?
Demo: Transmitting audio to the radio over RFCOMM #5
Conversation
Very cool!! Not in a position to test it atm but will soon! I don't think that's a PTT release command -- looks to me like a READ_STATUS (power status, that is), checking the battery voltage. Structure is: 0xff -- start flag The HT app is constantly spamming these voltage requests (and setting the device GPS position, etc). See https://github.com/khusmann/benlink/blob/main/src/benlink/internal/protocol/gaia_frame.py for more info on how these serial commands are put together. (Over serial the command Messages are wrapped in gaia frames) In my btsnoop logs I don't see any time gap between the end of the sbc frame and the ending {0x7e, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e} command... weird we have to delay. So maybe a buffering issue like you say? maybe try Or maybe a firmware issue -- perhaps the 0x7e ... 0x7e is supposed to toggle the PTT, but doesn't, and then the other read request just knocks it out of the bad state. I remember hearing folks complaining that in one firmware the device got stuck in transmit while transmitting in KISS -- could be because the continual spam of voltage requests by the app always acted as a PTT release. What firmware are you running? Does {0x7e, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e} activate the PTT? Or do you need to start sending sbc data for transmit to go in transmit mode? |
Ok, just tried it out and it runs beautifully! I discovered that it works just fine without sending any commands on the command channel -- Here's the results of a bunch of conditions:
(none of these involved sending anything on the cmd channel) So it looks like you can send the InitMsg before or after the sbc clip, and then delay before closing the socket and it doesn't hang? Lmk if you get the same or different results with your device / env... |
D'oh, I misunderstood the command structure and figured it's a command you haven't implemented it yet. You're right, just the delay before a socket close works well. I also found that a delay before sending the init command also works without closing the socket. I still wonder why the delays are necessary. I tried playing with waiting for the socket to drain and flushing it, but no luck. I'm on the latest firmware (7.15) |
Hmm really? Weird -- on my system I don't need any delays on the init command (socket can stay open). Tx only hangs if 1) socket closes too soon or 2) no init command is sent (and it can go before or after the audio clip) -- the only timing problem I'm seeing is the socket closing too soon. |
I've just pushed the test case I'm really curious about -- with that setup it unkeys the PTT just fine on my end, leaving the socket still open... Does it get stuck in tx on yours? Edit: One more variable I just thought of -- how long is the tx you're sending? Mine is about 4s. |
As promised, here's the TX demo. I hope the code speaks for itself, it's fairly straightforward.
The only real problems I had were with the timing of TX, especially the PTT release command. If the command gets sent immediately after the end of audio transmission, the radio gets stuck in transmit. I wonder if this has anything to do with frame buffering and reordering in my laptop's BT driver. In other words, this delay might be necessary on my machine but might not be on others, and it might need to be a different length. If it is related to buffering, maybe there's a way to manually flush the buffers?