-
Notifications
You must be signed in to change notification settings - Fork 230
Description
(disclaimer, yes I used the AI to write this. forgive me. I thought something about this log looked weird and I think I've proven it is?)
Describe the bug (against version 2601184)
When the station switches tracking from one satellite to another (via the begine command), the status.tle.freqDoppler variable is not reset. This causes the radio to tune using the Doppler offset from the previous satellite applied to the new satellite's base frequency.
This is particularly problematic if the new satellite is currently below the horizon (dSatEL <= 0), because the TLE tracking loop in Radio::tle() skips updating freqDoppler when elevation is negative. As a result, the station remains tuned to the wrong frequency (Base + Stale Offset) until the new satellite rises above the horizon.
Raw Logs (from me, the human)
20:35:42 Doppler -> New: 10234.07 Hz Old: 9121.66 Hz Dif: 1112.40 Hz
20:35:46 Doppler -> New: 10222.65 Hz Old: 9121.66 Hz Dif: 1100.98 Hz
20:35:50 Doppler -> New: 10210.53 Hz Old: 9121.66 Hz Dif: 1088.86 Hz
20:35:54 Received MQTT message: tinygs/<MQTT redacted>/fitzsimons_org_GS/cmnd/begine :
{"mode":"FSK","sat":"HORIZON","NORAD":61757,"freq":435.4314,"bw":23.4,"pl":24,"pwr":5,"br":9.6,"fd":4.8,"fsw":[147,11,81,222],"ook":2,"len":74,"fr":2,"cSw":true,"cB":2,"cI":65535,"cP":32773,"cF":0,"cRI":false,"cRO":false,"tle":"<redact?>"
20:35:54 Doppler -> New: 173.83 Hz Old: 9121.66 Hz Dif: 8947.83 Hz
20:35:54 [SX1262] Starting to listen to HORIZON @ FSK mode @ 435.4405 MHz
20:35:54 Doppler -> New: 173.83 Hz Old: 9121.66 Hz Dif: 8947.83 Hz
20:35:57 {"Vbat":3878,"Mem":194208,"MinMem":134872,"MaxBlk":176116,"RSSI":-68,"radio":0,"InstRSSI":-127.5}
20:35:58 Doppler -> New: 199.07 Hz Old: 9121.66 Hz Dif: 8922.60 Hz
20:36:02 Doppler -> New: 224.30 Hz Old: 9121.66 Hz Dif: 8897.36 Hz
20:36:06 Doppler -> New: 249.53 Hz Old: 9121.66 Hz Dif: 8872.13 Hz
20:36:10 Doppler -> New: 274.77 Hz Old: 9121.66 Hz Dif: 8846.90 Hz
20:36:14 Doppler -> New: 300.00 Hz Old: 9121.66 Hz Dif: 8821.66 Hz
20:36:18 Doppler -> New: 325.23 Hz Old: 9121.66 Hz Dif: 8796.43 Hz
20:36:22 Doppler -> New: 350.47 Hz Old: 9121.66 Hz Dif: 8771.20 Hz
20:36:26 Doppler -> New: 375.70 Hz Old: 9121.66 Hz Dif: 8745.96 Hz
20:36:30 Doppler -> New: 400.93 Hz Old: 9121.66 Hz Dif: 8720.73 Hz
20:36:34 Doppler -> New: 426.16 Hz Old: 9121.66 Hz Dif: 8695.50 Hz
20:36:38 Doppler -> New: 451.39 Hz Old: 9121.66 Hz Dif: 8670.27 Hz
20:36:42 Doppler -> New: 476.62 Hz Old: 9121.66 Hz Dif: 8645.04 Hz
20:36:46 Doppler -> New: 501.85 Hz Old: 9121.66 Hz Dif: 8619.82 Hz"
To Reproduce
- Station is tracking Satellite A (e.g., ISS) with a significant Doppler offset (e.g., +9 kHz).
- Station receives a
beginecommand to switch to Satellite B (e.g., HORIZON). - The logs show a massive jump in the "Diff" value because
Old(currentfreqDoppler) is compared against theNewcalculation for Satellite B.
Doppler -> New: 173.83 Hz Old: 9121.66 Hz Dif: 8947.83 Hz - If Satellite B is below the horizon, the
Oldvalue remains stuck at 9121.66 Hz, and the radio remains tuned toSatB_BaseFreq + 912Hz.
Expected behavior
When switching satellites, the accumulated Doppler offset should be reset to 0 so the radio starts tuning from the satellite's nominal base frequency (or the correct initial Doppler for the new satellite).
Proposed Fix
In MQTT_Client.cpp, inside the manageMQTTData function handling commandBegine:
Reset status.tle.freqDoppler to 0 before calling radio.tle().
if (ret == 0) {
// Decoding successful...
status.tle.freqDoppler = 0; // <--- ADD THIS RESET
radio.tle();
}
This ensures that Radio::begin() uses a clean state. Could do it in radio.tle() instead?