FuckTime 2.1

This commit is contained in:
Will Bradley 2024-12-07 10:54:55 -08:00
parent 0cae5609ae
commit 7f52473337
Signed by: will
GPG Key ID: 7753374769D155F8
6 changed files with 252 additions and 71 deletions

View File

@ -1,4 +1,4 @@
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20 set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20 jetbrains_mono_14
jetbrains_mono_extrabold_compressed lv_font_sys_48 jetbrains_mono_extrabold_compressed lv_font_sys_48
open_sans_light fontawesome_weathericons) open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED

Binary file not shown.

View File

@ -1,4 +1,18 @@
{ {
"jetbrains_mono_14": {
"sources": [
{
"file": "JetBrainsMono-Regular.ttf",
"range": "0x20-0x7e, 0x410-0x44f, 0xB0"
},
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "大雪"
}
],
"bpp": 1,
"size": 14
},
"jetbrains_mono_bold_20": { "jetbrains_mono_bold_20": {
"sources": [ "sources": [
{ {
@ -54,6 +68,16 @@
"bpp": 1, "bpp": 1,
"size": 150 "size": 150
}, },
"noto_serif_cjk_14": {
"sources": [
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "大雪"
}
],
"bpp": 1,
"size": 14
},
"lv_font_sys_48": { "lv_font_sys_48": {
"sources": [ "sources": [
{ {

View File

@ -29,28 +29,165 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
motionController {motionController} { motionController {motionController} {
/*Create an array for the points of the line*/ /*Create an array for the points of the line*/
progress_points[0] = {0, 0}; // progress_points[0] = {0, 0};
progress_points[1] = {0, 0}; // progress_points[1] = {0, 0};
/*Create style*/ static lv_style_t style_now_line;
static lv_style_t style_progress; lv_style_init(&style_now_line);
lv_style_init(&style_progress); lv_style_set_line_width(&style_now_line, LV_STATE_DEFAULT, 1);
lv_style_set_line_width(&style_progress, LV_STATE_DEFAULT, LV_HOR_RES); lv_style_set_line_color(&style_now_line, LV_STATE_DEFAULT, LV_COLOR_RED);
lv_style_set_line_color(&style_progress, LV_STATE_DEFAULT, LV_COLOR_BLUE); // todo: #11cc55 // lv_style_set_line_rounded(&style_now_line, LV_STATE_DEFAULT, true);
// lv_style_set_line_rounded(&style_progress, LV_STATE_DEFAULT, true);
/*Create a line and apply the new style*/ /*Create a line and apply the new style*/
progress_line = lv_line_create(lv_scr_act(), NULL); now_line = lv_line_create(lv_scr_act(), NULL);
lv_line_set_points(progress_line, progress_points, 2); /*Set the points*/ static lv_point_t line_points[] = { {40, 2}, {40, 50}};
lv_obj_add_style(progress_line, LV_LINE_PART_MAIN, &style_progress); /*Set the points*/ lv_line_set_points(now_line, line_points, 2);
lv_obj_align(progress_line, NULL, LV_ALIGN_IN_TOP_MID, 0, 0); lv_obj_add_style(now_line, LV_LINE_PART_MAIN, &style_now_line);
lv_obj_align(now_line, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
/* Current calendar */ static lv_style_t style_event;
label_now = lv_label_create(lv_scr_act(), nullptr); lv_style_init(&style_event);
lv_label_set_recolor(label_now, true); lv_style_set_radius(&style_event, LV_STATE_DEFAULT, 5);
lv_obj_align(label_now, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 10); lv_style_set_bg_opa(&style_event, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_label_set_long_mode(label_now, LV_LABEL_LONG_BREAK); lv_style_set_bg_color(&style_event, LV_STATE_DEFAULT, LV_COLOR_MAGENTA);
lv_obj_set_width(label_now, LV_HOR_RES-5); lv_style_set_pad_top(&style_event, LV_STATE_DEFAULT, 2);
lv_style_set_pad_bottom(&style_event, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_event, LV_STATE_DEFAULT, 5);
lv_style_set_pad_right(&style_event, LV_STATE_DEFAULT, 5);
lv_style_set_text_font(&style_event, LV_STATE_DEFAULT, &jetbrains_mono_14);
static lv_style_t style_flex;
lv_style_init(&style_flex);
lv_style_copy(&style_flex, &style_event);
lv_style_set_bg_color(&style_flex, LV_STATE_DEFAULT, LV_COLOR_PURPLE);
static lv_style_t style_season;
lv_style_init(&style_season);
lv_style_copy(&style_season, &style_event);
lv_style_set_bg_color(&style_season, LV_STATE_DEFAULT, LV_COLOR_GREEN);
static lv_style_t style_actualization;
lv_style_init(&style_actualization);
lv_style_copy(&style_actualization, &style_event);
lv_style_set_bg_color(&style_actualization, LV_STATE_DEFAULT, LV_COLOR_TEAL);
static lv_style_t style_community;
lv_style_init(&style_community);
lv_style_copy(&style_community, &style_event);
lv_style_set_bg_color(&style_community, LV_STATE_DEFAULT, LV_COLOR_OLIVE);
/* Fixed events */
// lv_obj_t* lbl_event;
// lbl_event = lv_label_create(lv_scr_act(), nullptr);
// lv_label_set_recolor(lbl_event, true);
// lv_obj_add_style(lbl_event, LV_LABEL_PART_MAIN, &style_event);
// lv_obj_align(lbl_event, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 10);
// lv_label_set_long_mode(lbl_event, LV_LABEL_LONG_BREAK);
// lv_obj_set_width(lbl_event, LV_HOR_RES/3);
// lv_label_set_text_fmt(lbl_event, "Foo Bar");
lv_obj_t* lbl_prior_event;
for(int i=0;i<sizeof(fixedtime)/sizeof(CalendarEntry);i++){
lv_obj_t* lbl_event2;
lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(lbl_event2, true);
lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_event);
if (i==0) {
lv_obj_align(lbl_event2, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 10);
} else {
lv_obj_align(lbl_event2, lbl_prior_event, LV_ALIGN_OUT_RIGHT_TOP, 5, 0);
}
lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_BREAK);
lv_obj_set_width(lbl_event2, LV_HOR_RES/3);
lv_label_set_text_fmt(lbl_event2, fixedtime[i].name);
fixedtime_labels[i] = lbl_event2;
lbl_prior_event = lbl_event2;
}
for(int i=0;i<sizeof(flextime)/sizeof(TaskEntry);i++){
lv_obj_t* lbl_event2;
lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(lbl_event2, true);
lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_flex);
if (i==0) {
lv_obj_align(lbl_event2, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 60);
} else {
lv_obj_align(lbl_event2, lbl_prior_event, LV_ALIGN_OUT_RIGHT_TOP, 5, 0);
}
lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_BREAK);
lv_obj_set_width(lbl_event2, LV_HOR_RES/3);
lv_label_set_text_fmt(lbl_event2, flextime[i].name);
lbl_prior_event = lbl_event2;
}
for(int i=0;i<sizeof(season)/sizeof(TaskEntry);i++){
lv_obj_t* lbl_event2;
lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(lbl_event2, true);
lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_season);
if (i==0) {
lv_obj_align(lbl_event2, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 125);
} else {
lv_obj_align(lbl_event2, lbl_prior_event, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
}
lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_BREAK);
lv_obj_set_width(lbl_event2, LV_HOR_RES-10);
lv_label_set_text_fmt(lbl_event2, season[i].name);
lv_label_set_align(lbl_event2, LV_LABEL_ALIGN_CENTER);
lbl_prior_event = lbl_event2;
}
for(int i=0;i<sizeof(actualization)/sizeof(TaskEntry);i++){
lv_obj_t* lbl_event2;
lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(lbl_event2, true);
lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_actualization);
if (i==0) {
lv_obj_align(lbl_event2, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 155);
} else {
lv_obj_align(lbl_event2, lbl_prior_event, LV_ALIGN_OUT_RIGHT_TOP, 5, 0);
}
lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_BREAK);
lv_obj_set_width(lbl_event2, LV_HOR_RES/2-5);
lv_label_set_text_fmt(lbl_event2, actualization[i].name);
lbl_prior_event = lbl_event2;
}
for(int i=0;i<sizeof(community)/sizeof(TaskEntry);i++){
lv_obj_t* lbl_event2;
lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(lbl_event2, true);
lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_community);
if (i==0) {
lv_obj_align(lbl_event2, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 205);
} else {
lv_obj_align(lbl_event2, lbl_prior_event, LV_ALIGN_OUT_RIGHT_TOP, 5, 0);
}
// lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_BREAK);
// lv_obj_set_width(lbl_event2, LV_HOR_RES*0.55);
lv_label_set_text_fmt(lbl_event2, community[i].name);
lbl_prior_event = lbl_event2;
}
// lv_obj_t* lbl_event2;
// lbl_event2 = lv_label_create(lv_scr_act(), nullptr);
// lv_label_set_recolor(lbl_event2, true);
// lv_obj_add_style(lbl_event2, LV_LABEL_PART_MAIN, &style_event);
// lv_obj_align(lbl_event2, lbl_event, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
// // lv_label_set_long_mode(lbl_event2, LV_LABEL_LONG_SROLL);
// lv_label_set_text_fmt(lbl_event2, "Baz Bing Boom");
// lv_obj_set_width(lbl_event2, LV_HOR_RES-5);
// lv_obj_set_height(label_now, 40); // lv_obj_set_height(label_now, 40);
// batteryValue = lv_label_create(lv_scr_act(), nullptr); // batteryValue = lv_label_create(lv_scr_act(), nullptr);
@ -64,13 +201,6 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
notificationIcon = lv_label_create(lv_scr_act(), nullptr); notificationIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100);
label_next = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label_next, true);
lv_obj_align(label_next, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -40);
lv_label_set_long_mode(label_next, LV_LABEL_LONG_BREAK);
lv_obj_set_width(label_next, LV_HOR_RES-5);
// lv_obj_set_height(label_next, 40);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
Refresh(); Refresh();
} }
@ -80,28 +210,40 @@ WatchFaceTerminal::~WatchFaceTerminal() {
lv_obj_clean(lv_scr_act()); lv_obj_clean(lv_scr_act());
} }
uint32_t timeOffset = 0;
void WatchFaceTerminal::Refresh() { void WatchFaceTerminal::Refresh() {
if (currentDuration == 0) { // if (currentDuration == 0) {
lv_label_set_text_fmt(label_now, "#007fff Now:# %s",calendar[calIndex].name); // lv_label_set_text_fmt(label_now, "#007fff Now:# %s",calendar[calIndex].name);
if (calIndex+1 < sizeof(calendar)/sizeof(CalendarEntry)) { // if (calIndex+1 < sizeof(calendar)/sizeof(CalendarEntry)) {
lv_label_set_text_fmt(label_next, "#ee3377 Next:# %s", calendar[calIndex+1].name); // lv_label_set_text_fmt(label_next, "#ee3377 Next:# %s", calendar[calIndex+1].name);
} else { // } else {
lv_label_set_text_fmt(label_next, ""); // lv_label_set_text_fmt(label_next, "");
} // }
} // }
progress_points[1] = {0,(lv_coord_t)((double)LV_VER_RES*currentDuration/calendar[calIndex].duration)}; // progress_points[1] = {0,(lv_coord_t)((double)LV_VER_RES*currentDuration/calendar[calIndex].duration)};
lv_line_set_points(progress_line, progress_points, 2); /*Set the points*/ // lv_line_set_points(progress_line, progress_points, 2); /*Set the points*/
// lv_label_set_text_fmt(batteryValue, "cI %d sO %d",calIndex, sizeof(calendar)/sizeof(CalendarEntry)); // lv_label_set_text_fmt(batteryValue, "cI %d sO %d",calIndex, sizeof(calendar)/sizeof(CalendarEntry));
int last_width=0;
for(int i=0;i<sizeof(fixedtime_labels)/sizeof(CalendarEntry);i++){
lv_obj_set_width(fixedtime_labels[i], pow(log(fixedtime[i].duration),2)*10);
if (i > 0) {
lv_obj_align(fixedtime_labels[i], fixedtime_labels[i-1], LV_ALIGN_OUT_RIGHT_TOP, 5, 0);
} else {
lv_obj_align(fixedtime_labels[i], lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5-timeOffset, 10);
}
}
timeOffset++;
currentDuration++;
if (currentDuration>calendar[calIndex].duration) { // currentDuration++;
currentDuration = 0; // if (currentDuration>calendar[calIndex].duration) {
calIndex++; // currentDuration = 0;
if (calIndex > sizeof(calendar)/sizeof(CalendarEntry)-1) { // calIndex++;
calIndex = 0; // if (calIndex > sizeof(calendar)/sizeof(CalendarEntry)-1) {
} // calIndex = 0;
} // }
// }
notificationState = notificationManager.AreNewNotificationsAvailable(); notificationState = notificationManager.AreNewNotificationsAvailable();

View File

@ -24,6 +24,11 @@ namespace Pinetime {
uint32_t duration; uint32_t duration;
}; };
struct TaskEntry {
char* name;
uint32_t priority;
};
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
@ -52,41 +57,50 @@ namespace Pinetime {
Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<bool> notificationState {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
CalendarEntry calendar[18] = { CalendarEntry fixedtime[14] = {
{"Enjoy the last vestiges of sunlight", 15*2}, {"Present FuckTime", 30},
{"Present FuckTime", 30*2}, {"Party @ David's", 3*60},
{"Enjoy the crisp night air", 10*2}, {"Catch the L Train", 4*60},
{"Party @ David's", 60*2}, {"Sleep", 8*60},
{"Savor the moment", 10*2}, {"Wake up", 30},
{"Sleep", 60*2}, // 8* {"Work", 4*60},
{"Wake up", 10*2}, {"Eat Lunch", 60},
{"Morning Work", 60*2}, // 4* {"Afternoon Work", 4*60},
{"Eat Lunch", 60*2}, {"Get groceries", 20},
{"Afternoon Work", 60*2}, // 4* {"Prepare dinner", 30},
{"Get groceries", 20*2}, {"Eat", 60},
{"Prepare dinner", 30*2}, {"Sleep", 8*60},
{"Eat", 60*2}, {"Rave", 30},
{"Sleep", 60*2}, // 8* {"Repeat", 10}
{"Rave", 30*2}, };
{"Repeat", 10*2}, TaskEntry flextime[5] = {
{"Wake up", 10*2}, {"Enjoy the sunset", 1},
{"Work", 300*2}, // {"Enjoy the crisp night air", 3},
// {"Savor the moment", 5},
{"Collect leaves", 7},
{"Read southern gothic", 9},
{"Attend Food Not Bombs", 11},
{"Undermine authority", 13},
};
TaskEntry season[1] = {
{"大雪 Winter begins", 0},
};
TaskEntry actualization[2] = {
{"Become a tea monk", 1},
{"Organize BuyNothing", 3},
};
TaskEntry community[2] = {
{"Publish zines", 1},
{"Cultivate the next", 3},
}; };
lv_obj_t* fixedtime_labels[sizeof(fixedtime)/sizeof(CalendarEntry)];
uint32_t calIndex = 0; uint32_t calIndex = 0;
uint32_t currentDuration = 0; uint32_t currentDuration = 0;
lv_obj_t * progress_line; lv_obj_t* now_line;
lv_point_t progress_points[2];
lv_obj_t* label_now;
lv_obj_t* label_next;
lv_obj_t* label_prompt_1;
lv_obj_t* label_prompt_2;
lv_obj_t* batteryValue; lv_obj_t* batteryValue;
lv_obj_t* heartbeatValue;
lv_obj_t* stepValue;
lv_obj_t* notificationIcon; lv_obj_t* notificationIcon;
lv_obj_t* connectState;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
const Controllers::Battery& batteryController; const Controllers::Battery& batteryController;

View File

@ -417,6 +417,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) \
LV_FONT_DECLARE(jetbrains_mono_42) \ LV_FONT_DECLARE(jetbrains_mono_42) \
LV_FONT_DECLARE(jetbrains_mono_76) \ LV_FONT_DECLARE(jetbrains_mono_76) \
LV_FONT_DECLARE(jetbrains_mono_14) \
LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(open_sans_light) \
LV_FONT_DECLARE(fontawesome_weathericons) \ LV_FONT_DECLARE(fontawesome_weathericons) \
LV_FONT_DECLARE(lv_font_sys_48) LV_FONT_DECLARE(lv_font_sys_48)