Skip to content

feat: implement Pomodoro focus timer and WHO-based health reminders#24

Open
sohamdalwadi wants to merge 2 commits into
SeanChangX:mainfrom
sohamdalwadi:feature/new_feature
Open

feat: implement Pomodoro focus timer and WHO-based health reminders#24
sohamdalwadi wants to merge 2 commits into
SeanChangX:mainfrom
sohamdalwadi:feature/new_feature

Conversation

@sohamdalwadi

Copy link
Copy Markdown
Contributor

Overview

This PR introduces two major productivity and wellness features to the QBIT firmware: a classic Pomodoro Focus Timer and a customizable WHO-guided Health Reminder System. Both systems are integrated into the main state machine, utilizing custom display rendering, distinct buzzer melodies, persistent storage, and (for reminders) a web dashboard configuration panel.


Commit 1: Pomodoro Focus Timer (pomodoro_ui.h / pomodoro_ui.cpp)

Introduces a focus tracking loop based on the classic Pomodoro productivity technique:

  • Structured Intervals:
    • Focus Period: 25 minutes of uninterrupted work.
    • Short Break: 5 minutes of rest.
    • Long Break: 15–30 minutes of rest (triggered automatically after 4 completed focus sessions).
  • Visual Interface: Draws a dynamic progress timer inside a custom frame styled explicitly as "Focus Time" on the OLED display.
  • Interactive Controls: Integrated single-tap, double-tap, and long-press gestures to start, pause, reset, or exit the timer loop.
  • Acoustic Cues: Uses specific buzzer tones to cleanly signal transitions between focus periods and breaks.

Commit 2: Health Reminder System (reminder.h / reminder.cpp / /data / web_dashboard.cpp)

Implements an interactive health reminder framework adhering to WHO guidelines to maintain well-being throughout the day:

1. Core Logic & Defaults

  • 💧 Drink Water: Alerts trigger at 2-hour intervals during the active daytime window (08:00–22:00) to ensure proper daily hydration.
  • 🍽️ Meals: Triggers fixed alerts for daily nutrition (Breakfast 08:00, Lunch 13:00, and Dinner 19:00). Includes daily state tracking to guarantee meals alert exactly once per day.
  • 💊 Medicine / Pills: Triggers periodic alerts defaulting to 8-hour intervals between 08:00 and 22:00.
  • Embedded Assets: Features three custom 48x48 monochrome XBM bitmaps representing water drops, plates, and capsules.

2. Display, Melody, & Control Integration

  • Display State: Reminders trigger a 5-second REMINDER_DISPLAY overlay with custom icons and labels. Checking only occurs during idle (GIF_PLAYBACK) to avoid interrupting games or Pomodoro focus sessions.
  • Audible Alerts: Plays a repeating, rhythmic REMINDER_TICK_MELODY (short alarm ticks) that auto-mutes after 5 seconds or instantly upon a screen tap.
  • On-Device Settings: Adds toggles (Water Rmd, Food Rmd, Pills Rmd) to the scrollable Settings menu with persistent NVS storage (qbitRem).

3. Dashboard Web UI & REST API

  • REST Endpoints: Exposes GET /api/reminders and POST /api/reminders to query and save interval configuration.
  • Web Config UI: Added a collapsible Health Reminders card to index.html and script.js inside /data, allowing configuration of time bounds, meal times, and intervals directly from the browser.

@sohamdalwadi

Copy link
Copy Markdown
Contributor Author

@SeanChangX Added 2 new feature to QBIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant