ge0rg / aprsdroid

APRSdroid - Geo-Location for Radio Amateurs
https://aprsdroid.org/
GNU General Public License v2.0
484 stars 95 forks source link

PTT by RTS or CAT? #324

Open yeti7 opened 2 years ago

yeti7 commented 2 years ago

Hi, I'm Denis (K0TX) - a ham behind digirig project. The interface's sound card works with APRSDrooid, but there is also a serial COM port that allows PTT by RTS signal or CAT with the capable radios. My question is if it would be possible to modify the code to allow these additional more reliable PTT methods?

skuep commented 1 year ago

A +1 from me as well... As far as I know, android has support at least for CDC ACM USB serial ports, but FTDI should work too!

adamadam78 commented 1 year ago

I would just like to +1 this as well. It would be great to use aprsdroid without VOX.

Fallenstedt commented 1 year ago

+1 As well. If we could be pointed in the right direction I would love to help make this a reality.

dwalthermsft commented 1 year ago

+1 Just got my digirig and can now use my old Yaesu FT-60 as an APRS device with my Samsung Galaxy. Having to key the transmit manually is goofy when the digirig is exposing a COM port for PTT. Not sure if this is helpful, but the SoundModem software on Windows simply requires the PTT port to be selected and is able to key for APRS transmissions. Not sure if this is as simple to implement on Android but maybe it is?

sparkiesweden commented 1 year ago

+1

barryshaffer commented 1 year ago

+1

charlieb commented 1 year ago

I would be very happy to try and actually make this change if someone can point me in the right direction.

barryshaffer commented 1 year ago

there 13 A pretty good write up in THE Read me file in the code repository. I've done some android dev work using the standard IDE but this app was written in SCALA which I haven't dug into.

charlieb commented 1 year ago

@barryshaffer Can you link me the write up you're talking about. I'm probably being dense but I can't find it.

My naive guess is that we'd want to inherit from this object https://github.com/ge0rg/aprsdroid/blob/master/src/backend/AfskUploader.scala#L66 and just wrap this one call in PTT on, PTT off. I'm sure there's a lot more housekeeping that would need to be done but in the spirit of ignorant hubris, it doesn't look that hard.

barryshaffer commented 1 year ago

Here’s the read me: https://github.com/ge0rg/aprsdroid#readme

I do tend to agree with you that the solution should be fairly straightforward. However, I don’t have a scala environment set up to give it a try.

charlieb commented 1 year ago

I compiled and ran it with android studio out of the box. Nothing external needed for adding scala.

ge0rg commented 1 year ago

Denis kindly sent me a digirig adapter that's currently on its way. From a practical point of view, @charlieb you are right, except for the housekeeping:

  1. you need to know when to use USB RTS, probably based on the vendor+device ID of the adapter or based on a setting value
  2. you need to connect via USB serial, which means you have to follow Android's USB attachment callbacks in the beginning, like done in https://github.com/ge0rg/aprsdroid/blob/master/src/backend/UsbTnc.scala#L55
  3. you need to track when the async audio output starts and stops, and trigger RTS accordingly

All in all I think this will become an ugly frankensteined combo of USB and AFSK backends, but I'll keep you updated :)

skuep commented 1 year ago

Thanks for all the effort. I kept thinking, maybe it would be easier to ditch PTT by RTS and settle on CM108-style PTT? It would involve sending USB HID Reports. That could be way more streamlined to implement, but I guess it's not compatible to the digirig?

charlieb commented 1 year ago

@ge0rg are we to take it that you're going to take this ticket on yourself before us amateurs start deluging you with poorly thought out, half working, unformatted pull requests?

ge0rg commented 1 year ago

@charlieb I've been ultra-busy in the last *checks calendar* years, so I'm not going to promise an ETA on this feature. After all, I'm lagging behind fixing the OSM rendering since Android 12, and then some more. If you want to give it a try, or need advice, feel free to do so and to bug me with any issues you encounter. Fastest response times will happen on the APRSdroid xmpp room aprsdroid@chat.yax.im (webchat) btw.

charlieb commented 1 year ago

@ge0rg Was never going to ask for a timeline, that's just rude. OK, so I'll take a stab at it. With you backing me up I feel a lot more optimistic about it. Thank you!

barryshaffer commented 1 year ago

I compiled and ran it with android studio out of the box. Nothing external needed for adding scala.

Well dang, that just highlights my pedestrian level coding ability lol. Maybe I can just help Beta test…

Chuckw97055 commented 1 year ago

Here is the src for a GPL licensed app that does RTS PTT for an example/ideas?? https://bitbucket.org/VK2ETA/radiomsg/downloads/ No idea if that would be remotely useful, but seeing as I'd also love to see PTT control in Aprsdroid, I'll risk it:)

