Four-channel Counter Counter Four200210
Four-way Counter / Counter Four A screen with four counters, tap to add one. The interface follows iOS style: light‑gray background, white rounded‑corner cards, large numbers, blue plus button, four cards arranged 2×2, easy to tap. What it can do Four counters count simultaneously: one tap adds one, independent of each other. Suitable for tracking the number of water glasses, standing breaths, repetitions of exercise sets, two…
Four-Channel Counter / Counter Four
Four counters on one screen, tap to add one. The UI follows iOS style: light‑gray background, white rounded‑corner cards, large numbers, blue plus button, four cards arranged 2 × 2, easy to press with a finger.
What It Can Do
- All four counters count simultaneously: one tap adds one, independent of each other. Suitable for tracking water‑glass count, standing repetitions, sets of repeated actions, scores of two teams, etc.
- Each can decrement and be cleared: decrement stops at 0, never goes negative; the “Clear” button at the top‑right of a card only clears that card.
- Each can have a note: tap the top “Note”, select a card, use the on‑screen keyboard to give that channel a name; the original “Count 1” on the card is replaced by your custom label (water, squat, Team A…).
- Dark mode: tap the top “Theme” to toggle; night‑time viewing is easy on the eyes; the choice is remembered for the next launch.
- Clear requires confirmation: the first tap on “Clear” turns the button red and shows “Confirm”; a second tap within 3 seconds actually clears; if no tap occurs within 3 seconds the button reverts, preventing accidental resets.
- Top “Reset” clears all: resets all four counters to zero, start over.
- Auto‑save: every tap, rename, or theme change is written to NVS, so data persists across power loss, reboot, or OTA upgrade.
- Touch‑screen direct operation: 480 × 480 square screen, button size designed for finger use (starting at 56 × 56 px).
How to Use
- Tap the blue + to add one, tap the gray − to subtract one.
- To clear a single card, tap its top‑right Clear; after it turns red to “Confirm”, tap again.
- To rename a channel, tap the top Note → select a card → tap the input field → type with the keyboard → Done (tapping Cancel or the keyboard OK also exits).
- To start over completely, tap the blue Reset at the top‑right.
- If it’s dark, tap Theme to switch to dark mode.
The numeric limit is 999999; when the limit is reached it displays 999999+.
Hardware Requirements
- ESP‑Mosaico development board (ESP32‑S31, 480 × 480 square screen, capacitive touch)
- No microphone, accelerometer, or extra wiring needed
Known Limitations
- Notes can only contain English letters, numbers, and common symbols (the on‑screen keyboard does not provide Chinese pinyin input); use the default “Count 1…4” for Chinese names.
- Notes are limited to 31 characters; if a line does not fit on the card it shows an ellipsis (
…), with the full text visible on the edit page under “Current: …”. - Interface is Chinese‑only.
- Counter values and notes are stored locally, with no multi‑device synchronization.
Implementation Highlights
- UI is generated with ESP‑GSP scene description (
tools/gen_counter_ui.py); at runtime only text and color bindings are changed, not coordinates. - Button callbacks use GSP’s
callbackevent; the app registersesp_gsp_on_eventfor unified handling, without a separate input task. - Text input uses GSP’s
keyboardwidget, attached to the input field’s text binding; only the OK key returns to the app. - Dark mode is implemented with “dual layers”: a light layer and a dark layer each contain a full set of objects; switching toggles visibility, and color changes rely on color bindings.
- Touch is read by the BSP (CST9220) and passed through GSP’s esp_lcd adapter to the pointer classifier.
- Counters are saved in NVS namespace
counterasc0..c3; notes asn0..n3; theme asdark.
License
Code is proprietary; the font uses Noto Sans SC (SIL Open Font License 1.1).
Comments (0)