Commit Graph
1090 Commits
Author SHA1 Message Date
pelgraine fcd2bc7aa6 GBC emulator: Q quits; README documents the emulator
EMULATOR (T-Deck Max)
- Q now quits a running game, matching the back key used across the
  rest of the interface. Shift+Backspace still works. Added as a second
  exit latch in the keyboard driver's raw joypad mode; the on-screen
  hint reads "Q: Quit".
  variants/lilygo_tdeck_max/TCA8418Keyboard.h
  examples/companion_radio/ui-new/GBCEmulatorScreen.{h,cpp}

README
- New "Game Boy / Game Boy Color Emulator (T-Deck Max, v1.14+)"
  subsection under Games: what it is, where to get free homebrew ROMs
  (uCity, Halo: Combat Devolved), where to put them (/roms, .gb/.gbc,
  32 files, names under 48 characters), how to launch and play (key
  table, radio paused and CPU at 240 MHz while a game runs), what the
  picture looks like and why it updates about 1.4 times a second,
  saves (.sav on quit, no RTC state), and the release's limits.
- Contents entry for the new subsection; Games intro mentions the
  Games tile and the Max-only emulator.
- SD Card Requirements lists Game Boy ROMs and saves.
- T-Deck Max intro cross-references the emulator.
- Road-Map: emulator done on the Max; Pro support, ES8311 sound with
  mic-key mute, and RTC save state listed as to-do.
- Third-Party Libraries: Peanut-GB (MIT, Mahyar Koshkouei) added, with
  a note that no Game Boy software is bundled.

Version tags on the new items are v1.14; the global version bump
follows in the next commit.
2026-09-13 01:39:01 +10:00
pelgraine 3647bdcc88 GBC emulator: full speed, 1.5x dithered picture, live keys, ghosting control
Follow-up to the initial Game Boy emulator commit (T-Deck Max).

SPEED (GBCEmulatorScreen.cpp)
- Pacing keeps its deficit: a frame that finishes late is paid back by
  running the next ones back-to-back instead of resetting the deadline
  and forgiving the lost time, which held Pokemon Gold at 0.96x. Only a
  stall of more than 250 ms resyncs. Now measures 1.00x on every 5 s
  window. A 1 ms yield every 30 undelayed frames keeps the idle task
  (and the task watchdog) fed.
- The core context (49952 bytes) is allocated from internal RAM for
  the duration of a game and freed on quit, with PSRAM as the fallback
  if no internal block is free; the launch log says which it got.
- Speed line printed to serial every 5 s (window fps, average, ratio to
  real time).

INPUT (GBCEmulatorScreen.cpp, GxEPDDisplay.h)
- GxEPDDisplay::setBusyCallback() exposes GxEPD2's busy-wait hook. The
  emulator registers a keyboard poll on it while a game runs, so key
  presses and releases are seen through the ~650 ms panel refresh
  instead of waiting for it to finish.

PICTURE (GBCEmulatorScreen.cpp, UITask.cpp, GxEPDDisplay.{h,cpp})
- 1.5x nearest-neighbour scale to 240x216, the full panel width,
  centred; title line removed, quit hint kept.
- Ordered 4x4 Bayer dithering replaces the single threshold: the four
  Game Boy shades map to 0, 6, 11 and 16 dark pixels in 16, so
  sprites with mid-tone colours are no longer flattened to white or
  black. The pattern is fixed to panel position so it does not crawl
  between refreshes.
- UITask: the 800 ms minimum interval between e-ink refreshes is
  lifted while a game runs, so pictures follow at the panel's own
  partial-refresh rate (about 0.7 s).
- GxEPDDisplay::requestFullRefresh(): the next endFrame() uses the
  full black/white waveform regardless of frame change. The emulator
  requests one every 45 pictures (about 30 s) and once on quit, to
  clear the residue that continuous partial refreshes leave on the
  game screen and the home screen after it. No other screen calls it.

