aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/alarm/AlarmController.cpp2
-rw-r--r--src/components/alarm/AlarmController.h2
-rw-r--r--src/components/datetime/DateTimeController.cpp5
-rw-r--r--src/components/datetime/DateTimeController.h1
-rw-r--r--src/components/motor/MotorController.cpp2
-rw-r--r--src/components/settings/Settings.h38
6 files changed, 46 insertions, 4 deletions
diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp
index 9f4e9105..d97e1cff 100644
--- a/src/components/alarm/AlarmController.cpp
+++ b/src/components/alarm/AlarmController.cpp
@@ -82,7 +82,7 @@ void AlarmController::ScheduleAlarm() {
state = AlarmState::Set;
}
-uint32_t AlarmController::SecondsToAlarm() {
+uint32_t AlarmController::SecondsToAlarm() const {
return std::chrono::duration_cast<std::chrono::seconds>(alarmTime - dateTimeController.CurrentDateTime()).count();
}
diff --git a/src/components/alarm/AlarmController.h b/src/components/alarm/AlarmController.h
index d630a128..91f60f5a 100644
--- a/src/components/alarm/AlarmController.h
+++ b/src/components/alarm/AlarmController.h
@@ -36,7 +36,7 @@ namespace Pinetime {
void ScheduleAlarm();
void DisableAlarm();
void SetOffAlarmNow();
- uint32_t SecondsToAlarm();
+ uint32_t SecondsToAlarm() const;
void StopAlerting();
enum class AlarmState { Not_Set, Set, Alerting };
enum class RecurType { None, Daily, Weekdays };
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp
index ba04705f..4dc16329 100644
--- a/src/components/datetime/DateTimeController.cpp
+++ b/src/components/datetime/DateTimeController.cpp
@@ -7,6 +7,7 @@ using namespace Pinetime::Controllers;
namespace {
char const* DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
+ char const* DaysStringShortLow[] = {"--", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
char const* MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
char const* MonthsStringLow[] = {"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
}
@@ -126,6 +127,10 @@ const char* DateTime::MonthShortToStringLow(Months month) {
return MonthsStringLow[static_cast<uint8_t>(month)];
}
+const char* DateTime::DayOfWeekShortToStringLow() const {
+ return DaysStringShortLow[static_cast<uint8_t>(dayOfWeek)];
+}
+
void DateTime::Register(Pinetime::System::SystemTask* systemTask) {
this->systemTask = systemTask;
}
diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h
index 00bbc2ee..81319d15 100644
--- a/src/components/datetime/DateTimeController.h
+++ b/src/components/datetime/DateTimeController.h
@@ -64,6 +64,7 @@ namespace Pinetime {
const char* MonthShortToString() const;
const char* DayOfWeekShortToString() const;
static const char* MonthShortToStringLow(Months month);
+ const char* DayOfWeekShortToStringLow() const;
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const {
return currentDateTime;
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp
index 90e41d20..db6103f4 100644
--- a/src/components/motor/MotorController.cpp
+++ b/src/components/motor/MotorController.cpp
@@ -19,7 +19,7 @@ void MotorController::Ring(TimerHandle_t xTimer) {
}
void MotorController::RunForDuration(uint8_t motorDuration) {
- if (xTimerChangePeriod(shortVib, pdMS_TO_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVib, 0) == pdPASS) {
+ if (motorDuration > 0 && xTimerChangePeriod(shortVib, pdMS_TO_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVib, 0) == pdPASS) {
nrf_gpio_pin_clear(PinMap::Motor);
}
}
diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h
index 62586567..9661a199 100644
--- a/src/components/settings/Settings.h
+++ b/src/components/settings/Settings.h
@@ -34,7 +34,8 @@ namespace Pinetime {
Navy,
Magenta,
Purple,
- Orange
+ Orange,
+ Pink
};
enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric };
@@ -44,6 +45,10 @@ namespace Pinetime {
Colors ColorBG = Colors::Black;
PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full;
};
+ struct WatchFaceInfineat {
+ bool showSideCover = true;
+ int colorIndex = 0;
+ };
Settings(Pinetime::Controllers::FS& fs);
@@ -97,6 +102,26 @@ namespace Pinetime {
return settings.PTS.ColorBG;
};
+ void SetInfineatShowSideCover(bool show) {
+ if (show != settings.watchFaceInfineat.showSideCover) {
+ settings.watchFaceInfineat.showSideCover = show;
+ settingsChanged = true;
+ }
+ };
+ bool GetInfineatShowSideCover() const {
+ return settings.watchFaceInfineat.showSideCover;
+ };
+
+ void SetInfineatColorIndex(int index) {
+ if (index != settings.watchFaceInfineat.colorIndex) {
+ settings.watchFaceInfineat.colorIndex = index;
+ settingsChanged = true;
+ }
+ };
+ int GetInfineatColorIndex() const {
+ return settings.watchFaceInfineat.colorIndex;
+ };
+
void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) {
if (gaugeStyle != settings.PTS.gaugeStyle)
settingsChanged = true;
@@ -110,6 +135,14 @@ namespace Pinetime {
appMenu = menu;
};
+ void SetWatchfacesMenu(uint8_t menu) {
+ watchFacesMenu = menu;
+ };
+
+ uint8_t GetWatchfacesMenu() const {
+ return watchFacesMenu;
+ };
+
uint8_t GetAppMenu() const {
return appMenu;
};
@@ -238,6 +271,8 @@ namespace Pinetime {
PineTimeStyle PTS;
+ WatchFaceInfineat watchFaceInfineat;
+
std::bitset<4> wakeUpMode {0};
uint16_t shakeWakeThreshold = 150;
Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
@@ -248,6 +283,7 @@ namespace Pinetime {
uint8_t appMenu = 0;
uint8_t settingsMenu = 0;
+ uint8_t watchFacesMenu = 0;
/* ble state is intentionally not saved with the other watch settings and initialized
* to off (false) on every boot because we always want ble to be enabled on startup
*/