Commit 1b05676
committed
refactor(lx200): modernize API with string_view and simplify RACoordinate
Major API improvements to the LX200 C++20 implementation:
**API Modernization:**
- Replace C-style const char* with std::string_view in all parsing functions
- parse_ra_coordinate()
- parse_dec_coordinate()
- parse_latitude_coordinate()
- parse_longitude_coordinate()
- parse_time_value()
- parse_date_value()
- Remove operator!(ParseResult) - use explicit comparisons instead
- Update all tests to use zassert_equal() with ParseResult::Success
**Structure Optimization:**
- Remove redundant 'tenths' field from RACoordinate (4 bytes → 3 bytes)
- Unify low/high precision: both now use hours/minutes/seconds
- Convert low precision tenths to seconds: tenths * 6 = seconds
(0.1 arcminute = 6 arcseconds)
- Add conversion table documentation
**Implementation Improvements:**
- Replace C pointer arithmetic with string_view methods
- Use string_view::find() instead of custom find_char() helper
- Use string_view::substr() for parsing instead of pointer manipulation
- Better error handling: separate format vs range validation
- Remove obsolete find_char() helper function
**Benefits:**
- More idiomatic modern C++ (C++17+ style)
- Better type safety with string_view
- Reduced memory footprint (3 bytes vs 4 bytes per RA coordinate)
- Cleaner, more maintainable code
- No performance regression
All 56 tests passing (100% pass rate).
Closes #T031 test verification phase.1 parent f3dc591 commit 1b05676
File tree
10 files changed
+1025
-1465
lines changed- include/lx200
- lib/lx200
- tests/lib/lx200/src
10 files changed
+1025
-1465
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 94 | | |
100 | 95 | | |
101 | 96 | | |
| |||
105 | 100 | | |
106 | 101 | | |
107 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
113 | | - | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
346 | | - | |
| 347 | + | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
360 | | - | |
| 361 | + | |
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| |||
370 | 371 | | |
371 | 372 | | |
372 | 373 | | |
373 | | - | |
| 374 | + | |
374 | 375 | | |
375 | 376 | | |
376 | 377 | | |
| |||
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
385 | | - | |
| 386 | + | |
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
| |||
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
397 | | - | |
| 398 | + | |
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
| |||
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
409 | | - | |
| 410 | + | |
410 | 411 | | |
411 | 412 | | |
412 | 413 | | |
| |||
0 commit comments