Compare commits

...

16 Commits

Author SHA1 Message Date
zyphlar
e8ee71b492
Update DisplayApp.cpp 2024-01-18 02:29:45 -08:00
zyphlar
33c92646f2
Update DisplayApp.cpp 2024-01-18 01:40:42 -08:00
e84c049e65
otaku chimes 2024-01-18 01:30:28 -08:00
3968b4eb4f
proper hour hand math 2024-01-17 23:41:18 -08:00
0fc2e611cd
try a better triangle 2024-01-17 16:29:59 -08:00
59d6aa193a
Got proportional time working and restored apps 2024-01-17 00:03:42 -08:00
0a83f936b5
Got it working 2024-01-16 22:21:28 -08:00
5510bfe499
Add fonts, remove Digital 2024-01-16 20:33:04 -08:00
cf4f54dc87
smell this 2024-01-16 11:06:56 -08:00
7b3c48a0e5
Add fancy font and fuzzy logic 2024-01-09 22:54:44 -08:00
d8c3624f6f
Add location, timezone, and long-press switching 2024-01-09 09:19:07 -08:00
zyphlar
20a5fef84c
Add sunset lib 2024-01-08 10:26:07 -08:00
zyphlar
77667c6391
Merge branch 'wb/fuzzy-analog' of github.com:zyphlar/InfiniTime into wb/fuzzy-analog 2024-01-08 10:24:30 -08:00
zyphlar
6c20c2992b
Add sundial 2024-01-07 01:26:03 -08:00
zyphlar
5535fa6af7
add sundial 2024-01-06 21:10:09 -08:00
zyphlar
796e8f1ada
Remove second and minute hands 2024-01-06 17:24:47 -08:00
34 changed files with 547 additions and 1779 deletions

View File

@ -3,7 +3,7 @@ name: CI
# Run this workflow whenever the build may be affected
on:
push:
branches: [ main, wb/fuzzy, wb/fuzzy-norm ]
branches: [ main, wb/fuzzy, wb/fuzzy-norm, wb/fuzzy-analog, wb/fuzzy-everything-wolf, wb/smellthis ]
paths-ignore:
- 'doc/**'
- '**.md'
@ -88,6 +88,15 @@ jobs:
git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main
git -C InfiniSim submodule update --init lv_drivers
- 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: Remove Digital from InfiniSim
run: patch -i docker/infinisim-main.patch InfiniSim/main.cpp
- name: CMake
# disable BUILD_RESOURCES as this is already done when building the firmware
run: |

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "src/libs/arduinoFFT"]
path = src/libs/arduinoFFT
url = https://github.com/kosme/arduinoFFT.git
[submodule "src/libs/sunset"]
path = src/libs/sunset
url = https://github.com/buelowp/sunset.git

View File

