Skip to content

Commit c32b761

Browse files
committed
timer: Add launcher with recent timer history
Replace timer UI with launcher screen showing 4 quick-start options: - Three most recently used timers - Timer button for manual entry Recent timers display MM:SS format and auto-start when selected. Using a recent timer moves it to front of history. Custom button opens timer UI with most recent duration and allows the user to start it manually. Timer history persists across reboots.
1 parent fcc8073 commit c32b761

File tree

6 files changed

+352
-50
lines changed

6 files changed

+352
-50
lines changed

src/components/settings/Settings.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,34 @@ void Settings::SaveSettingsToFile() {
4545
fs.FileWrite(&settingsFile, reinterpret_cast<uint8_t*>(&settings), sizeof(settings));
4646
fs.FileClose(&settingsFile);
4747
}
48+
49+
void Settings::AddTimerDuration(uint32_t duration) {
50+
// Search for existing duration in array
51+
int existingIndex = -1;
52+
for (int i = 0; i < 3; i++) {
53+
if (settings.lastTimerDurations[i] == duration) {
54+
existingIndex = i;
55+
break;
56+
}
57+
}
58+
59+
// If duration already exists, move it to front
60+
if (existingIndex >= 0) {
61+
if (existingIndex == 0) {
62+
// Already at front, no change needed
63+
return;
64+
}
65+
// Shift elements before existingIndex forward by one
66+
for (int i = existingIndex; i > 0; i--) {
67+
settings.lastTimerDurations[i] = settings.lastTimerDurations[i - 1];
68+
}
69+
settings.lastTimerDurations[0] = duration;
70+
} else {
71+
// New duration - shift all down and insert at front
72+
settings.lastTimerDurations[2] = settings.lastTimerDurations[1];
73+
settings.lastTimerDurations[1] = settings.lastTimerDurations[0];
74+
settings.lastTimerDurations[0] = duration;
75+
}
76+
77+
settingsChanged = true;
78+
}

src/components/settings/Settings.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@ namespace Pinetime {
305305
return settings.stepsGoal;
306306
};
307307

308+
uint32_t GetLastTimerDuration(uint8_t index) const {
309+
if (index >= 3) {
310+
return settings.lastTimerDurations[0];
311+
}
312+
return settings.lastTimerDurations[index];
313+
};
314+
315+
void AddTimerDuration(uint32_t duration);
316+
308317
void SetBleRadioEnabled(bool enabled) {
309318
bleRadioEnabled = enabled;
310319
};
@@ -383,6 +392,8 @@ namespace Pinetime {
383392

384393
bool dfuAndFsEnabledOnBoot = false;
385394
uint16_t heartRateBackgroundPeriod = std::numeric_limits<uint16_t>::max(); // Disabled by default
395+
396+
uint32_t lastTimerDurations[3] = {300000, 600000, 900000};
386397
};
387398

388399
SettingsData settings;

src/displayapp/fonts/fonts.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
{
99
"file": "FontAwesome5-Solid+Brands+Regular.woff",
10-
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf0f3, 0xf522, 0xf743, 0xf1ec, 0xf55a, 0xf3ed"
10+
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf0f3, 0xf522, 0xf743, 0xf1ec, 0xf55a, 0xf3ed, 0xf1da, 0xf01e"
1111
}
1212
],
1313
"bpp": 1,
@@ -59,6 +59,10 @@
5959
{
6060
"file": "material-design-icons/MaterialIcons-Regular.ttf",
6161
"range": "0xf00b, 0xe3aa-0xe3ac, 0xe7f6-0xe7f7, 0xe8b8, 0xef44, 0xe40a"
62+
},
63+
{
64+
"file": "FontAwesome5-Solid+Brands+Regular.woff",
65+
"range": "0xf252"
6266
}
6367
],
6468
"bpp": 1,

src/displayapp/screens/Symbols.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ namespace Pinetime {
4242
static constexpr const char* sleep = "\xEE\xBD\x84";
4343
static constexpr const char* calculator = "\xEF\x87\xAC";
4444
static constexpr const char* backspace = "\xEF\x95\x9A";
45+
static constexpr const char* clockRotateLeft = "\xEF\x87\x9A";
46+
static constexpr const char* redo = "\xEF\x80\x9E";
4547

4648
// fontawesome_weathericons.c
4749
// static constexpr const char* sun = "\xEF\x86\x85";

0 commit comments

Comments
 (0)