Repository navigation
fix(meade): accept the UTC offset format INDI sends - #303
Conversation
|
I would contend that this is a INDI defect. The Meade Telescope Serial Command Protocol, Revision 2010.10 from 7 October 2010, is quite explicit that the command is |
ClutchplateDude
left a comment
There was a problem hiding this comment.
See comment on main page.
f976a99 to
1a1e615
Compare
Fair on all three, and I agree it's an INDI deviation rather than a mount defect. I've put that in the The sign is mandatory again. One test flipped; everything else already sent one. I also fixed the header line, which still read One thing I'd rather mention than quietly skip: pre-291 the value went through On 0.5, I'd like to do that as a follow-up PR, because the parser part is the easy half:
Three questions, since they're your calls:
Rebased on top of #304. |
|
@ClutchplateDude Sign is required again, and both |
Cursor::signed2 requires a sign and exactly two digits, so the ":SG+7.0#" that INDI puts on the wire was refused and the mount kept whatever offset it already had -- local sidereal time then out by the whole offset, with no indication anything had failed. readUtcOffset takes the sign, one or two digits, and leaves the remainder unconsumed, so "+7.0", "+7" and "+07" all set +7. The sign stays required, as MeadeProtocol.hpp specifies. Pre-OpenAstroTech#291 the value went through String::toInt(), which accepts an unsigned number, so this is a narrowing rather than a restoration -- but a missing sign is much more likely a client bug than a deliberate "+", and guessing wrong puts sidereal time out by twice the offset. (That same path also returned "1" for ":SGx#" having stored 0; this rejects it.) Half-hour zones are still unrepresentable, and deliberately so here: the offset is a single marker-gated signed byte in a packed EEPROM map with no unit tag, and DayTime::addHours takes a float, so re-unitising the stored value would compile clean and silently double the error on any mount flashed from an older build. That is a storage change and belongs in its own commit. Also fixes the :SG header line, which still read ":SGsHH#". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StH2aGiQEj3qvMWJ58CSWz
1a1e615 to
5d8469e
Compare
|
Answers to the three questions, with what the code and INDI's driver actually do (checked against INDI master today): 1. Downgrades — treat them as supported, because the safe layout is nearly free. Nothing in the repo promises downgrade support, but the web flasher lets anyone load any version, so downgrades happen whether we support them or not. The map is packed to 2. // lx200driver.h
#define getUTCOffset(fd, x) getCommandInt(fd, x, ":GG#")— parsed into an 3. For the record, your EEPROM constraints were all accurate — the map is packed solid through 73, the extended flags end at Maintainer note: after #304 merged, I rebased this branch onto |
Regression from #291. INDI cannot set the site's UTC offset, so local time is wrong for every INDI/KStars session.
The defect
The
:SGarm ofhandleMeadeSet()requires a leading+/-and exactly two digits. INDI sends one digit and a fractional part.Captured off the wire on an INDI connect to an OpenAstroExplorer:
:SG+7.0#is answered0, the handler never fires, and the offset is silently left unset. The pre-#291 handler rantoInt()over the remainder (inCmd.substring(1, 4).toInt()), which accepted all of these forms.The fix
A
readUtcOffset()helper alongside the otherread*helpers: the sign stays mandatory (as ondevelop— an unsigned offset is more likely a client bug than a deliberate+, and guessing wrong puts LST out by twice the offset), it accepts one or two digits, and leaves trailing characters unconsumed so+7.0parses as+7— matching the pre-#291 behaviour for everything INDI sends rather than inventing a new grammar.Every form that already parsed behaves identically, sign included;
+05→ 5 and-08→ −8 on both sides of the change.Tests
Added under the existing
---- UTC Offset (G) ----block: the exact INDI form; single-digit positive and negative (the suite never covered that intersection); unsigned — pinned as rejected, a deliberate narrowing versus pre-#291'stoInt(); the sign-without-digits and non-numeric rejection paths; and the+5.5half-hour case (India, Newfoundland), which truncates because the stored offset is whole hours — pinned so the limitation is documented rather than discovered in the field.One existing test asserted that
G+5was rejected. That was pinning the regression, since the pre-#291 handler accepted it, so it is repointed at genuinely malformed input rather than removed; the rejection path is now covered by two tests instead of one.pio test -e native: 277 pass at the original stacked tip (269 on then-develop+ 9 added − 1 repointed). After the post-#304 rebase, CI on the single-commit branch reports 331/331 native test cases passing and all board builds green. Builds clean foroaeboardv1andramps.Deliberately not included
No range validation.
:SG+13/:SG-15are accepted ondeveloptoday and the tests pin that as-is — adding a-14..+14check would change behaviour beyond the reported fault and could reject something a real client sends. Happy to fold it in if you'd rather have it here.Scope is
:SGonly.:Sg(site longitude) had a related #291 regression of its own; it is fixed in #304 (merged), which also settled the sign-convention question by restoring the pre-#291 east-negative wire mapping.Rebase note
Originally stacked on #304/#305. After both merged, rebased onto
developas a single commit containing only the:SGchanges.