@ -0,0 +1,19 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edd6748..641b74a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,6 +243,14 @@ add_library(littlefs STATIC
target_include_directories(littlefs PUBLIC "${InfiniTime_DIR}/src/libs/littlefs")
target_link_libraries(infinisim PRIVATE littlefs)
+# sunset
+add_library(sunset STATIC
+ ${InfiniTime_DIR}/src/libs/sunset/src/sunset.h
+ ${InfiniTime_DIR}/src/libs/sunset/src/sunset.cpp
+)
+target_include_directories(sunset PUBLIC "${InfiniTime_DIR}/src/libs/sunset")
+target_link_libraries(infinisim PRIVATE sunset)
+
# QCBOR
add_library(QCBOR STATIC
${InfiniTime_DIR}/src/libs/QCBOR/src/ieee754.c

View File

@ -0,0 +1,20 @@
diff --git a/main.cpp b/main.cpp
index 8070db7..530ff4b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -823,14 +823,10 @@ public:
void switch_to_screen(uint8_t screen_idx)
{
if (screen_idx == 1) {
- settingsController.SetWatchFace(Pinetime::Applications::WatchFace::Digital);
- displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
- }
- else if (screen_idx == 2) {
settingsController.SetWatchFace(Pinetime::Applications::WatchFace::Analog);
displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
}
- else if (screen_idx == 3) {
+ else if (screen_idx == 2) {
settingsController.SetWatchFace(Pinetime::Applications::WatchFace::PineTimeStyle);
displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
}

View File

@ -0,0 +1,17 @@
diff --git a/littlefs-do-main.cpp b/littlefs-do-main.cpp
index 0a5dfbd..3e818af 100644
--- a/littlefs-do-main.cpp
+++ b/littlefs-do-main.cpp
@@ -537,10 +537,10 @@ int command_settings(const std::string &program_name, const std::vector<std::str
{
auto clockface = settingsController.GetWatchFace();
auto clockface_str = [](auto val) {
- if (val == Pinetime::Applications::WatchFace::Digital) return "Digital";
+ //if (val == Pinetime::Applications::WatchFace::Digital) return "Digital";
if (val == Pinetime::Applications::WatchFace::Analog) return "Analog";
if (val == Pinetime::Applications::WatchFace::PineTimeStyle) return "PineTimeStyle";
- if (val == Pinetime::Applications::WatchFace::Terminal) return "Terminal";
+ //if (val == Pinetime::Applications::WatchFace::Terminal) return "Terminal";
return "unknown";
}(clockface);
std::cout << "ClockFace: " << static_cast<uint32_t>(clockface) << " " << clockface_str << std::endl;

View File

@ -174,6 +174,11 @@ set(LITTLEFS_SRC
libs/littlefs/lfs.c
)
set(SUNSET_SRC
libs/sunset/src/sunset.h
libs/sunset/src/sunset.cpp
)
set(LVGL_SRC
libs/lv_conf.h
libs/lvgl/lvgl.h
@ -412,17 +417,18 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingSetDateTime.cpp
displayapp/screens/settings/SettingSetDate.cpp
displayapp/screens/settings/SettingSetTime.cpp
displayapp/screens/settings/SettingLocation.cpp
displayapp/screens/settings/SettingChimes.cpp
displayapp/screens/settings/SettingShakeThreshold.cpp
displayapp/screens/settings/SettingBluetooth.cpp
## Watch faces
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceInfineat.cpp
displayapp/screens/WatchFaceTerminal.cpp
#displayapp/screens/WatchFaceDigital.cpp
#displayapp/screens/WatchFaceInfineat.cpp
#displayapp/screens/WatchFaceTerminal.cpp
displayapp/screens/WatchFacePineTimeStyle.cpp
displayapp/screens/WatchFaceCasioStyleG7710.cpp
#displayapp/screens/WatchFaceCasioStyleG7710.cpp
##
@ -772,7 +778,7 @@ link_directories(
set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -ftree-vrp -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fstack-usage -fno-exceptions -fno-non-call-exceptions)
set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type -Werror)
set(DEBUG_FLAGS -Og -g3)
set(RELEASE_FLAGS -Os)
set(DEBUG_FLAGS -Os)
set(CXX_FLAGS -fno-rtti)
set(ASM_FLAGS -x assembler-with-cpp)
add_definitions(-DCONFIG_GPIO_AS_PINRESET)
@ -841,7 +847,7 @@ add_subdirectory(displayapp/fonts)
target_compile_options(infinitime_fonts PUBLIC
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -855,7 +861,7 @@ target_include_directories(nrf-sdk SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(nrf-sdk PRIVATE
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
-O3
@ -868,7 +874,7 @@ target_include_directories(nimble SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(nimble PRIVATE
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -880,7 +886,7 @@ target_include_directories(lvgl SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(lvgl PRIVATE
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -892,7 +898,19 @@ target_include_directories(littlefs SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(littlefs PRIVATE
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
# SUNSET_SRC
add_library(sunset STATIC ${SUNSET_SRC})
target_include_directories(sunset SYSTEM PUBLIC . ../)
target_include_directories(sunset SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(sunset PRIVATE
${COMMON_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -903,12 +921,12 @@ set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime
set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld")
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs sunset infinitime_fonts infinitime_apps)
target_compile_options(${EXECUTABLE_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -937,13 +955,13 @@ set(IMAGE_MCUBOOT_FILE_NAME_BIN ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERS
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs sunset infinitime_fonts infinitime_apps)
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -979,14 +997,14 @@ endif()
set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery")
set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES})
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs sunset infinitime_fonts infinitime_apps)
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -1011,14 +1029,14 @@ set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-$
set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.hex)
set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES})
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs sunset infinitime_fonts infinitime_apps)
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -1057,7 +1075,7 @@ target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)
@ -1092,7 +1110,7 @@ target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<CONFIG:RELEASE>: ${DEBUG_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)

View File

@ -50,6 +50,12 @@ namespace Pinetime {
int colorIndex = 0;
};
struct Location {
int16_t latitude;
int16_t longitude;
int8_t tzOffset;
};
Settings(Pinetime::Controllers::FS& fs);
Settings(const Settings&) = delete;
@ -275,6 +281,21 @@ namespace Pinetime {
return settings.stepsGoal;
};
void SetLocation(Location loc) {
if (
loc.latitude != settings.location.latitude ||
loc.longitude != settings.location.longitude ||
loc.tzOffset != settings.location.tzOffset
) {
settingsChanged = true;
}
settings.location = loc;
};
Location GetLocation() const {
return settings.location;
};
void SetBleRadioEnabled(bool enabled) {
bleRadioEnabled = enabled;
};
@ -297,7 +318,7 @@ namespace Pinetime {
WeatherFormat weatherFormat = WeatherFormat::Metric;
Notification notificationStatus = Notification::On;
Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Digital;
Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Analog; //Digital
ChimesOption chimesOption = ChimesOption::None;
PineTimeStyle PTS;
@ -308,6 +329,7 @@ namespace Pinetime {
uint16_t shakeWakeThreshold = 150;
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
Location location = {(int16_t)0,(int16_t)0,(int8_t)0};
};
SettingsData settings;

View File

@ -44,6 +44,7 @@
#include "displayapp/screens/settings/SettingDisplay.h"
#include "displayapp/screens/settings/SettingSteps.h"
#include "displayapp/screens/settings/SettingSetDateTime.h"
#include "displayapp/screens/settings/SettingLocation.h"
#include "displayapp/screens/settings/SettingChimes.h"
#include "displayapp/screens/settings/SettingShakeThreshold.h"
#include "displayapp/screens/settings/SettingBluetooth.h"
@ -231,6 +232,11 @@ void DisplayApp::Refresh() {
Messages msg;
if (xQueueReceive(msgQueue, &msg, queueTimeout) == pdTRUE) {
// let's do otaku chimes
uint8_t myHour = dateTimeController.Hours();
uint8_t myChimes = 9-(((int)floor(myHour/2))%6);
switch (msg) {
case Messages::DimScreen:
DimScreen();
@ -376,7 +382,39 @@ void DisplayApp::Refresh() {
break;
case Messages::Chime:
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
motorController.RunForDuration(35);
// hour chime
// 0 9
// 1 9
// 2 8
// 3 8
// 4 7
// 5 7
// 6 6
// 7 6
// 8 5
// 9 5
// 10 4
// 11 4
// 12 9
// 13 9
// 14 8
// 15 8
// 16 7
// 17 7
// 18 6
// 19 6
// 20 5
// 21 5
// 22 4
// 23 4
// NRF_LOG_INFO("buzzing %d times", myChimes);
for (uint8_t i=0; i<myChimes; i++){
// NRF_LOG_INFO("buzz!");
motorController.RunForDuration(35);
vTaskDelay(800);
}
break;
case Messages::OnChargingEvent:
RestoreBrightness();
@ -514,6 +552,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
case Apps::SettingSetDateTime:
currentScreen = std::make_unique<Screens::SettingSetDateTime>(this, dateTimeController, settingsController);
break;
case Apps::SettingLocation:
currentScreen = std::make_unique<Screens::SettingLocation>(settingsController);
break;
case Apps::SettingChimes:
currentScreen = std::make_unique<Screens::SettingChimes>(settingsController);
break;

View File

@ -7,12 +7,12 @@
#include "displayapp/screens/Twos.h"
#include "displayapp/screens/Tile.h"
#include "displayapp/screens/ApplicationList.h"
#include "displayapp/screens/WatchFaceDigital.h"
//#include "displayapp/screens/WatchFaceDigital.h"
#include "displayapp/screens/WatchFaceAnalog.h"
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
#include "displayapp/screens/WatchFaceInfineat.h"
// #include "displayapp/screens/WatchFaceCasioStyleG7710.h"
// #include "displayapp/screens/WatchFaceInfineat.h"
#include "displayapp/screens/WatchFacePineTimeStyle.h"
#include "displayapp/screens/WatchFaceTerminal.h"
// #include "displayapp/screens/WatchFaceTerminal.h"
namespace Pinetime {
namespace Applications {

View File

@ -37,6 +37,7 @@ namespace Pinetime {
SettingWakeUp,
SettingSteps,
SettingSetDateTime,
SettingLocation,
SettingChimes,
SettingShakeThreshold,
SettingBluetooth,
@ -45,12 +46,8 @@ namespace Pinetime {
};
enum class WatchFace : uint8_t {
Digital,
Analog,
PineTimeStyle,
Terminal,
Infineat,
CasioStyleG7710,
};
template <Apps>
@ -71,12 +68,8 @@ namespace Pinetime {
static constexpr size_t Count = sizeof...(Ws);
};
using UserWatchFaceTypes = WatchFaceTypeList<WatchFace::Digital,
WatchFace::Analog,
WatchFace::PineTimeStyle,
WatchFace::Terminal,
WatchFace::Infineat,
WatchFace::CasioStyleG7710>;
using UserWatchFaceTypes = WatchFaceTypeList<WatchFace::Analog,
WatchFace::PineTimeStyle>;
static_assert(UserWatchFaceTypes::Count >= 1);
}

View File

@ -1,11 +1,9 @@
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::Twos" CACHE STRING "List of user apps to build into the firmware")
#Apps::Paint,
#Apps::Metronome,
#Apps::Paddle,
endif ()
#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::Timer, Apps::Alarm, 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)
target_sources(infinitime_apps INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/Apps.h")

View File

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

Binary file not shown.

View File

@ -14,15 +14,36 @@
"size": 20,
"patches": ["jetbrains_mono_bold_20.c_zero.patch", "jetbrains_mono_bold_20.c_M.patch"]
},
"noto_serif_cjk_20": {
"sources": [
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "丑寅卯辰巳午未申酉戌亥子四五六七八九"
}
],
"bpp": 1,
"size": 20
},
"noto_serif_cjk_15": {
"sources": [
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "四五六七八九"
}
],
"bpp": 1,
"size": 15
},
"jetbrains_mono_42": {
"sources": [
{
"file": "JetBrainsMono-Regular.ttf",
"disabledfile": "Vulf Mono Light Italic.ttf",
"range": "0x20, 0x25, 0x27, 0x2b, 0x2d, 0x30-0x3a, 0x4b-0x4d, 0x61-0x7a"
}
],
"bpp": 1,
"size": 42
"size": 30
},
"jetbrains_mono_76": {
"sources": [

View File

@ -1,22 +1,27 @@
#include "displayapp/screens/WatchFaceAnalog.h"
#include <cmath>
#include <lvgl/lvgl.h>
#include <nrf_log.h>
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/screens/BleIcon.h"
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/NotificationIcon.h"
#include "components/settings/Settings.h"
#include "displayapp/InfiniTimeTheme.h"
#include "sunset/src/sunset.h"
using namespace Pinetime::Applications::Screens;
namespace {
constexpr int16_t HourLength = 70;
int16_t HourLength = 70;
constexpr int16_t MinuteLength = 90;
constexpr int16_t SecondLength = 110;
constexpr int16_t SunDialVerticalOffset = 40;
// sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor
const auto LV_TRIG_SCALE = _lv_trigo_sin(90);
const lv_color_t DARK_GRAY = lv_color_make(48, 48, 48);
const lv_color_t DARK_ORANGE = lv_color_make(48, 26, 0);
int16_t Cosine(int16_t angle) {
return _lv_trigo_sin(angle + 90);
@ -39,6 +44,41 @@ namespace {
.y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE)};
}
void printKoku(const char* str, uint8_t i, bool big){
lv_obj_t* koku = lv_label_create(lv_scr_act(), NULL);
lv_label_set_align(koku, LV_LABEL_ALIGN_CENTER);
lv_label_set_text(koku, str);
lv_point_t pt;
if (big) {
pt = CoordinateRelocate(LV_HOR_RES/2-20, i*30);
lv_obj_set_style_local_text_font(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &noto_serif_cjk_20);
} else {
pt = CoordinateRelocate(LV_HOR_RES/2-45, i*30);
lv_obj_set_style_local_text_font(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &noto_serif_cjk_15);
}
lv_obj_align(koku, NULL, LV_ALIGN_CENTER, LV_HOR_RES/2-pt.x, LV_HOR_RES/2-pt.y);
lv_obj_set_style_local_text_color(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
}
void drawTime(lv_obj_t * obj, uint8_t hour, uint8_t minute, lv_color_t color, uint8_t x, uint8_t y) {
lv_label_set_align(obj, LV_LABEL_ALIGN_CENTER);
lv_label_set_text_fmt(obj, "%02d:%02d", hour, minute);
lv_obj_set_pos(obj, 0, 0);
lv_obj_align(obj, NULL, LV_ALIGN_CENTER, x, y);
lv_obj_set_style_local_text_color(obj, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_text_font(obj, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
}
void drawCircle(uint8_t width, bool left, lv_coord_t offset, lv_color_t color){
lv_obj_t * cir = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_size(cir, width, width);
if (left)
lv_obj_align(cir, nullptr, LV_ALIGN_IN_LEFT_MID, offset, 0);
else
lv_obj_align(cir, nullptr, LV_ALIGN_IN_RIGHT_MID, offset, 0);
lv_obj_set_style_local_bg_color(cir, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_radius(cir, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
}
}
WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
@ -58,41 +98,97 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
sMinute = 99;
sSecond = 99;
minor_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(minor_scales, 300, 51);
lv_linemeter_set_angle_offset(minor_scales, 180);
lv_obj_set_size(minor_scales, 240, 240);
lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_scale_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_line_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1);
lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
location = settingsController.GetLocation();
major_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(major_scales, 300, 11);
lv_linemeter_set_angle_offset(major_scales, 180);
lv_obj_set_size(major_scales, 240, 240);
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, 6);
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
// begin Japanese watch face
if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) {
lv_obj_t * nighttime = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_size(nighttime, LV_HOR_RES, LV_HOR_RES/2);
lv_obj_set_pos(nighttime, 0, 0);
lv_obj_set_style_local_bg_color(nighttime, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, DARK_GRAY);
lv_obj_set_style_local_radius(nighttime, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 0);
large_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(large_scales, 180, 3);
lv_linemeter_set_angle_offset(large_scales, 180);
lv_obj_set_size(large_scales, 240, 240);
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
drawCircle(35, true, 4, DARK_GRAY);
drawCircle(25, true, 33, DARK_GRAY);
drawCircle(35, false, -3, LV_COLOR_BLACK);
drawCircle(25, false, -32, LV_COLOR_BLACK);
twelve = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER);
lv_label_set_text_static(twelve, "12");
lv_obj_set_pos(twelve, 110, 10);
lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
major_scales = lv_linemeter_create(lv_scr_act(), nullptr);
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_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, 50);
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, 70, 70);
lv_arc_set_bg_angles(axis, 0, 360);
lv_arc_set_end_angle(axis, 360);
lv_obj_align(axis, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_line_width(axis, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, 40);
lv_obj_set_style_local_line_color(axis, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_WHITE);
const char* kokuZodiac[] = {"","","","","","","","","","","",""};
const char* kokuNums[] = {"","","","","",""};
twelve = lv_label_create(lv_scr_act(), nullptr);
for (int i=0;i<12;i++) {
printKoku(kokuZodiac[i], i, true);
printKoku(kokuNums[i%6], i, false);
}
lv_style_init(&hour_line_style);
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 10);
lv_style_set_line_rounded(&hour_line_style, LV_STATE_DEFAULT, true);
lv_style_init(&hour_line_style_trace);
lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 10);
lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, true);
} else {
minor_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(minor_scales, 300, 51);
lv_linemeter_set_angle_offset(minor_scales, 180);
lv_obj_set_size(minor_scales, 240, 240);
lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_scale_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_line_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1);
lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
major_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(major_scales, 300, 11);
lv_linemeter_set_angle_offset(major_scales, 180);
lv_obj_set_size(major_scales, 240, 240);
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, 6);
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
large_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(large_scales, 180, 3);
lv_linemeter_set_angle_offset(large_scales, 180);
lv_obj_set_size(large_scales, 240, 240);
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
twelve = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER);
lv_label_set_text_static(twelve, "12");
lv_obj_set_pos(twelve, 110, 10);
lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
lv_style_init(&hour_line_style);
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7);
lv_style_init(&hour_line_style_trace);
lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 3);
}
batteryIcon.Create(lv_scr_act());
lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@ -111,7 +207,6 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Date - Day / Week day
label_date_day = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
@ -142,16 +237,10 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false);
lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace);
lv_style_init(&hour_line_style);
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7);
lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_style_set_line_rounded(&hour_line_style, LV_STATE_DEFAULT, true);
lv_obj_add_style(hour_body, LV_LINE_PART_MAIN, &hour_line_style);
lv_style_init(&hour_line_style_trace);
lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 3);
lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false);
lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
@ -171,12 +260,73 @@ WatchFaceAnalog::~WatchFaceAnalog() {
lv_obj_clean(lv_scr_act());
}
void WatchFaceAnalog::drawWatchFaceWadokei(){
uint8_t hour = dateTimeController.Hours();
uint8_t minute = dateTimeController.Minutes();
if (sHour != hour || sMinute != minute) {
sun.setPosition((float)location.latitude, (float)location.longitude, location.tzOffset);
//from minutes past midnight
sun.setCurrentDate(dateTimeController.Year(), static_cast<uint8_t>(dateTimeController.Month())+1, dateTimeController.Day());
sun.setTZOffset(location.tzOffset);
minutesSunrise = sun.calcSunrise();
minutesSunset = sun.calcSunset();
minutesDaytime = (minutesSunset - minutesSunrise);
minutesNighttime = (1440 - minutesDaytime);
minutesBeforeSunset = minutesSunset - (hour * 60 + minute); // i.e.zero degrees
HourLength = 40; // wadokei hand length
int16_t hourAngle=0;
// auto const hourAngle = ((hour * 15 + minute / 2)+180)%360; //24-hr rotation with 0/24 at the bottom
if(minutesBeforeSunset > minutesDaytime) {
hourAngle = -180.0 - 180.0 * (minutesBeforeSunset - minutesDaytime) / minutesNighttime;
}
else if(minutesBeforeSunset > 0 ) {
hourAngle = -180.0 * minutesBeforeSunset / minutesDaytime;
}
else {
hourAngle = -180.0 * minutesBeforeSunset / minutesNighttime;
}
// NRF_LOG_INFO("angle: %d, day: %d, night: %d, bef: %d",
// hourAngle+90,
// minutesDaytime,
// minutesNighttime,
// minutesBeforeSunset);
sHour = hour;
sMinute = minute;
hour_point_trace[0] = CoordinateRelocate(28, hourAngle+90-66); //axis radius minus line stroke
hour_point_trace[1] = CoordinateRelocate(HourLength, hourAngle+90);
hour_point[0] = CoordinateRelocate(28, hourAngle+90+66); //axis radius minus line stroke
hour_point[1] = CoordinateRelocate(HourLength, hourAngle+90);
lv_line_set_points(hour_body, hour_point, 2);
lv_line_set_points(hour_body_trace, hour_point_trace, 2);
drawTime(twelve, hour, minute, LV_COLOR_BLACK, 0, 0);
lv_obj_move_foreground(twelve);
}
}
void WatchFaceAnalog::UpdateClock() {
if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) {
drawWatchFaceWadokei();
return;
}
uint8_t hour = dateTimeController.Hours();
uint8_t minute = dateTimeController.Minutes();
uint8_t second = dateTimeController.Seconds();
if (sMinute != minute) {
if (minute>99 && sMinute != minute) { // disable
auto const angle = minute * 6;
minute_point[0] = CoordinateRelocate(30, angle);
minute_point[1] = CoordinateRelocate(MinuteLength, angle);
@ -203,7 +353,8 @@ void WatchFaceAnalog::UpdateClock() {
lv_line_set_points(hour_body_trace, hour_point_trace, 2);
}
if (sSecond != second) {
if (second>99 && sSecond != second) { // disable
sSecond = second;
auto const angle = second * 6;
@ -258,7 +409,18 @@ void WatchFaceAnalog::Refresh() {
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
if (currentDate.IsUpdated()) {
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) {
/*char const* MonthsString[] = {"--", "IANUARIUS","FEBRUARIUS","MARTIUS","APRILIS","MARTIUSIUNIUS","QUINTILIS","SEXTILIS","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"};
char const* DaysString[] = {"--", "LUNAE", "MARTIS", "MERCURII", "IOVIS", "VENERIS", "SATURNI", "SOLIS"};
char const* RomanNumeralsString[] = {"--", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
lv_label_set_text_fmt(label_date_day, "%s\n%s %s",
DaysString[static_cast<uint8_t>(dateTimeController.DayOfWeek())],
RomanNumeralsString[static_cast<uint8_t>(dateTimeController.Day())],
MonthsString[static_cast<uint8_t>(dateTimeController.Month())]);*/
lv_obj_align(label_date_day, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -2000);
} else {
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
}
}
}
}
}

View File

@ -11,6 +11,7 @@
#include "components/ble/NotificationManager.h"
#include "displayapp/screens/BatteryIcon.h"
#include "utility/DirtyValue.h"
#include "sunset/src/sunset.h"
namespace Pinetime {
namespace Controllers {
@ -49,7 +50,9 @@ namespace Pinetime {
lv_obj_t* minor_scales;
lv_obj_t* major_scales;
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;
@ -68,6 +71,7 @@ namespace Pinetime {
lv_style_t minute_line_style;
lv_style_t minute_line_style_trace;
lv_style_t second_line_style;
lv_style_t axis_style;
lv_obj_t* label_date_day;
lv_obj_t* plugIcon;
@ -76,12 +80,21 @@ namespace Pinetime {
BatteryIcon batteryIcon;
Controllers::Settings::Location location;
SunSet sun;
int16_t minutesSunrise;
int16_t minutesSunset;
int16_t minutesDaytime;
int16_t minutesNighttime;
int16_t minutesBeforeSunset;
const Controllers::DateTime& dateTimeController;
const Controllers::Battery& batteryController;
const Controllers::Ble& bleController;
Controllers::NotificationManager& notificationManager;
Controllers::Settings& settingsController;
void drawWatchFaceWadokei();
void UpdateClock();
void SetBatteryIcon();

View File

@ -1,334 +0,0 @@
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
#include <lvgl/lvgl.h>
#include <cstdio>
#include "displayapp/screens/BatteryIcon.h"
#include "displayapp/screens/BleIcon.h"
#include "displayapp/screens/NotificationIcon.h"
#include "displayapp/screens/Symbols.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/heartrate/HeartRateController.h"
#include "components/motion/MotionController.h"
#include "components/settings/Settings.h"
using namespace Pinetime::Applications::Screens;
WatchFaceCasioStyleG7710::WatchFaceCasioStyleG7710(Controllers::DateTime& dateTimeController,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController,
Controllers::HeartRateController& heartRateController,
Controllers::MotionController& motionController,
Controllers::FS& filesystem)
: currentDateTime {{}},
batteryIcon(false),
dateTimeController {dateTimeController},
batteryController {batteryController},
bleController {bleController},
notificatioManager {notificatioManager},
settingsController {settingsController},
heartRateController {heartRateController},
motionController {motionController} {
lfs_file f = {};
if (filesystem.FileOpen(&f, "/fonts/lv_font_dots_40.bin", LFS_O_RDONLY) >= 0) {
filesystem.FileClose(&f);
font_dot40 = lv_font_load("F:/fonts/lv_font_dots_40.bin");
}
if (filesystem.FileOpen(&f, "/fonts/7segments_40.bin", LFS_O_RDONLY) >= 0) {
filesystem.FileClose(&f);
font_segment40 = lv_font_load("F:/fonts/7segments_40.bin");
}
if (filesystem.FileOpen(&f, "/fonts/7segments_115.bin", LFS_O_RDONLY) >= 0) {
filesystem.FileClose(&f);
font_segment115 = lv_font_load("F:/fonts/7segments_115.bin");
}
label_battery_value = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_battery_value, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_set_style_local_text_color(label_battery_value, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(label_battery_value, "00%");
batteryIcon.Create(lv_scr_act());
batteryIcon.SetColor(color_text);
lv_obj_align(batteryIcon.GetObject(), label_battery_value, LV_ALIGN_OUT_LEFT_MID, -5, 0);
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(batteryPlug, Symbols::plug);
lv_obj_align(batteryPlug, batteryIcon.GetObject(), LV_ALIGN_OUT_LEFT_MID, -5, 0);
bleIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(bleIcon, Symbols::bluetooth);
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
lv_obj_align(notificationIcon, bleIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
label_day_of_week = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_day_of_week, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 10, 64);
lv_obj_set_style_local_text_color(label_day_of_week, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_set_style_local_text_font(label_day_of_week, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_dot40);
lv_label_set_text_static(label_day_of_week, "SUN");
label_week_number = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_week_number, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 22);
lv_obj_set_style_local_text_color(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_set_style_local_text_font(label_week_number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_dot40);
lv_label_set_text_static(label_week_number, "WK26");
label_day_of_year = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_day_of_year, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 30);
lv_obj_set_style_local_text_color(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_set_style_local_text_font(label_day_of_year, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_segment40);
lv_label_set_text_static(label_day_of_year, "181-184");
lv_style_init(&style_line);
lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 2);
lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, color_text);
lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);
lv_style_init(&style_border);
lv_style_set_line_width(&style_border, LV_STATE_DEFAULT, 6);
lv_style_set_line_color(&style_border, LV_STATE_DEFAULT, color_text);
lv_style_set_line_rounded(&style_border, LV_STATE_DEFAULT, true);
line_icons = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_points(line_icons, line_icons_points, 3);
lv_obj_add_style(line_icons, LV_LINE_PART_MAIN, &style_line);
lv_obj_align(line_icons, nullptr, LV_ALIGN_IN_TOP_RIGHT, -10, 18);
line_day_of_week_number = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_points(line_day_of_week_number, line_day_of_week_number_points, 4);
lv_obj_add_style(line_day_of_week_number, LV_LINE_PART_MAIN, &style_border);
lv_obj_align(line_day_of_week_number, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 8);
line_day_of_year = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_points(line_day_of_year, line_day_of_year_points, 3);
lv_obj_add_style(line_day_of_year, LV_LINE_PART_MAIN, &style_line);
lv_obj_align(line_day_of_year, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 60);
label_date = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 100, 70);
lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_set_style_local_text_font(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_segment40);
lv_label_set_text_static(label_date, "6-30");
line_date = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_points(line_date, line_date_points, 3);
lv_obj_add_style(line_date, LV_LINE_PART_MAIN, &style_line);
lv_obj_align(line_date, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 100);
label_time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_segment115);
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 40);
line_time = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_points(line_time, line_time_points, 3);
lv_obj_add_style(line_time, LV_LINE_PART_MAIN, &style_line);
lv_obj_align(line_time, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, -25);
label_time_ampm = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_time_ampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(label_time_ampm, "");
lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 5, -5);
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
lv_label_set_text_static(backgroundLabel, "");
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat);
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(heartbeatValue, "");
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
stepValue = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(stepValue, "0");
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
stepIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_static(stepIcon, Symbols::shoe);
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
Refresh();