Compare commits

...

8 Commits

Author SHA1 Message Date
zyphlar
b7301d51cd
Re-add removed stuff 2024-01-05 13:56:55 -08:00
zyphlar
5c87829d65
Reduce font, adjust to 4 sectors per hour, remove broken inline text color 2024-01-05 13:26:37 -08:00
zyphlar
7cd9e8493d
Compress things a bit 2024-01-05 02:32:50 -08:00
zyphlar
d2989ae23a
Move Fuzzy into Digital, restore Paint 2024-01-05 02:21:58 -08:00
zyphlar
66f6c34b50
disable watchfaceterminal, watchfacecasiostyleg7710, infinipaint for space 2024-01-05 02:07:08 -08:00
zyphlar
6d615b374c
add missing vars 2024-01-05 01:24:48 -08:00
zyphlar
3df7c6a4f3
Emulate dyamon/watchfacefuzzy 2024-01-05 01:13:05 -08:00
zyphlar
e1c652bdfb
build with github 2024-01-05 00:23:31 -08:00
7 changed files with 68 additions and 7 deletions

View File

@ -3,7 +3,7 @@ name: CI
# Run this workflow whenever the build may be affected
on:
push:
branches: [ main ]
branches: [ main, wb/fuzzy, wb/fuzzy-norm ]
paths-ignore:
- 'doc/**'
- '**.md'

View File

@ -9,7 +9,7 @@ namespace Pinetime {
namespace Controllers {
class Settings {
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 Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours };

View File

@ -1,7 +1,10 @@
if(DEFINED ENABLE_USERAPPS)
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
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 ()
add_library(infinitime_apps INTERFACE)

View File

@ -18,7 +18,7 @@
"sources": [
{
"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,

View File

@ -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));
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);
@ -91,7 +95,30 @@ void WatchFaceDigital::Refresh() {
uint8_t hour = dateTimeController.Hours();
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";
if (hour == 0) {
hour = 12;
@ -154,3 +181,31 @@ void WatchFaceDigital::Refresh() {
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",
};

View File

@ -40,6 +40,8 @@ namespace Pinetime {
private:
uint8_t displayedHour = -1;
uint8_t displayedMinute = -1;
static const char* timeSectors[4];
static const char* hourNames[12];
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
Utility::DirtyValue<bool> powerPresent {};

View File

@ -13,9 +13,10 @@ namespace {
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::H24, "24-hour"},
{Pinetime::Controllers::Settings::ClockType::Fuzzy, "Fuzzy"},
}};
std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {