Feature/character set improvements#147
Open
oligazar wants to merge 3 commits intojoeycastillo:mainfrom
Open
Conversation
- Add bidirectional navigation with LIGHT button (backwards) - Add fast scroll with long press on ALARM (forward) and LIGHT (backward) - Implement 8Hz tick frequency for smooth fast scrolling - Add proper state management with character_set_state_t - Auto-stop fast scroll when button released Controls: - ALARM short press: advance one character forward - ALARM long press: fast scroll forward (8Hz) - LIGHT short press: go back one character - LIGHT long press: fast scroll backward (8Hz)
3727ee9 to
cfe2f1d
Compare
- Extract repetitive display code into helper function - Use memset instead of sprintf with 6 repeated arguments - Eliminate code duplication (4 identical display update blocks) - Remove unused buf variable from main loop - Improve code readability and maintainability
WATCH_POSITION_TOP handles the entire top line (2 chars on classic, 5 on custom), so there's no need to call TOP_LEFT and TOP_RIGHT separately.
1b5b212 to
1a2eaae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Character Set Face Improvements
This PR adds bidirectional navigation and refactors the character set face for improved code quality and
efficiency.
New Features
Bidirectional Navigation
Characters wrap around between space (0x20) and DEL (0x7F) in both directions.
Code Quality Improvements
Before:
sprintf(buf, "%c%c%c%c%c%c", c, c, c, c, c, c); // 6 repeated arguments
After:
memset(buf, c, 6); // Clean and efficient
buf[6] = '\0';
More efficient and much more readable.
Before:
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, buf, buf);
watch_display_text_with_fallback(WATCH_POSITION_TOP_RIGHT, buf, buf);
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, buf, buf);
After:
watch_display_text_with_fallback(WATCH_POSITION_TOP, buf, buf);
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, buf, buf);
WATCH_POSITION_TOP handles the entire top line (2 chars on classic LCD, 5 chars on custom LCD) automatically.
Implementation Details
Commits