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
Add option to add a delay after starting TX and before ending TX. #618
Conversation
How about now? |
Yes that now allows for 7 digits on my screen - certainly more than adequate! I'm seeing something a bit odd after doing some more testing. |
Thinking more about this, does the PTT 'stop event' stop input to the encoder and also send the PTT stop signal to hamlib at the same time? If so I assume that the encoding will continue for some time before completing, so that the end of audio out will be delayed by the time taken to encode. Could this explain the delay that I am seeing between the PTT at the rig and the audio output? |
@tmiw I don't quite understand what you are attempting to show me in the above images. I can see that there is a ~5sec delay but the longer the delay the harder it is to see the audio delay that we are trying to diagnose. The latest change in #cd8db does not appear to have improved the situation. To visibly detect a PTT delay after RF out stops (by watching the rig 'send' led and the rig power out), I need to use a delay setting greater than 250ms, so it is still needing to mask a long delay in the stopping of the audio. This audio delay must also be over and above any delay in rigctld communication and the rig response to it. Is it possible to not send the PTT stop command to rigctld (or wherever) until the encoding process has actually finished? Then any delay added by this feature will have the same effect on PTT stop as it does on PTT start. |
I used GIMP to get some measurements in pixels between PTT on and audio beginning to go out (and likewise, between audio termination and PTT off) from the above screenshot: These end up corresponding to the following delays: PTT on: 141/126 * 5 = ~5.6 seconds (Note that the intended delay was supposed to be 5 seconds in the previous test.) So yeah, the wait for PTT off does need to be extended a bit. I'll experiment and see if I can get that any better. |
This just gets more confusing. : Top trace is PTT (active low) and the bottom indicates RF (ignore the rubbish trace during TX). I initially tested the latest #627d2 build and discovered that with the delay setting at 0 there was a stop delay of about 600ms already there: I then repeated with a delay setting of 200ms which did add around 200ms to the stop delay but only about 50ms at the start. I then went back to a version at random (#87588) before you started to add a delay: That already seems to have about 100ms start and around 200ms stop delays as it is on my setup. None of the above seem to agree with the other results I was seeing previously, but then I was not using this latest version. If I get chance I will test the previous one this way, just to confirm the results I was seeing before. |
Yeah, let me know how the additional testing goes. At least with my setup, the timings look okay. :( Maybe it'd be worthwhile to get more people (e.g. @Tyrbiter) trying this out? |
As an experiment (and to improve UI responsiveness with long delays), I adjusted how the delays were being done (i.e. forcing yields to handle UI events and using std::chrono/std::thread instead of wxWidgets to kick off the delay). Looks like going from TX->RX is right on target while RX->TX has a ~300-400ms delay now: Though TBH, I think it's better to be longer than expected than shorter, especially when sensitive hardware comes into the picture. Note that some of the RX->TX delay is due to 700D (for example) handling 160ms long frames, so at least some of the delay on that side is unavoidable. |
I tested the ms-reporter-msg branch build I was using for the other PR tests and it gives a sensible result tested this way: There is no visible start delay and the 100ms stop delay I think can be attributed to the rig's aux PTT relay dropout time, as it will no doubt have a diode across the coil. I was thinking that maybe separate variables could be used for start and stop delays. In my case I suspect that a short stop delay and longer start will be needed. However you now mention that different modes may produce different encoding delays, so I maybe should check whether I can see this effect. I will first build this latest version and test it with and without delays applied and in different modes, hopefully tonight. |
Testing this branch at #f3031 with the delay setting at 0 there is a tail delay of between 500ms and 700ms depending on the mode in use. The start delay is correct at 0.
This seems opposite to the result I am seeing :( Unless we are using different terminology? The start delay is going from RX to TX and is between the PTT low (active low) and start of RF out. So this is somehow adding a very large (~500ms) stop delay compared to the ms-reporter-msg branch that I tested yesterday at 100ms. Setting the delay to 200ms does add ~200ms to both start and stop delays. The only issue is where the extra ~500ms stop is coming from? |
Might be worth testing to see if this is the same in analog mode as well.
In the screenshots I've posted so far, TX->RX (stop delay) is represented by the topmost red bar/measurement while RX->TX (start delay) is the red bar on the very bottom. The red bar on the right hand side is for scaling (e.g. 63 pixels per 5 seconds in the very last screenshot).
Depending on the results in analog mode, it might be something Hamlib related (i.e. it's somehow taking longer than expected to send the needed CAT commands to switch back to RX). Besides hamlib, a patch you can try as well is below; I'm not sure if it'll make things better or worse since SDRs do behave differently:
(this effectively reverts one of the changes I did in the PR so far to determine when the TX side actually finishes outputting audio) |
It's not happening with the ms-reporter-msg branch in the screenshot next but last, so that probably rules out Hamlib as the cause and points to changes here? |
Testing this (ms-tx-rx-delay) branch WITH your revert patch in digital mode: ...and with 200ms delay! Super! I think this and the Msg PRs deserve a Christmas 1.9.6 release! Have a very Merry Christmas , you deserve it! :) EDIT A quick test of analogue with the patch and a 200ms delay setting has about 600ms start and about 250ms stop, so better than it was without the patch. 73 |
Thanks! |
Resolves #609 by adding a configuration option to allow TX audio to be delayed after starting TX and on ending TX audio (before returning to RX).
UI for new option: