Repository navigation
Add CRSF GPS Date/Time from Serial connected GPS - #3662
Conversation
|
You never let anyone else have any fun! 😠 I also implemented this this morning haha I have two differences though I think are improvements:
I also made it autobaud with 115000 fallback if no data is received in 10 seconds, but I can make a separate PR for that or I can tack it on here after you're done if you want? |
|
EdgeTX recently added support for setting the handset RTC from CRSF GPS Time frames (EdgeTX/edgetx#7317), and I recently added support to Betaflight to forward these frames also (betaflight/betaflight#15167). In testing, however, the handset RTC ends up 2–9 seconds behind actual UTC. I believe most of this is due to the delay between when the GPS time message is received and when it is enqueued, sent, and read at the handset. Using normal packets, the 11-byte GPS Time frame would take 3 telem packets to send, which depending on packet rate, telemetry ratio, retries, etc, could add appreciable delay. I think the most common use case for this is when the RTC battery is low/dead or people want accurate time on the handset to sync logs between multiple platforms. Thus having an accurate RTC is desirable. Would it be possible to add a timestamp and shift the GPS time at the RX side between when the GPS message enters the telemetry queue and when it is sent, and at the TX side between when the first chunk is received and when HasFinishedData() fires? I am working on a potential solution, but am unsure of the best way to implement it. Do you have any thoughts? Edit: Potential solution in: #3664 |
|
@CapnBry happy for you to make whatever changes you feel are required. |
|
After copying my changes in and testing, I think every 10s is too long because that could become a "sensor lost" message on EdgeTX when the transmission starts taking too long. At every 5s, that's gives more fudge factor but every 5s vs every 1s isn't really enough I feel to warrant the extra code. Instead I split the publish into two functions rather than doing them at the same time, and publish immediately after the RMC sentence. I dunno. This could be reverted, both the old and new code are basically the same. I did remove the UTC time update from GGA, since the date and the time are split across sentences you theoretically could have an RMC that's configured to come every N GGA messages, which could split the time across a new date and make the reported time non-monotonic. It would quickly fix itself, but I think it is safer to have the RMC be fully atomic. The old code could also keep sending the wrong date if RMC stopped coming for some reason after the first one so now it will only send the telemetry item immediately following a successful date parse. Again these changes are so incredibly minor that I contemplated not even submitting any, and I'd have no issue with you reverting them if you feel the original was better. |



This was requested as a comment on #3642