Files: examples/companion_radio/ui-new/GBCEmulatorScreen.{h,cpp},
examples/companion_radio/ui-new/UITask.cpp,
src/helpers/ui/GxEPDDisplay.{h,cpp}
2026-09-13 01:23:02 +10:00
pelgraine db9f5ae7b6 Fix Maps tile SD detection; add Garmin BLE build env; Game Boy emulator (T-Deck Max)
MAPS FIX (all T-Deck Pro and Max builds)
Opening Maps from the home tile showed "SD card not found" until the G key
had been pressed once that boot. The map screen's SD flag was only set by
the G key handler; the touch tile and CardKB routes opened the screen
without it. The G handler's setup (SD flag, GPS position, contact markers,
CPU boost) is now openMapScreen() in main.cpp and all three routes call
it. G on the map (re-centre) is unchanged.

PLATFORMIO (variants/lilygo_tdeck_max)
- New meck_max_ble_garmin env for the Garmin watch companion: identical to
  meck_max_ble with BLE_DEBUG_LOGGING, MECK_BLE_JUST_WORKS (no-passkey
  pairing), MECK_BLE_SMALL_MTU_SPLIT (23-byte ATT frame slicing),
  MECK_WATCH_EXT (watch extension commands) and MECK_BLE_SLOW_INTERVAL
  switched on.
- meck_max_ble now has those five flags commented out, so the standard
  phone-app build is isolated from the watch experiments.

GAME BOY / GAME BOY COLOR EMULATOR (T-Deck Max only in this build)
New "Game Boy" entry in the Games menu. Lists .gb/.gbc ROMs in /roms on
the SD card and runs them with the Peanut-GB core (same patched copy as
Meck-P4) in its own task on core 0 at the real 59.73 fps, drawing a
black-and-white snapshot to the e-ink at the panel's refresh rate.
- Keys: W/A/S/D d-pad, K = A, J = B, Enter = Start, Space = Select,
  Shift+Backspace = quit (save written). No sound yet.
- Saves: .sav next to the ROM, written on quit.
- LoRa radio in standby and mesh loop paused while a game runs (reuses
  the OTA pause). CPU held at 240 MHz.
- Keyboard polled through the e-ink busy wait so input is not delayed by
  the ~650 ms refresh; the 800 ms refresh floor is lifted during play.
- Speed line printed to serial every 5 s.
Files:
- ui-new/GBCEmulatorScreen.{h,cpp} (new), ui-new/peanut_gb.h (new)
- ui-new/GamesMenuScreen.h: GAME_GBC entry
- ui-new/UITask.{h,cpp}: gbc_screen, goto/is/get, resetIdleTimer(),
  no refresh floor while a game runs
- main.cpp: launch, exit and key routing
- variants/lilygo_tdeck_max/TCA8418Keyboard.h: raw joypad mode
- src/helpers/ui/GxEPDDisplay.h: setBusyCallback()
Pro builds compile unchanged (all emulator code is guarded).
2026-09-13 00:47:40 +10:00
pelgraine 7ebe1b900f Garmin: Regions: derive per-channel scope key at set/load; BLE slice length byte and relaxed watch interval
- ChannelDetails gains scope_key[16]; MyMesh::setChannel derives it from
  scope_name on every write (screens, serial, phone sync, boot load), so
  sending copies bytes instead of doing a name lookup and derivation per
  message. Port of the Meck Watch regions fix.
- getChannelScopeName now copies out instead of returning a pointer into
  a local (dangling; caused intermittent unscoped sends).
- BLE small-MTU slices become [tag][len][payload] (18 payload bytes) so
  stream transports (nRF52) can find slice boundaries; same format on
  ESP32 for one dialect across nodes and the Garmin app.
- New MECK_BLE_SLOW_INTERVAL flag: request a 100-200 ms connection
  interval instead of 15-20 ms for the watch build.
