T-Watches.:

S3 fix (CHG_VOL_4V2 → CHG_VOL_4V35 in TWatchS3Board.cpp

Notes screen:
WatchNotesScreen.h → both variants/lilygo_twatch_s3/ and variants/lilygo_twatch_s3_plus/ (byte-identical copies, like TWatchComposeScreens.h).
TWatchComposeScreens.h → both variant dirs. Adds TWKB_NOTE to the Purpose enum and a setInitialText() (clamped at the 133-char MAXLEN) for prefill editing.
UITask.h → watch_notes_screen member, isOnWatchNotesScreen(), getWatchNotesScreen(), all MECK_TWATCH-gated, mirroring the alarm-screen pattern exactly.
UITask.cpp → include, construction in begin() (after the LittleFS mount, like the alarm), gotoNotesScreen() now routes to the watch screen on MECK_TWATCH (T-Deck/T5S3 behaviour untouched — the SD NotesScreen path below is unreached on watches), the TWKB_NOTE result case (save via applyComposedNote, alert on error, return to the notes screen), and the loop poll that opens the keyboard — prefilling via setInitialText(getEditText()) when editPending().
main.cpp → include plus the tap-dispatch block, same shape as the alarm's.
This commit is contained in:
pelgraine
2026-07-14 18:54:46 +10:00
parent 28046a7441
commit 2d5b9b1432
7 changed files with 519 additions and 20 deletions
@@ -406,7 +406,7 @@ class TWatchKeyboardScreen : public UIScreen {
uint8_t _channelIdx;
public:
enum Purpose { TWKB_CHANNEL, TWKB_DM, TWKB_ADMIN_PASSWORD, TWKB_ADMIN_CLI, TWKB_PATH };
enum Purpose { TWKB_CHANNEL, TWKB_DM, TWKB_ADMIN_PASSWORD, TWKB_ADMIN_CLI, TWKB_PATH, TWKB_NOTE };
private:
Purpose _purpose;
@@ -507,6 +507,15 @@ public:
return true;
}
void clearOutBuf() { _outLen = 0; _outBuf[0] = 0; }
// Pre-fill the compose buffer (e.g. editing an existing note). Call after
// activateFor(), which clears the buffer; input is clamped at MAXLEN.
void setInitialText(const char* s) {
_outLen = 0;
if (s) {
while (s[_outLen] && _outLen < MAXLEN) { _outBuf[_outLen] = s[_outLen]; _outLen++; }
}
_outBuf[_outLen] = 0;
}
bool wantsExit() const { return _wantsExit; }
void acknowledgeExit() { _wantsExit = false; }
+5 -2
View File
@@ -184,7 +184,10 @@ bool TWatchS3Board::power_init() {
XPOWERS_AXP2101_PKEY_POSITIVE_IRQ);
PMU->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_125MA);
PMU->setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V2);
// The fitted cell (Tewaycell 552530, label verified) is 3.8V nominal LiHV,
// i.e. 4.35V max charge. LilyGoLib's init for this board sets 4V35 for the
// same reason. Charging to 4V2 forfeits the top ~12-15% of capacity.
PMU->setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V35);
PMU->disableTSPinMeasure();
PMU->enableSystemVoltageMeasure();
@@ -223,4 +226,4 @@ uint32_t TWatchS3Board::getStepCount() {
if (!bma423ReadRegs(BMA423_REG_STEP_CNT_OUT, d, 4)) return 0;
return (uint32_t)d[0] | ((uint32_t)d[1] << 8) |
((uint32_t)d[2] << 16) | ((uint32_t)d[3] << 24);
}
}
@@ -91,17 +91,6 @@ class TWatchChannelPicker : public UIScreen {
_highlighted = (uint8_t)((_highlighted + 1) % _numChannels);
ensureVisible();
}
// Map a draw-space y coordinate to a channel index, or -1 if the tap is
// above the list or on an empty row. getTouch() returns coords already
// divided by UI_ZOOM, so _downY is directly comparable to the row layout.
int rowAtY(int y) const {
if (y < HEADER_H) return -1;
int i = (y - HEADER_H) / ROW_H;
if (i < 0 || i >= visibleRows()) return -1;
int ci = _scrollTop + i;
if (ci >= _numChannels) return -1;
return ci;
}
public:
TWatchChannelPicker(DisplayDriver* display)
@@ -148,11 +137,11 @@ public:
_touchDown = false;
unsigned long held = millis() - _downAt;
if (_downX < 20 && _downY < HEADER_H) { _wantsExit = true; return; } // back arrow
int row = rowAtY(_downY);
if (row < 0) return; // tap outside the channel list
_highlighted = (uint8_t)row; // single tap selects the tapped row
ensureVisible();
if (held >= TW_LONG_PRESS_MS) _confirmed = true; // long press opens it
if (held >= TW_LONG_PRESS_MS) {
if (_numChannels > 0) _confirmed = true; // select highlighted
} else {
if (_downY < _display->height() / 2) moveUp(); else moveDown(); // tap zones
}
}
}
@@ -417,7 +406,7 @@ class TWatchKeyboardScreen : public UIScreen {
uint8_t _channelIdx;
public:
enum Purpose { TWKB_CHANNEL, TWKB_DM, TWKB_ADMIN_PASSWORD, TWKB_ADMIN_CLI, TWKB_PATH };
enum Purpose { TWKB_CHANNEL, TWKB_DM, TWKB_ADMIN_PASSWORD, TWKB_ADMIN_CLI, TWKB_PATH, TWKB_NOTE };
private:
Purpose _purpose;
@@ -518,6 +507,15 @@ public:
return true;
}
void clearOutBuf() { _outLen = 0; _outBuf[0] = 0; }
// Pre-fill the compose buffer (e.g. editing an existing note). Call after
// activateFor(), which clears the buffer; input is clamped at MAXLEN.
void setInitialText(const char* s) {
_outLen = 0;
if (s) {
while (s[_outLen] && _outLen < MAXLEN) { _outBuf[_outLen] = s[_outLen]; _outLen++; }
}
_outBuf[_outLen] = 0;
}
bool wantsExit() const { return _wantsExit; }
void acknowledgeExit() { _wantsExit = false; }