Compare commits
8 Commits
main
...
wb/fuzzy-n
Author | SHA1 | Date | |
---|---|---|---|
|
b7301d51cd | ||
|
5c87829d65 | ||
|
7cd9e8493d | ||
|
d2989ae23a | ||
|
66f6c34b50 | ||
|
6d615b374c | ||
|
3df7c6a4f3 | ||
|
e1c652bdfb |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -3,7 +3,7 @@ name: CI
|
||||||
# Run this workflow whenever the build may be affected
|
# Run this workflow whenever the build may be affected
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main, wb/fuzzy, wb/fuzzy-norm ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'doc/**'
|
- 'doc/**'
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Pinetime {
|
||||||
namespace Controllers {
|
namespace Controllers {
|
||||||
class Settings {
|
class Settings {
|
||||||
public:
|
public:
|
||||||
enum class ClockType : uint8_t { H24, H12 };
|
enum class ClockType : uint8_t { H24, H12, Fuzzy };
|
||||||
enum class WeatherFormat : uint8_t { Metric, Imperial };
|
enum class WeatherFormat : uint8_t { Metric, Imperial };
|
||||||
enum class Notification : uint8_t { On, Off, Sleep };
|
enum class Notification : uint8_t { On, Off, Sleep };
|
||||||
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
|
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
if(DEFINED ENABLE_USERAPPS)
|
if(DEFINED ENABLE_USERAPPS)
|
||||||
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
|
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
|
||||||
else ()
|
else ()
|
||||||
set(USERAPP_TYPES "Apps::Navigation, Apps::StopWatch, Apps::Alarm, Apps::Timer, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Paint, Apps::Paddle, Apps::Twos, Apps::Metronome" CACHE STRING "List of user apps to build into the firmware")
|
set(USERAPP_TYPES "Apps::Navigation, Apps::StopWatch, Apps::Alarm, Apps::Timer, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Twos" CACHE STRING "List of user apps to build into the firmware")
|
||||||
|
#Apps::Paint,
|
||||||
|
#Apps::Metronome,
|
||||||
|
#Apps::Paddle,
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library(infinitime_apps INTERFACE)
|
add_library(infinitime_apps INTERFACE)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"file": "JetBrainsMono-Regular.ttf",
|
"file": "JetBrainsMono-Regular.ttf",
|
||||||
"range": "0x25, 0x2b, 0x2d, 0x30-0x3a, 0x4b-0x4d, 0x66, 0x69, 0x6b, 0x6d, 0x74"
|
"range": "0x20, 0x25, 0x27, 0x2b, 0x2d, 0x30-0x3a, 0x4b-0x4d, 0x61-0x7a"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bpp": 1,
|
"bpp": 1,
|
||||||
|
|
|
@ -40,7 +40,11 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController,
|
||||||
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
|
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
|
||||||
|
|
||||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) {
|
||||||
|
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
|
||||||
|
} else {
|
||||||
|
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed);
|
||||||
|
}
|
||||||
|
|
||||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
||||||
|
|
||||||
|
@ -91,7 +95,30 @@ void WatchFaceDigital::Refresh() {
|
||||||
uint8_t hour = dateTimeController.Hours();
|
uint8_t hour = dateTimeController.Hours();
|
||||||
uint8_t minute = dateTimeController.Minutes();
|
uint8_t minute = dateTimeController.Minutes();
|
||||||
|
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
/* Begin difference from WatchFaceDigital*/
|
||||||
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) {
|
||||||
|
std::string hourStr, timeStr;
|
||||||
|
hour = hour % 12; // 12 becomes 0, 13 becomes 1
|
||||||
|
auto sector = minute / 15 + (minute % 15 > 7);
|
||||||
|
// advance the hour modulo 12 and reset the minutes if we're close to the top
|
||||||
|
// so we get "quarter to $hour+1" instead of needing "three quarters past $hour"
|
||||||
|
if (sector > 3) {
|
||||||
|
hour = (hour + 1) % 12;
|
||||||
|
sector = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
timeStr = timeSectors[sector];
|
||||||
|
if (timeStr.find("%1") != std::string::npos) {
|
||||||
|
hour = (hour + 1) % 12;
|
||||||
|
}
|
||||||
|
//hourStr = std::string("#") + timeAccent + " " + hourNames[hour] + "#";
|
||||||
|
hourStr = hourNames[hour];
|
||||||
|
timeStr.replace(timeStr.find("%"), 2, hourStr);
|
||||||
|
|
||||||
|
lv_label_set_text(label_time, timeStr.c_str());
|
||||||
|
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
|
||||||
|
/* End difference from WatchFaceDigital*/
|
||||||
|
} else if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||||
char ampmChar[3] = "AM";
|
char ampmChar[3] = "AM";
|
||||||
if (hour == 0) {
|
if (hour == 0) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
|
@ -154,3 +181,31 @@ void WatchFaceDigital::Refresh() {
|
||||||
lv_obj_realign(stepIcon);
|
lv_obj_realign(stepIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Inspired by XFCE4-panel's fuzzy clock.
|
||||||
|
*
|
||||||
|
* https://salsa.debian.org/xfce-team/desktop/xfce4-panel/-/blob/debian/master/plugins/clock/clock-fuzzy.c
|
||||||
|
*
|
||||||
|
* Strings contain either a `%0` or a `%1`, indicating the position of
|
||||||
|
* the `hour` or `hour+1`, respectively.
|
||||||
|
*/
|
||||||
|
const char* WatchFaceDigital::timeSectors[] = {
|
||||||
|
"%0\no'clock",
|
||||||
|
"quarter\npast\n%0",
|
||||||
|
"half past\n%0",
|
||||||
|
"quarter\nto %1",
|
||||||
|
};
|
||||||
|
const char* WatchFaceDigital::hourNames[] = {
|
||||||
|
"twelve",
|
||||||
|
"one",
|
||||||
|
"two",
|
||||||
|
"three",
|
||||||
|
"four",
|
||||||
|
"five",
|
||||||
|
"six",
|
||||||
|
"seven",
|
||||||
|
"eight",
|
||||||
|
"nine",
|
||||||
|
"ten",
|
||||||
|
"eleven",
|
||||||
|
};
|
|
@ -40,6 +40,8 @@ namespace Pinetime {
|
||||||
private:
|
private:
|
||||||
uint8_t displayedHour = -1;
|
uint8_t displayedHour = -1;
|
||||||
uint8_t displayedMinute = -1;
|
uint8_t displayedMinute = -1;
|
||||||
|
static const char* timeSectors[4];
|
||||||
|
static const char* hourNames[12];
|
||||||
|
|
||||||
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
|
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
|
||||||
Utility::DirtyValue<bool> powerPresent {};
|
Utility::DirtyValue<bool> powerPresent {};
|
||||||
|
|
|
@ -13,9 +13,10 @@ namespace {
|
||||||
const char* name;
|
const char* name;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr std::array<Option, 2> options = {{
|
constexpr std::array<Option, 3> options = {{
|
||||||
{Pinetime::Controllers::Settings::ClockType::H12, "12-hour"},
|
{Pinetime::Controllers::Settings::ClockType::H12, "12-hour"},
|
||||||
{Pinetime::Controllers::Settings::ClockType::H24, "24-hour"},
|
{Pinetime::Controllers::Settings::ClockType::H24, "24-hour"},
|
||||||
|
{Pinetime::Controllers::Settings::ClockType::Fuzzy, "Fuzzy"},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
|
std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user