diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce8240d4..86bb4ba3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: CI # Run this workflow whenever the build may be affected on: push: - branches: [ main, wb/fuzzy, wb/fuzzy-norm, wb/fuzzy-analog, wb/fuzzy-everything-wolf ] + branches: [ main, wb/fuzzy, wb/fuzzy-norm, wb/fuzzy-analog, wb/fuzzy-everything-wolf, wb/smellthis ] paths-ignore: - 'doc/**' - '**.md' @@ -91,6 +91,9 @@ jobs: - name: Add sunset lib to InfiniSim run: patch -i docker/infinisim-cmake.patch InfiniSim/CMakeLists.txt + - name: Remove Terminal from InfiniSim + run: patch -i docker/infinisim-terminal.patch InfiniSim/littlefs-do-main.cpp + - name: CMake # disable BUILD_RESOURCES as this is already done when building the firmware run: | diff --git a/docker/infinisim-terminal.patch b/docker/infinisim-terminal.patch new file mode 100644 index 00000000..fa1f9a6f --- /dev/null +++ b/docker/infinisim-terminal.patch @@ -0,0 +1,13 @@ +diff --git a/littlefs-do-main.cpp b/littlefs-do-main.cpp +index 0a5dfbd..5d902f8 100644 +--- a/littlefs-do-main.cpp ++++ b/littlefs-do-main.cpp +@@ -540,7 +540,7 @@ int command_settings(const std::string &program_name, const std::vector(clockface) << " " << clockface_str << std::endl; diff --git a/src/displayapp/fonts/fonts.json b/src/displayapp/fonts/fonts.json index 9d90cb5d..ad2d5248 100644 --- a/src/displayapp/fonts/fonts.json +++ b/src/displayapp/fonts/fonts.json @@ -17,8 +17,8 @@ "jetbrains_mono_42": { "sources": [ { - "disabledfile": "JetBrainsMono-Regular.ttf", - "file": "Vulf Mono Light Italic.ttf", + "file": "JetBrainsMono-Regular.ttf", + "disabledfile": "Vulf Mono Light Italic.ttf", "range": "0x20, 0x25, 0x27, 0x2b, 0x2d, 0x30-0x3a, 0x4b-0x4d, 0x61-0x7a" } ], diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 6d67f1e4..73151cb6 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -1,7 +1,7 @@ #include "displayapp/screens/WatchFaceAnalog.h" #include #include -// #include +#include #include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BleIcon.h" #include "displayapp/screens/Symbols.h" @@ -44,15 +44,6 @@ namespace { .y = CoordinateYRelocate(radius * static_cast(Cosine(angle)) / LV_TRIG_SCALE)}; } - int16_t CoordinateYRelocateSundial(int16_t y) { - return std::abs(y - SunDialVerticalOffset); - } - - lv_point_t CoordinateRelocateSundial(int16_t radius, int16_t angle) { - return lv_point_t {.x = CoordinateXRelocate(radius * static_cast(Sine(angle)) / LV_TRIG_SCALE), - .y = CoordinateYRelocateSundial(radius * static_cast(Cosine(angle)) / LV_TRIG_SCALE)}; - } - } WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, @@ -77,25 +68,31 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, // begin sundial watch face if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) { major_scales = lv_linemeter_create(lv_scr_act(), nullptr); - lv_linemeter_set_scale(major_scales, 165, 11); - lv_linemeter_set_angle_offset(major_scales, 180); + lv_linemeter_set_scale(major_scales, 360, 13); + lv_linemeter_set_angle_offset(major_scales, 15); lv_obj_set_size(major_scales, 240, 240); - lv_obj_align(major_scales, nullptr, LV_ALIGN_IN_TOP_MID, 0, -LV_HOR_RES/2+SunDialVerticalOffset); + lv_obj_align(major_scales, nullptr, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_local_bg_opa(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 40); lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1); lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + axis = lv_arc_create(lv_scr_act(), NULL); + lv_obj_set_size(axis, 40, 40); + lv_arc_set_bg_angles(axis, 0, 360); + lv_obj_align(axis, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_color(axis, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + one = lv_label_create(lv_scr_act(), NULL); lv_label_set_align(one, LV_LABEL_ALIGN_LEFT); lv_label_set_text(one, "I"); - lv_obj_align(one, NULL, LV_ALIGN_IN_TOP_LEFT, 20, SunDialVerticalOffset-20); + lv_obj_align(one, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 0); lv_obj_set_style_local_text_color(one, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); twelve = lv_label_create(lv_scr_act(), NULL); lv_label_set_align(twelve, LV_LABEL_ALIGN_RIGHT); lv_label_set_text(twelve, "XII"); - lv_obj_align(twelve, NULL, LV_ALIGN_IN_TOP_RIGHT, -20, SunDialVerticalOffset-20); + lv_obj_align(twelve, NULL, LV_ALIGN_IN_TOP_RIGHT, -20, 0); lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } else { minor_scales = lv_linemeter_create(lv_scr_act(), nullptr); @@ -212,7 +209,7 @@ WatchFaceAnalog::~WatchFaceAnalog() { } -void WatchFaceAnalog::drawWatchFaceModeNight(){ +void WatchFaceAnalog::drawWatchFaceWadokei(){ uint8_t hour = dateTimeController.Hours(); uint8_t minute = dateTimeController.Minutes(); @@ -230,42 +227,42 @@ void WatchFaceAnalog::drawWatchFaceModeNight(){ minutesNighttime = (1440 - minutesDaytime); minutesBeforeSunset = minutesSunset - (hour * 60 + minute); // i.e.zero degrees - HourLength = 90; // sundial hand length + HourLength = 40; // wadokei hand length - int16_t hourAngle; + int16_t oldHourAngle; + auto const angle = (hour * 15 + minute / 2)+180; //24-hr rotation with 0/24 at the bottom if(minutesBeforeSunset > 0 && minutesBeforeSunset < minutesDaytime) { // day (after sunrise) - hourAngle = 180.0 * minutesBeforeSunset / minutesDaytime + 90; + oldHourAngle = 180.0 * minutesBeforeSunset / minutesDaytime + 90; } else { // night (before sunrise or after sunset) - lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, DARK_GRAY); - lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, DARK_GRAY); - lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); - lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_ORANGE); - lv_obj_set_style_local_text_color(one, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); - lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); + // lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, DARK_GRAY); + // lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, DARK_GRAY); + // lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); + // lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_ORANGE); + // lv_obj_set_style_local_text_color(one, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); + // lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY); if(minutesBeforeSunset > minutesDaytime) { // before sunrise - hourAngle = 180.0 * (minutesBeforeSunset - minutesDaytime) / minutesNighttime + 90; + oldHourAngle = 180.0 * (minutesBeforeSunset - minutesDaytime) / minutesNighttime + 90; } else { // after sunset - hourAngle = 180 + 180.0 * minutesBeforeSunset / minutesNighttime + 90; + oldHourAngle = 180 + 180.0 * minutesBeforeSunset / minutesNighttime + 90; } } - /*NRF_LOG_INFO("a: %d, la: %f, lo: %f, ri: %d, se: %d, be: %d", - hourAngle, - (float)location.latitude, - (float)location.longitude, - minutesSunrise, - minutesSunset, - minutesBeforeSunset);*/ + NRF_LOG_INFO("oa: %d, a: %d, la: %f, lo: %f, be: %d", + oldHourAngle, + angle, + (float)location.latitude, + (float)location.longitude, + minutesBeforeSunset); sHour = hour; sMinute = minute; - hour_point_trace[0] = CoordinateRelocateSundial(HourLength*.75, hourAngle); - hour_point_trace[1] = CoordinateRelocateSundial(HourLength, hourAngle); + hour_point_trace[0] = CoordinateRelocate(HourLength*.75, angle); + hour_point_trace[1] = CoordinateRelocate(HourLength, angle); - hour_point[0] = CoordinateRelocateSundial(0, hourAngle); - hour_point[1] = CoordinateRelocateSundial(HourLength*.75, hourAngle); + hour_point[0] = CoordinateRelocate(0, angle); + hour_point[1] = CoordinateRelocate(HourLength*.75, angle); lv_line_set_points(hour_body, hour_point, 2); lv_line_set_points(hour_body_trace, hour_point_trace, 2); @@ -274,7 +271,7 @@ void WatchFaceAnalog::drawWatchFaceModeNight(){ void WatchFaceAnalog::UpdateClock() { if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) { - drawWatchFaceModeNight(); + drawWatchFaceWadokei(); return; } diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 05bb9e3f..88e08c0a 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -52,6 +52,7 @@ namespace Pinetime { lv_obj_t* large_scales; lv_obj_t* one; lv_obj_t* twelve; + lv_obj_t* axis; lv_obj_t* hour_body; lv_obj_t* hour_body_trace; @@ -92,7 +93,7 @@ namespace Pinetime { Controllers::NotificationManager& notificationManager; Controllers::Settings& settingsController; - void drawWatchFaceModeNight(); + void drawWatchFaceWadokei(); void UpdateClock(); void SetBatteryIcon();