Skip to content

Commit 6db830c

Browse files
test: Enhance command family tests with LX200 spec coverage
- Add comprehensive tests for all 18 command families - Add case-sensitivity test (G/g, H/h distinction) - Enhance Movement, GetInfo, GPS, SetInfo, Tracking tests - Fix command family classification for H and S commands - All 101 tests passing (100% success)
1 parent ef08101 commit 6db830c

2 files changed

Lines changed: 456 additions & 19 deletions

File tree

lib/lx200/src/lx200.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ std::optional<Command> ParserState::get_command() noexcept
9090
CommandFamily family = CommandFamily::Unknown;
9191

9292
// Special cases for date/time commands (semantic grouping)
93-
if (name == "GC" || name == "GL" || name == "Ga" || name == "Gc" ||
94-
name == "SC" || name == "SL" || name == "SG" || name == "SH") {
93+
// GET commands (G*) are semantically DateTime queries
94+
// SET commands (S*) with parameters use default SetInfo family
95+
if (name == "GC" || name == "GL" || name == "Ga" || name == "Gc" || name == "H") {
9596
family = CommandFamily::DateTime;
9697
}
98+
// SL, SG, SH, SC without parameters would be DateTime, but LX200 protocol
99+
// always uses them WITH parameters, so they use SetInfo family below
97100
// Default: use first character mapping
98101
// NOTE: :gT# (lowercase g) is GPS family, not GetInfo
99102
// (:GT# with uppercase G is GetInfo - "Get tracking rate")
@@ -129,7 +132,7 @@ CommandFamily ParserState::identify_family(char first_char) const noexcept
129132
case 'G': return CommandFamily::GetInfo;
130133
case 'g': return CommandFamily::GPS;
131134
case 'h': return CommandFamily::Home;
132-
case 'H': return CommandFamily::Home; // Hour angle also maps to Home
135+
case 'H': return CommandFamily::DateTime; // :H# is time format toggle (handled specially above)
133136
case 'I': return CommandFamily::Initialize;
134137
case 'L': return CommandFamily::Library;
135138
case 'M': return CommandFamily::Movement;

0 commit comments

Comments
 (0)