Repository navigation
fix(mount): southern hemisphere tracking limit, manual E/W slews and :XGC/POI targets - #332
Conversation
- Symptom: in the southern hemisphere, tracking stops after any DEC move and can't be re-enabled. The safe time (:XGST#) is about 12 h off. - Cause: checkRALimit() still uses the hemisphere-dependent flip test that #217 removed from currentRA(). In the south, the 12 h correction is applied on the wrong side. - Effect without the fix: tracking stops falsely on one side of home, and the real limit never fires on the other. The RA_TRACKING_LIMIT 12 workaround from Discord disables the check entirely. - Test: OAE bench board (ESP32, no motors), using :St to set the latitude, then :MXd/:MXr and :XGST#. Before the fix, the south showed 18.5 h / −4.5 h with tracking stopped; after it, the south matches the north in all six cases. The north is unchanged.
startSlewing() applied a hemisphere sign to manual E/W slews (sign = -1 in the south). The RA stepper convention is already the same in both hemispheres: configureHemisphere() inverts the RA DIR pin for the south, and gotos, tracking and currentRA() all treat positive steps as west. The extra sign made :Mw# move east and :Me# move west in the south (OATControl arrow buttons, ASCOM MoveAxis, INDI). Bench-tested on an OAE board (ESP32, no motors): in the south, :Mw# now lowers :GR# and :Me# raises it, the same as in the north. North behaviour is unchanged.
Declination::FromSeconds converted celestial DEC to the axis value with +90° + dec in the southern hemisphere, while the Meade path (fromCelestialSeconds / celestialToAxisSeconds) uses −90° − dec since #217. Both give the same distance from the pole but with opposite sign, so in the south :XGC and LCD POI targets ended up on the other side of the pole without the matching 12 h RA flip, i.e. mirrored through the pole. Effects in the southern hemisphere: - LCD POI gotos landed at RA + 12 h. - :XGC returned DEC stepper positions with the wrong sign, which OATControl uses for the pre-goto DEC limit warning and the DEC slew progress bar. Meade gotos (ASCOM, OATControl, INDI) were not affected. FromSeconds now delegates to fromCelestialSeconds, so all paths share one conversion. Northern hemisphere results are unchanged (90° − dec in both). Tested on an OAE V1 bench board (ESP32, no motors): :XGC vs. a real :Sr/:Sd/:MS goto for 5 targets including meridian flips. Before, the south had the DEC sign mirrored in all cases; after, all 10 cases (south + north) match.
ClutchplateDude
left a comment
There was a problem hiding this comment.
Review verdict: approve — all three fixes verified correct against the code paths they touch, and in each case northern-hemisphere behavior is unchanged by construction. Details per fix, plus two non-blocking nits at the end.
1. checkRALimit() — hemisphere-independent flip test ✅
The invariant that makes degreePos < 0 correct in both hemispheres: the DEC stepper coordinate is positive on the home side in both hemispheres, because calculateRAandDECSteppers() negates the southern (negative-side) axis values into stepper space (Mount.cpp:3855). So "far side of the pole" is degreePos < 0 everywhere — same test as currentRA() (Mount.cpp:3840).
The old southern degreePos > 0 (introduced by #217 itself, 38586ce) fired on virtually every normal southern position, making homeCurrentDeltaRA 12 h off — which explains both symptoms exactly: :XGST# returns checkRALimit(), and loop()'s every-5-s idle check (Mount.cpp:3389) then calls stopSlewing(TRACKING) — killing tracking and every re-enable within 5 s.
For future readers: the hourPos -= 12 here vs currentRA()'s += 12 looks asymmetric but is immaterial — they differ by exactly 24, and homeCurrentDeltaRA is normalized to ±12 afterwards. Only the flip test itself matters. (A one-line comment in checkRALimit saying so would help, but no need to hold the PR for it.)
2. Manual E/W slews — sign removal ✅
configureHemisphere() inverts the RA DIR pin for the south on both _stepperRA and _stepperTRK (Mount.cpp:278), so positive steps = west in both hemispheres. Cross-checked every other RA-stepper consumer — all consistent, all already hemisphere-neutral:
| Consumer | Convention |
|---|---|
currentRA() |
hourPos = zero − pos/stepsPerHour → positive steps = west |
| Gotos | targetRASteps = −moveRA × stepsPerSiderealHour |
| Tracking | positive TRK speed, homeRA = zero + trackedHours |
| Guiding | WEST pulse = positive speed |
The old sign = -1 mirrored more than direction — it also cross-wired the distance bounds (the "east" command was bounded by the west-side min(RA_PHYSICAL_LIMIT, RA_TRACKING_LIMIT) − trackedHours target). And there's no double-flip risk: :Me#/:Mw# (MeadeCommandProcessor.cpp:916/921) and the LCD control arrows (c75_menuCTRL.hpp:51) pass direction constants straight through.
3. Declination::FromSeconds() → fromCelestialSeconds() ✅
Exhaustive caller check: exactly two callers — the LCD POI menu (c722_menuPOI.hpp:86, celestial dms table) and calculateStepperPositions() (Mount.cpp:3779, fed by :XGC's float degrees). Both pass celestial arc-seconds, so reinterpreting the function as celestial→axis (what its callers always intended) breaks nobody. Northern math is identical (324000 − s ≡ celestialToAxisSeconds(s, north)); southern goes from the mirrored +324000 + s to the documented non-positive southern axis (−324000 − s) that the Meade wire path (ParseFromMeade) already produced. Side bonus: the delegation is pure integer math — the old float round-trip (/3600 then ×3600) could be ±1″ off. The core conversions have southern-case unit coverage in test_declination.cpp.
Minor (non-blocking)
FromSeconds()is now literally a duplicate offromCelestialSeconds()— the two callers could call the latter directly andFromSecondsdeleted. Cosmetic cleanup for a follow-up; nothing to change here.- Pre-existing and out of scope, but while auditing hemisphere signs I re-noticed the
TODO: Make sure Southern hemisphere does not need a sign/direction inversionon the DEC guide limit checks inguidePulse(). Possibly a real fourth candidate for the same treatment — worth its own issue once a southern guider reports in.
Bench verification (limit check across six :MX cases, E/W via :GR#, :XGC vs. real gotos including meridian flips) plus the real-mount southern confirmation covers exactly the behaviors derived above. Nice, tight PR.
🤖 Generated with Claude Code
Three southern-hemisphere bugs left behind by #217, which made
currentRA()and the Meade path hemisphere-independent but missed three other places. Northern-hemisphere behaviour is unchanged.1. Tracking limit check (
checkRALimit()):XGST#is about 12 h off.checkRALimit()still used the hemisphere-dependent flip test that V1.12.6 - Southern Hemisphere fixes #217 removed fromcurrentRA(), so the 12 h correction was applied on the wrong side. TheRA_TRACKING_LIMIT 12workaround from Discord only disabled the check.currentRA()(degreePos < 0) in both hemispheres.2. Manual E/W slews (
startSlewing()):Mw#moved east and:Me#moved west (OATControl arrows, ASCOM MoveAxis, INDI).configureHemisphere()inverts the RA DIR pin for the south), and gotos and tracking treat positive as west.3.
:XGCand LCD POI targets (Declination::FromSeconds()):XGCreturned DEC stepper positions with the wrong sign (OATControl uses them for the pre-goto DEC limit warning and the DEC progress bar). Meade gotos were not affected.FromSecondsused +90° + dec in the south, while the Meade path (fromCelestialSeconds) uses −90° − dec, so the target mirrored through the pole without the matching RA flip.FromSecondsdelegates tofromCelestialSeconds, so every path uses one conversion.Testing
:St, north and south::MXd/:MXrthen:XGST#, south matches north in all six cases (before: 18.5 h / −4.5 h, tracking stopped);:Mw#lowers:GR#and:Me#raises it, as in the north;:XGCvs. a real:Sr/:Sd/:MSgoto for 5 targets including meridian flips: all 10 cases match (before: DEC sign mirrored in every southern case).pio run -e oaeboardv1builds.🤖 Generated with Claude Code