Skip to content

Commit b288649

Browse files
refactor: Remove unnecessary enum value assignments from CommandFamily
Remove character literal assignments from CommandFamily enum values. These were never used functionally - the enum serves purely as a type-safe categorization, while identify_family() does the actual character-to-family mapping. Benefits: - Simpler and more idiomatic C++ (compiler auto-assigns 0,1,2...) - More accurate: Backlash/SmartDrive aren't single characters - Clearer intent: enum is for type safety, not character storage - Smaller and more cache-friendly with sequential values The character mappings are documented in comments and implemented in identify_family() where they actually matter. All 103 tests still passing (25+51+17+10).
1 parent 6db279a commit b288649

1 file changed

Lines changed: 32 additions & 31 deletions

File tree

include/lx200/lx200.hpp

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,41 @@ namespace lx200
4646
* Commands are grouped by their first character(s) after the ':' prefix.
4747
* This enables fast lookup and categorization.
4848
*
49-
* Special cases:
50-
* - Most commands: Single character designator (e.g., :Gxx#, :Mxx#)
51-
* - Dollar commands: Two-character designator starting with '$' (e.g., :$Bxx#, :$Qxx#)
49+
* Classification mapping:
50+
* - Single-character families: A, B, C, D, f, F, G, g, h, H, I, L, M, P, Q, r, R, S, T, U, W, X, ?
51+
* - Two-character families: $B (Backlash), $Q (SmartDrive)
5252
*
53-
* Note: Some command families have semantic groupings across multiple
54-
* prefixes (e.g., date/time commands span C, G, H, S families).
53+
* Note: This is purely a type-safe categorization enum. The actual character
54+
* mapping is handled by identify_family() which inspects the command string.
55+
* Enum values are auto-assigned by the compiler for simplicity.
5556
*/
5657
enum class CommandFamily : uint8_t {
57-
Alignment = 'A', ///< Telescope alignment commands
58-
Backlash = '$', ///< Active backlash compensation (:$B commands, LX200GPS)
59-
Reticle = 'B', ///< Reticle brightness and accessory control
60-
Sync = 'C', ///< Sync control (telescope position synchronization)
61-
Distance = 'D', ///< Distance bars
62-
Fan = 'f', ///< Fan/power control (lowercase f, LX200GPS/LX16")
63-
Focus = 'F', ///< Focuser control
64-
GetInfo = 'G', ///< Get telescope information
65-
GPS = 'g', ///< GPS-related commands (lowercase g)
66-
Home = 'h', ///< Home position and parking (lowercase h)
67-
HourFormat = 'H', ///< Hour angle/time format toggle (uppercase H)
68-
Initialize = 'I', ///< Initialize telescope
69-
Library = 'L', ///< Object library commands
70-
Movement = 'M', ///< Slew and movement control
71-
Precision = 'P', ///< Toggle precision mode
72-
Quit = 'Q', ///< Stop/quit movement
73-
SmartDrive = '@', ///< Smart Drive PEC control (:$Q commands, LX200GPS/LX16")
74-
Derotator = 'r', ///< Field de-rotator control (lowercase r, LX16")
75-
Rate = 'R', ///< Slew rate control
76-
SetInfo = 'S', ///< Set telescope information
77-
Tracking = 'T', ///< Tracking rate control
78-
User = 'U', ///< User format control
79-
Waypoint = 'W', ///< Way point/site commands (LX200GPS)
80-
Extended = 'X', ///< Extended OAT-specific commands
81-
Help = '?', ///< Help commands (LX200GPS/LX16")
82-
Unknown = 0 ///< Unrecognized command
58+
Alignment, ///< Telescope alignment commands (A)
59+
Backlash, ///< Active backlash compensation ($B commands, LX200GPS)
60+
Reticle, ///< Reticle brightness and accessory control (B)
61+
Sync, ///< Sync control (C - telescope position synchronization)
62+
Distance, ///< Distance bars (D)
63+
Fan, ///< Fan/power control (f - lowercase, LX200GPS/LX16")
64+
Focus, ///< Focuser control (F)
65+
GetInfo, ///< Get telescope information (G - uppercase)
66+
GPS, ///< GPS-related commands (g - lowercase)
67+
Home, ///< Home position and parking (h - lowercase)
68+
HourFormat, ///< Hour angle/time format toggle (H - uppercase)
69+
Initialize, ///< Initialize telescope (I)
70+
Library, ///< Object library commands (L)
71+
Movement, ///< Slew and movement control (M)
72+
Precision, ///< Toggle precision mode (P)
73+
Quit, ///< Stop/quit movement (Q)
74+
SmartDrive, ///< Smart Drive PEC control ($Q commands, LX200GPS/LX16")
75+
Derotator, ///< Field de-rotator control (r - lowercase, LX16")
76+
Rate, ///< Slew rate control (R)
77+
SetInfo, ///< Set telescope information (S)
78+
Tracking, ///< Tracking rate control (T)
79+
User, ///< User format control (U)
80+
Waypoint, ///< Way point/site commands (W - LX200GPS)
81+
Extended, ///< Extended OAT-specific commands (X)
82+
Help, ///< Help commands (? - LX200GPS/LX16")
83+
Unknown ///< Unrecognized command
8384
};
8485

8586
/**

0 commit comments

Comments
 (0)