Thunter96 commented 1 year ago

@charlieb thanks for taking a crack at this. This is exciting as it will open up a lot of devices that don't have VOX for use with both APRSDroid and digirig. This is the one thing holding me back from purchasing the digirig mobile from @yeti7.

Edit: looks like somebody may have started this already? Not sure if it's useful or not: https://github.com/Swissman1/aprsdroid

charlieb commented 1 year ago

Thanks, those links may turn out to be useful. I'm still at the "this looks like something I might need, I'll copy it, change the name and see if it still builds" stage, otherwise known as flailing. I have forked and I'll probably make a commit tonight if I can get DigiRig to show up in the menus. https://github.com/charlieb/aprsdroid

Chuckw97055 commented 1 year ago

If RTS is problematic, a useful hack is to output a constant tone on one audio channel for PTT control, as implemented in FLDIGI for example. A circuit is required on the hardware side but it gets you real PTT control.

kyleh928 commented 1 year ago

@charlieb I saw your fork, grabbed the code and put it in Android Studio to try an build an APK to test out. Ran into some errors trying that (Deprecated Gradle stuff). Admittedly I am way out of my lane with this stuff but wanted to give it a shot and see if it was functional enough to test. When it is ready, maybe I can help test since I am out of my depth with the rest.

oSPANNERo commented 5 months ago

Soo... sorry/not sorry for necroing this but would love to see this feature in a future release. (Not a coder so can't contribute that way but I have been told I give good shoulder massages!)

bxlentpartyon commented 5 months ago

I wrote a POC commit to enable PTT via RTS in a forked repo here:

https://github.com/bxlentpartyon/aprsdroid/tree/usbtnc-ptt-rts

This is definitely not "good code" yet, and shouldn't be merged even if it works, but I think it does the right thing to some degree. My Digirig will get here tomorrow, so hopefully I can get this properly tested and write a real commit then.

bxlentpartyon commented 5 months ago

As I review stuff here, I'm seeing that the audio output is probably asynchronous (decoupled from the packet send path), so my idea might be correct in spirit, but also might not actually work reliably/at all. The 50ms padding that I added might be enough to paper over my misunderstanding, but that doesn't make it correct.

Anyway, I'll look at this more when I can actually test it. Just wanted to point out my own mistake :)

bxlentpartyon commented 5 months ago

I got my Digirig today and tried this out. With one more small tweak, I was able to eliminate the the behavior where the radio is keyed contintuously after the Digirig is initialized, and I'm able to see it key the radio when packets are transmitted. However, my traffic doesn't seem to be making it to the nearby digipeater.

To be clear, I'm doing this on a Baofeng, so it's super hard to say if the radio is the problem. I can say that I had APRSDroid working quite well on VOX mode with the BTECH APRS cable, but yesterday when I was playing with it, it was barely hearing any packets off the digipeater, and transmission was spotty/not working at all. FYI I do have a fairly decent homemade half-wave antenna hooked up, which the guys on the local repeater say sounds fine.

I did a bit of troubleshooting here on my own, by plugging earbuds into the audio port on the Digirig, and I'm not getting any sound when packets are transmitted. However, I don't know if this is even a valid test. I did get sound during transmission when I plugged my earbuds into the serial jack, but, again, I have no idea if that is a valid test.

Anyway, I'm pretty confident I can get this working, but I think I need a little help with troubleshooting here. @yeti7 @ge0rg is it appropriate to have that conversation here, or should I maybe post on the Digirig forum?

bxlentpartyon commented 5 months ago

I'll add an additional note that when I tried hooking the radio up to the serial port jack on the Digirig (using the appropriate cable) the radio did key up during transmission, but it keyed off and on rapidly during transmission. If the serial jack/cable are the ones I should be using, then there might just be another layer of issues to debug here.

bxlentpartyon commented 5 months ago

I did some more testing today, and I think (unsurprisingly) that something has gone funky with the radio. It was transmitting packets reliably with the AFSK/VOX setup last week, and nothing is making it out now, even when sitting right next to a local digipeater. I'm going to upgrade to a new HT and continue working there. Hopefully more to come in a week or so.

bxlentpartyon commented 5 months ago

I got my new radio yesterday and got to work on this. It's ended up being a bit more complicated than I initially realized, but should be totally do-able. I worked on top of @charlieb's commit to produce this branch:

https://github.com/bxlentpartyon/aprsdroid/tree/digirig

I was able to get it to transmit packets, but RX isn't working yet. Probably partially because the code and branch are both super sloppy right now. Anyway, it's working to some degree. More soon.