Compare commits

...

4 Commits

Author SHA1 Message Date
James Whyte
9791cd34d4
Merge b5922b91b7 into d403044f76 2026-02-04 01:25:32 +08:00
Aaron Cunliffe
d403044f76
fix: Increase network SSID display length (#670)
Some checks are pending
CI / build (push) Waiting to run
## Rationale 

I have 2 wifi access points with almost identical names, just one has
`_EXT` at the end of it. With the current display limit of 13 characters
before adding ellipsis, I can't tell which is which.

Before device screenshot with masked SSIDs:
<img
src="https://github.com/user-attachments/assets/3c5cbbaa-b2f6-412f-b5a8-6278963bd0f2"
width="300">


## Summary

Adjusted displayed length from 13 characters to 30 in the Wifi selection
screen - I've left some space for potential proportional font changes in
the future

After image with masked SSIDs:
<img
src="https://github.com/user-attachments/assets/c5f0712b-bbd3-4eec-9820-4693fae90c9f"
width="300">

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< NO >**_
2026-02-03 18:24:23 +03:00
James Whyte
b5922b91b7 feat: add shift lock to KeyboardEntryActivity 2026-01-23 17:19:38 +00:00
James Whyte
93ea23168b fix: disable shift after any typed character 2026-01-23 16:29:08 +00:00
3 changed files with 15 additions and 11 deletions

View File

@ -546,8 +546,8 @@ void WifiSelectionActivity::renderNetworkList() const {
// Draw network name (truncate if too long) // Draw network name (truncate if too long)
std::string displayName = network.ssid; std::string displayName = network.ssid;
if (displayName.length() > 16) { if (displayName.length() > 33) {
displayName.replace(13, displayName.length() - 13, "..."); displayName.replace(30, displayName.length() - 30, "...");
} }
renderer.drawText(UI_10_FONT_ID, 20, networkY, displayName.c_str()); renderer.drawText(UI_10_FONT_ID, 20, networkY, displayName.c_str());

View File

@ -13,6 +13,9 @@ const char* const KeyboardEntryActivity::keyboard[NUM_ROWS] = {
const char* const KeyboardEntryActivity::keyboardShift[NUM_ROWS] = {"~!@#$%^&*()_+", "QWERTYUIOP{}|", "ASDFGHJKL:\"", const char* const KeyboardEntryActivity::keyboardShift[NUM_ROWS] = {"~!@#$%^&*()_+", "QWERTYUIOP{}|", "ASDFGHJKL:\"",
"ZXCVBNM<>?", "SPECIAL ROW"}; "ZXCVBNM<>?", "SPECIAL ROW"};
// Shift state strings
const char* const KeyboardEntryActivity::shiftString[3] = {"shift", "SHIFT", "LOCK"};
void KeyboardEntryActivity::taskTrampoline(void* param) { void KeyboardEntryActivity::taskTrampoline(void* param) {
auto* self = static_cast<KeyboardEntryActivity*>(param); auto* self = static_cast<KeyboardEntryActivity*>(param);
self->displayTaskLoop(); self->displayTaskLoop();
@ -80,7 +83,7 @@ int KeyboardEntryActivity::getRowLength(const int row) const {
} }
char KeyboardEntryActivity::getSelectedChar() const { char KeyboardEntryActivity::getSelectedChar() const {
const char* const* layout = shiftActive ? keyboardShift : keyboard; const char* const* layout = shiftState ? keyboardShift : keyboard;
if (selectedRow < 0 || selectedRow >= NUM_ROWS) return '\0'; if (selectedRow < 0 || selectedRow >= NUM_ROWS) return '\0';
if (selectedCol < 0 || selectedCol >= getRowLength(selectedRow)) return '\0'; if (selectedCol < 0 || selectedCol >= getRowLength(selectedRow)) return '\0';
@ -92,8 +95,8 @@ void KeyboardEntryActivity::handleKeyPress() {
// Handle special row (bottom row with shift, space, backspace, done) // Handle special row (bottom row with shift, space, backspace, done)
if (selectedRow == SPECIAL_ROW) { if (selectedRow == SPECIAL_ROW) {
if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) { if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) {
// Shift toggle // Shift toggle (0 = lower case, 1 = upper case, 2 = shift lock)
shiftActive = !shiftActive; shiftState = (shiftState + 1) % 3;
return; return;
} }
@ -130,9 +133,9 @@ void KeyboardEntryActivity::handleKeyPress() {
if (maxLength == 0 || text.length() < maxLength) { if (maxLength == 0 || text.length() < maxLength) {
text += c; text += c;
// Auto-disable shift after typing a letter // Auto-disable shift after typing a character in non-lock mode
if (shiftActive && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) { if (shiftState == 1) {
shiftActive = false; shiftState = 0;
} }
} }
} }
@ -297,7 +300,7 @@ void KeyboardEntryActivity::render() const {
constexpr int keyHeight = 18; constexpr int keyHeight = 18;
constexpr int keySpacing = 3; constexpr int keySpacing = 3;
const char* const* layout = shiftActive ? keyboardShift : keyboard; const char* const* layout = shiftState ? keyboardShift : keyboard;
// Calculate left margin to center the longest row (13 keys) // Calculate left margin to center the longest row (13 keys)
constexpr int maxRowWidth = KEYS_PER_ROW * (keyWidth + keySpacing); constexpr int maxRowWidth = KEYS_PER_ROW * (keyWidth + keySpacing);
@ -318,7 +321,7 @@ void KeyboardEntryActivity::render() const {
// SHIFT key (logical col 0, spans 2 key widths) // SHIFT key (logical col 0, spans 2 key widths)
const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL); const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL);
renderItemWithSelector(currentX + 2, rowY, shiftActive ? "SHIFT" : "shift", shiftSelected); renderItemWithSelector(currentX + 2, rowY, shiftString[shiftState], shiftSelected);
currentX += 2 * (keyWidth + keySpacing); currentX += 2 * (keyWidth + keySpacing);
// Space bar (logical cols 2-6, spans 5 key widths) // Space bar (logical cols 2-6, spans 5 key widths)

View File

@ -70,7 +70,7 @@ class KeyboardEntryActivity : public Activity {
// Keyboard state // Keyboard state
int selectedRow = 0; int selectedRow = 0;
int selectedCol = 0; int selectedCol = 0;
bool shiftActive = false; int shiftState = 0; // 0 = lower case, 1 = upper case, 2 = shift lock)
// Callbacks // Callbacks
OnCompleteCallback onComplete; OnCompleteCallback onComplete;
@ -81,6 +81,7 @@ class KeyboardEntryActivity : public Activity {
static constexpr int KEYS_PER_ROW = 13; // Max keys per row (rows 0 and 1 have 13 keys) static constexpr int KEYS_PER_ROW = 13; // Max keys per row (rows 0 and 1 have 13 keys)
static const char* const keyboard[NUM_ROWS]; static const char* const keyboard[NUM_ROWS];
static const char* const keyboardShift[NUM_ROWS]; static const char* const keyboardShift[NUM_ROWS];
static const char* const shiftString[3];
// Special key positions (bottom row) // Special key positions (bottom row)
static constexpr int SPECIAL_ROW = 4; static constexpr int SPECIAL_ROW = 4;