-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.h
More file actions
39 lines (34 loc) · 1.63 KB
/
Copy pathdisplay.h
File metadata and controls
39 lines (34 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <LiquidCrystal.h>
// This is the only preset data the LCD needs for now. Keeping it separate helps Display
// stay focused on rendering instead of knowing about/depending on App's internal config type/constants. tldr no need to pass the entire app config_ to renderConfig :)
struct PresetDurations {
unsigned long focusMs;
unsigned long breakMs;
};
class Display {
public:
Display(LiquidCrystal& dp);
void begin();
void renderTimer(int minutes, int seconds, bool isFocused, bool isPaused, long remainingMs, unsigned long sessionDurationMs);
void renderMenu(int selectedIndex);
void renderConfig(int selectedIndex,
bool buzzerEnabled,
bool quickIsActive,
PresetDurations quickPreset,
PresetDurations longPreset);
// Show the hold-to-confirm overlay, then briefly switch to a confirmed state once
// the hold has completed.
// TODO: The confirmed state still flashes too quickly to feel intentional.
void renderHold(const char* label, unsigned long elapsedMs, unsigned long holdMs, bool isConfirmed);
private:
// Load the LCD's 8 custom-character slots with the bar segments and status icons
// used across the redesigned screens.
void loadCustomChars();
// Write a full LCD row and pad the rest with spaces so old characters disappear.
void writePaddedRow(uint8_t row, const char* text);
// Draw a smoother progress bar by mixing empty cells with partially filled custom
// characters.
void writeSmoothBar(uint8_t row, uint8_t col, uint8_t width, unsigned long elapsedMs, unsigned long totalMs);
LiquidCrystal& lcd_;
};