2026-09-08 06:21:26 +10:00
pelgraine 372bdf8292 Persist per-channel region names in /channels2.scope companion file 2026-09-07 21:01:20 +10:00
pelgraine 312df5a6f2 Garmin: MECK_WATCH_EXT: favourite-N and prefix-resolve 2026-09-07 20:24:23 +10:00
pelgraine 5fe4942c87 Garmin additions - trace and discover support added into mymesh 2026-09-07 19:00:06 +10:00
pelgraine 7c39700770 Garmin MECK_WATCH_EXT: watch-client commands, rich channel frame, canned/scope/heard-by reads 2026-09-07 17:53:29 +10:00
pelgraine fe13fc96a9 BLE: recover deviceConnected when auth completes before GATT connect 2026-09-07 06:43:57 +10:00
pelgraine c40e5e20be Canned messages (Max), 40 MHz test builds, Pro v1.1 HYN touch, Pro audio Phone tile removal
Canned messages (T-Deck Max only):
- NodePrefs gains canned_msgs[10][134] as the final field; DataStore load is short-read tolerant (older prefs upgrade to empty slots), NUL-forced, appended in savePrefs. Storage is shared across boards so the prefs layout stays uniform; the Settings entry point is gated to the Max.
- Settings -> Canned Messages: ten slots, full-length inline editor (tail + n/133 counter); Enter commits, empty clears, Sh+Del cancels. T5S3 VKB path exists behind the same gate.
- Channel screen overlay: the speech-bubble pad toggles the list on a channel or DM conversation; tapping a row sends via sendComposedMessage() (channel -> that channel, DM conversation -> DM to that contact); all-empty shows an alert. Other screens keep the channel-picker action.
- Post-test fixes: tap intercept moved ahead of the vy<18 go-home rule that ate row taps and left the overlay stuck; any keyboard key closes the overlay in handleKeyboardInput (keys never reach ChannelScreen::handleInput on Pro/Max); setViewChannelIdx resets overlay state like the path overlay.

40 MHz extreme-battery test builds: meck_max_standalone_40mhz, meck_audio_standalone_40mhz, meck_4g_standalone_40mhz. CPU idle/boost/low-power all 40 MHz; MECK_40MHZ_TEST gates the modem (forced off, config kept), GPS (rail off, page hidden), browser/OTA, alarms, audio features and notification MP3s; gated tiles dither and go inert; MESH_DEBUG=1. The Pro envs deliberately re-run the March 80->40 TCA8418 config (noted in env comments).

T-Deck Pro v1.1 HYN touch (meck_audio_ble_hyn, Meck v1.12.6.HYN): opt-in MECK_PRO_HYN_TOUCH switches touch to the vendored Hynitron driver, auto-detecting CST3530/CST328 at 0x1A. Seven driver guards widened; XL9555 callbacks stay Max-only; explicit config SDA13/SCL14/RST38/INT12; the manual GPIO38 reset pulse is suppressed (driver self-resets); readTouch and the 4G dialer dispatch widened. Link fix: ui-new/*.c added to the env src filter (the cst66xx/cst3xx/cst226se providers were not compiled). Confirmed working by an affected v1.1 (CST3530) user.

Pro audio builds: the full-width Phone tile is no longer rendered (no modem; its tap was already inert).
2026-08-13 20:01:21 +10:00
pelgraine b01e78322e Test T-Deck Max 40mhz extreme battery saving build, gating out all features that would require more than 40mhz CPU including gps. Confirmed touch and keyboard navigation and serial output working for meck_max_standalone_40mhz 2026-08-12 21:28:37 +10:00
pelgraine 50ba2f5119 update firmware build date 2026-07-26 15:32:41 +10:00
pelgraine 213e7d6b9e Footer fixes when the N was truncated.
Added new Contacts screen for phone contacts for Pro 4G and Max.

Added touch recognition to phone screen app menu.
2026-07-26 15:23:34 +10:00
pelgraine 0a2e736ba5 Max backlight bugfix - light was occasionally still remaining on when the autolockscreen timer activated. Now turning off as it should 2026-07-25 16:53:53 +10:00
pelgraine f485596c74 Update firmware version and build date for Max and Pro 4G. Fix accidentally Max battery size change commit 2026-07-25 16:42:29 +10:00
pelgraine 922f0e3c17 New Max home UI on all T-Deck Pro builds; Call Log; lock screen notifications
Home UI
- Widen the tile-grid home screen (e1300190) from Max-only to all T-Deck Pro
  builds: guard flips from LilyGo_TDeck_Pro_Max to LilyGo_TDeck_Pro at five
  sites in UITask.cpp (HomeIcons include, tile-flag set/reset, page-dot
  offset, tile render block) and at the touch hit-test in main.cpp. Max
  defines both flags, so Max behaviour is unchanged -- verified by diffing
  both files preprocessed with the Max define set.

Call Log (HAS_4G_MODEM)
- New CALL_LOG subview; app menu is now Dial / SMS Inbox / Call Log.
- SMSStore gains a fixed-size CallLogRecord store in /sms/calllog.dat
  (timestamp, duration, type, seen, phone), capped at 32 entries with the
  oldest trimmed on append: appendCallLog, loadCallLog (newest first),
  deleteCallLogEntry (rewrite via tmp + rename) and markMissedSeen
  (in-place flag update). Same SD idioms as the SMS store.
- Logs incoming and outgoing calls with duration, plus missed, busy and
  no-answer attempts. Calls arriving with no caller ID are logged and shown
  as "Unknown" rather than dropped.
- List mirrors inbox conventions: contact name via SMSContacts, detail line
  with type, duration and local date/time. Enter dials, D deletes, Q backs
  out. Menu row carries an unseen-missed [n] badge matching SMS Inbox.

Lock screen (HAS_4G_MODEM)
- Show outstanding unread SMS and unseen missed calls at height()-12 with
  setTextSize(1). Counts derive from the inbox read flags and call log seen
  flags, so they persist across re-locks and reboots and clear only when the
  conversation or the Call Log is opened. State loads at boot in
  setSDReady().

Phone screen fixes
- An incoming call now drops the lock screen. Keyboard and touch input are
  both blocked while locked, which left the ringing screen unable to answer
  or reject. The device stays unlocked afterwards.
- gotoSMSScreen() no longer calls activate() mid-call, which was resetting
  the view to the app menu and wiping the ringing screen.
- Widen the app menu footer right margin so "Ent:Open" is not clipped.
2026-07-25 16:40:01 +10:00
pelgraine e130019061 New Max Home UI design 2026-07-21 19:03:52 +10:00
pelgraine 409ab81760 Forgot to add Australia mid preset whoops 2026-07-20 22:44:00 +10:00
pelgraine e447b17f37 Remove T-Watch code from repo 2026-07-19 11:55:31 +10:00
pelgraine 1d03b64e92 T-Watch: added heard by details for outgoing messages - accessible via boot button for S3 Plus or power button on S3 on outgoing selected messages (tap to select message). 2026-07-19 11:03:06 +10:00
pelgraine 4b84f92088 T-Watch S3 - made gamescreen replacement for the alarm time and updated games ui hint text & tap steering method(s). Increased snake speed for the watch 2026-07-18 19:19:09 +10:00
pelgraine 45aebd5bfe T-Watch S3 - watch alarm screen and associated diagnostic build removed due to power drain issue 2026-07-18 18:47:27 +10:00
pelgraine b90edc5995 T-Decks Pro & Max: reverted back to Q to exit in most instances (not involving text entry, where it remains sh+del to exit) 2026-07-18 18:16:27 +10:00
pelgraine b9e59953e6 T-Watch - fixed datastore chunked save trigger so contacts import from ble app are saved properly, overriding usual 12hr trigger in that instance 2026-07-18 14:13:48 +10:00
pelgraine 4f8cceea24 T-Watch update firmware version and build date 2026-07-18 13:57:42 +10:00
pelgraine c360850773 T-Watch = contacts screen overlay enabling favouriting/deleting on long press. Favourites toaster popup confirmation 1-3 seconds after favourite enabled 2026-07-18 13:56:43 +10:00
pelgraine 82982002be T-Watch - fix touch and ui bugs so that ticker scroll display works for longer text rows, and long press to open rx log 2026-07-18 12:03:41 +10:00
pelgraine 2cf7945136 T-Watch - update settingscreen touch so rxlog displays on watch with auto-scroll updates.
Added persistent channel message history with swipe to scroll up and down.
2026-07-17 22:02:16 +10:00
pelgraine 619e8f44a5 T-Watch: fix discovery screen wrap. Add no alarm tick s3 temp diagnostic build and removed prior faulty temp no pmu diagnostic build. Updated tracescreen.h functionality and UI for t-watch builds. 2026-07-17 19:29:15 +10:00
Pelgraine 6192e31d91 created temp env:meck_twatch_s3_diag_nopmu. Moved watchchannelconfigscreen.h to correct folder 2026-07-15 22:30:21 +10:00
Pelgraine 6f389e46e5 Removed faulty meck_twatch_s3_plus_diag_pmubtn build. Updated Twatchs3plusboard charge rate to 200MA and voltage to 4V35 2026-07-15 22:07:33 +10:00
pelgraine ade92cf1e1 All Boards DM delivery confirmation fixes & T-Watch build additions and updates.
T-Watch:

Disabled rx boosted gain & removed meck rx duty cycle flag for S3 and S3 Plus.
Bumped charge rate on S3 to 150MA.
Added watch custom incoming path/hops view in channel message view mode.
Added diagnostic pmubtn build to S3 plus to iron out source of power drain in S3 firmware.

All boards:
ChannelScreen.h -- delivered DMs now render Delivered  in the prefix position, exactly where Sending x/N and Failed sit, and the drawn tick is gone entirely (the branch, the reserved gap and the drawDeliveredTick helper -- zero references remain). For what it's worth, the photo vindicates the change: those stray pixels below the line next to "2s" are the tick misplaced, because the GFX fonts position from the baseline rather than the glyph top, so the hand-drawn glyph landed too low. Text is the robust answer.
UITask.cpp -- the toast persistence is a scheduling starvation, and the status pushes made it visible. Dismissal works by scheduling a render at _alert_expiry; but after every frame the e-ink throttle applies an 800ms floor (minNext, UITask.cpp:2856-2860), and the ~644ms partial-refresh block inside endFrame() shifts millis() before the clamp runs. So any render landing inside the alert window -- which a delivered/attempt push now triggers via forceRefresh() -- redraws the overlay and then gets its expiry wake clamped past the expiry. Your user's photo is precisely that frame: tick and toast on screen together, with the clearing render deferred. The fix is a single insertion after the shared clamp: if an alert is still active and lapses before the next scheduled render, wake at expiry instead. One bounded extra render per toast, both display branches covered, and the toast now clears on time no matter what the retry engine pushes mid-window.
2026-07-15 20:55:37 +10:00
pelgraine 4f28d22217 Add device-side DM retries with Sending x/N counter, delivered tick and Failed status in conversation view.
Tracked DM sends now retry like the app: 3 flood attempts with no path
set, or 5 with a path (4 direct, then path reset and a final flood).
Each attempt waits its own hop-aware est_timeout. Delivered resolves on
the recipient's ack for any attempt and draws a tick after the message
prefix; Failed shows once all attempts are exhausted.

Status is session-only: SD message format unchanged at v4. Wired for
keyboard, touch, CardKB and T-Watch compose plus channel share. BLE app
sends and the voice envelope path are untouched.
2026-07-15 07:11:06 +10:00
pelgraine 43b1ba082b Update firmware version and build date 2026-07-15 06:16:31 +10:00
pelgraine 3e40ccbaa1 T-Watch - amend text wrap on settingscreen 2026-07-15 06:14:11 +10:00
pelgraine 5ce0540486 T-Watch: standalone channel config screen (region, notifications, delete)
The SettingsScreen SUB_CHANNELS sub-screen drives every per-channel
action from physical-keyboard hotkeys (Ent: scope, N: notif, T: tone,
X/Hold: delete), so on the touch-only watches the channel list rendered
but nothing was actionable. Replace it on MECK_TWATCH builds with a
standalone WatchChannelConfigScreen following the WatchAlarmScreen /
WatchNotesScreen conventions. Desktop builds are unchanged.

LIST shows each channel with its region scope tag and notification
state (tap to select, tap again or button to open, paged like Notes).
DETAIL offers: Region -- opens the watch keyboard via a new TWKB_SCOPE
purpose, pre-filled with the current scope, committed through the same
setChannel + saveChannels path as desktop (empty submission clears);
Clear region -- reverts to the device default directly; Notify --
tap-cycles All -> Mentions -> Off with savePrefs, matching the desktop
N-key order. Delete is button-driven rather than touch: a short press
(PWR on the S3, boot button on the Plus) arms it, a second press
within 3s confirms. Channel 0 remains protected. The tone picker is
deliberately absent -- the watch has no audio path.

Settings hands off via a _wantsWatchChannels flag polled by
UITask::loop (mirrors the _needsTextVKB handshake); Back returns to
Settings via gotoSettingsScreen. Keyboard results route through the
existing consumeSendRequest purpose dispatch.

Note: deleteChannel replicates SettingsScreen's compaction verbatim,
including its existing quirk of not shifting channel_notif[] -- kept
faithful rather than silently diverging; fix both together if desired.

Files: WatchChannelConfigScreen.h (new, both variant dirs),
TWatchComposeScreens.h (both variant dirs, TWKB_SCOPE),
SettingsScreen.h, UITask.h, UITask.cpp, main.cpp
2026-07-14 21:02:49 +10:00
pelgraine 2d5b9b1432 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.
2026-07-14 18:54:46 +10:00
Pelgraine acf8066b5f T-watch: add utc, tx power, path hash size selector behaviour gating for watch in main cpp for touch fix 2026-07-12 23:31:53 +10:00
Pelgraine 2dd1b24fdf T-Watch: fix path editor screen setting for repeater admin via custom paths.
Fix haptic power for watch s3
2026-07-12 22:48:07 +10:00
Pelgraine 8b196b2d7a T-Watch fix:
S3 (MECK_PMU_BUTTON) — short PWR click on Contacts opens the path editor for the selected contact; anywhere else it's still enter/select (KEY_ENTER); first click on a dark screen just wakes it. The existing comment is now actually true.
S3 Plus (LILYGO_TWATCH_S3_PLUS) — boot button restored: click on Contacts opens the path editor; elsewhere wakes / KEY_NEXT as before.
2026-07-12 22:01:46 +10:00
pelgraine 2b31e56e4c T-Watch changes:
CPUPowerManager.h — S3 variant, CPU_FREQ_BOOST capped to 80 MHz.
main.cpp — locked-loop throttle extended to the watches via the two MECK_TWATCH guard additions.
2026-07-12 20:07:18 +10:00
pelgraine 29f60c5bcd Contacts: cap chunked save to twice a day; flush on low battery
Throttle the ESP32 lazy contact save from a 5s debounce to a 12h
interval (CONTACTS_SAVE_INTERVAL). A new _nextContactSaveDue anchors
the next flush 12h out on the first dirty pass and only writes once
reached, clearing after each save so the next dirty event re-anchors.
Cuts the recurring ~95KB LittleFS rewrites on busy meshes. nRF52/STM32
blocking-save path unchanged.

Flush contacts (blocking) in the AUTO_SHUTDOWN_MILLIVOLTS path before
shutdown() so low-battery power-off doesn't drop up to 12h of contact
learning. Manual power-off left untouched.

Gate the SHUTDOWN home page out on the watch (MECK_TWATCH): removed
from the HomePage enum with render/input/isOnShutdownPage guarded.
The AXP2101 PWR-button long-press is the shutdown path there.

Files: MyMesh.h, MyMesh.cpp, UITask.cpp
2026-07-12 17:37:04 +10:00
pelgraine 1c0778b00e T-Watch: fix touch method for tw_picker 2026-07-12 15:02:50 +10:00
meck 006d3bd00c T-Watch S3: alarm rings for the full 5 minutes, PWR key dismisses
The alarm was self-dismissing after ~10-15 seconds. Cause: AUTO_OFF_MILLIS is
15000, so the display turned off shortly after the alarm fired; UITask.cpp:2769
raise-to-wake then saw !_display->isOn() && board.tiltFired() -- the buzzing motor
on the wrist is exactly what trips the BMA423 tilt detector -- and called
setCurrScreen(lock_screen). The 'navigating away counts as a dismiss' rule added
with the alarm screen then killed it. Any tap did the same.

While ringing, UITask::loop now holds the alarm screen current and pushes
_auto_off forward each iteration. The display therefore stays on, raise-to-wake
is never reached, and checkDisplayOn() passes KEY_ENTER through to handleInput()
rather than swallowing the first press as a wake.

Dismissal is now the PWR key only (KEY_ENTER). Taps are swallowed. The
WATCH_ALARM_RINGING_MS timeout (5 minutes) is unchanged and remains the backstop.
Ringing footer updated from 'Tap to dismiss' to 'Press PWR to dismiss'.

The ordering inside loop() makes this safe: the button dispatch and
curr->handleInput() both run before the alarm hold, so a dismiss takes effect on
the same iteration and the hold is not re-applied. The 90s per-slot fire cooldown
prevents an immediate re-fire within the alarm's own minute.
2026-07-10 20:13:18 +10:00
pelgraine fcd8b70384 Watches: persistent step counts + 7-day history subscreen
Fixes a pre-existing bug on both watches. SensorBMA423::begin() calls
bma423_write_config_file(), which re-flashes the BMA423 feature engine and zeroes
the step register on every boot. _stepBaseline and _lastStepDay were RAM-only, so
a reboot mid-day silently reset the day's steps to zero. Persisting the baseline
would not have helped, since the raw count it is measured against restarts at 0.

Replaces the baseline model with accumulate-plus-reset-detection:

  delta = (raw >= lastRaw) ? raw - lastRaw : raw
  todaySteps += delta

lastRaw is seeded from the chip on the first read rather than from the file,
which is correct whether or not the counter survived the reset.

Persists lastStepDay, todaySteps and history[6] to /steps.dat on the LittleFS
'maps' partition, already mounted before UITask::begin(). Written on day rollover
and at most every 5 minutes otherwise: a >=6s PWR hold is a hardware power cut by
the AXP2101, so there is no clean-shutdown hook to flush from. A rollover across
several days shifts in the completed day then pads with zeros for the days the
watch was off; a clock corrected backwards re-anchors without disturbing history.

Adds StepsHistoryScreen: today plus the previous six days as labelled bars, today
in the tile blue. Reached by long-pressing the steps screen, which on the S3 the
PWR key's short press also delivers (both arrive as KEY_ENTER). Any input returns
to the steps screen.

Gated on MECK_TWATCH, so the Plus gets both the fix and the screen.
2026-07-10 20:04:16 +10:00
meck 9754f93504 T-Watch S3: vibrate alarm clock in place of the Maps tile
Fixes a regression from the MECK_TWATCH rename. main.cpp's tap dispatch had
'#if defined(MECK_TWATCH) && HAS_GPS' wrapped around two unrelated things: the
map tap handler AND the early return that stops the watch falling through to the
T5S3 tile hit-test. MECK_TOUCH_ENABLED is defined for MECK_TWATCH (main.cpp:712),
so on the S3 that early return vanished and a plain tap on the home tile page ran
the T5S3 geometry (tileW=40, tileH=22). Split into two gates. The other three
HAS_GPS gates were audited and are genuinely map-only.

Adds WatchAlarmScreen: four slots, day-of-week presets, vibrate-only. It keeps
AlarmScreen.h's conventions (bit 0 = Sunday, dowFromEpoch, effect 14, the
3-buzz / 1200ms / 4000ms-pause cadence) but shares no code, because AlarmScreen
is bound to ESP32-audioI2S, an SD card and a 1-21 Audio volume scale, none of
which exist here. Config lives on the LittleFS 'maps' partition, already mounted.

Alarms are ticked from UITask::loop, not the screen's poll(), so one fires with
the display off or another screen showing. Navigating away while ringing counts
as a dismiss.

DRV2605Haptic.h is copied into the watch variant rather than shared, so MAX
builds are untouched. The watch needs no motorEnable(): the DRV2605 sits on
BLDO2, which power_init() already brings up.

The Maps tile becomes Alarms on LILYGO_TWATCH_S3 only. The Plus keeps Maps.
The 'buzz' CLI command now also builds on the watch and takes an optional effect
number ('buzz 14'), for characterising the motor. Exact-match behaviour of plain
'buzz' on the MAX is unchanged.
2026-07-10 19:39:18 +10:00
pelgraine cf4105ee7d Add LilyGo T-Watch S3 variant (non-GPS, 470 mAh)
Same silicon and the same pin map as the T-Watch S3 Plus, verified against the
T_WATCH-S3 schematic (rev 25-03-24) and LilyGo's utilities.h. The differences
are what is populated:

  - no onboard GNSS. HAS_GPS/ENV_INCLUDE_GPS are left undefined, which drops the
    map screen, the GPS home page and BLDO1 rail control via the gates added in
    the MECK_TWATCH rename.
  - no GPIO button. Schematic sheet 1 wires the side switch SW7 to net PWR_KEY
    -> AXP2101 pin 30 (PWRON), so PIN_USER_BTN is undefined and MECK_PMU_BUTTON
    selects PMUButton, which reads PKEY interrupts over I2C. Short press is
    enter/select; a 6s hold is a hardware power-off the firmware never sees.
  - DLDO1 is the MAX98357A speaker rail (schematic sheet 6, net SPK_VDD), not
    'unused' as LilyGo's doc claims. It stays off, so the amp is unpowered.
  - VBACKUP is enabled at 3300 mV. It charges the MS412FE coin cell (J12) that
    backs the PCF8563's single-VDD supply. Leaving it off drained the cell with
    nothing to replenish it.

New envs: meck_twatch_s3_standalone, meck_twatch_s3_ble.
No existing board is affected: MECK_PMU_BUTTON is defined only here.
2026-07-10 18:57:09 +10:00
pelgraine 0fa7a321bf Rename LILYGO_TWATCH_S3_PLUS to MECK_TWATCH as the watch form-factor gate
The macro was doing double duty: gating the 240x240 touch UI (tile grid, lock
screen, VKB, grey palette) and gating the Plus's onboard GNSS. A non-GPS watch
cannot reuse the first without dragging in the second.

  MECK_TWATCH             watch form factor
  LILYGO_TWATCH_S3_PLUS   Plus-only hardware (GNSS on BLDO1, GPIO0 user button)
  MECK_PMU_BUTTON         user button is the AXP2101 PWRON key, not a GPIO

84 sites renamed across 14 files. The WatchMapScreen include, construction and
its three touch handlers now also require HAS_GPS, as does the Maps tile branch
inside the home tile grid.

Behaviour-preserving: the Plus defines both MECK_TWATCH and HAS_GPS=1, so every
new condition evaluates as before. No other board defines MECK_TWATCH.
2026-07-10 18:40:53 +10:00
pelgraine 732cc2e8b2 T-watch: fix gps toggle bug caused by previous spiffs+littlefs partition additions wipe and update 2026-07-09 18:55:51 +10:00
Pelgraine ada989ea72 t-watch: spiffs+littlefs partition, maps initial support 2026-07-09 06:32:57 +10:00