Skip to content

Commit

Permalink
Apps : display goal steps on Watchface
Browse files Browse the repository at this point in the history
-Update watchface
-Add settingDisplay OSW keys
-See Open-Smartwatch#207
  • Loading branch information
RuffaloLavoisier committed Apr 15, 2022
1 parent d1aca96 commit a092d05
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/osw_config_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ extern OswConfigKeyShort resetDay;
#if OSW_PLATFORM_ENVIRONMENT_ACCELEROMETER == 1
extern OswConfigKeyInt stepsPerDay;
extern OswConfigKeyBool stepsHistoryClear;
extern OswConfigKeyBool settingDisplay;
#endif
extern OswConfigKeyDropDown settingDisplayDefaultWatchface;
} // namespace OswConfigAllKeys
Expand Down
9 changes: 8 additions & 1 deletion src/apps/watchfaces/watchface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ void OswAppWatchface::drawStepHistory(OswUI* ui, uint8_t x, uint8_t y, uint8_t w
hal->gfx()->setTextBottomAligned();
hal->gfx()->setTextSize(1);
hal->gfx()->setTextCursor(DISP_W / 2, y - 1);
hal->gfx()->print(hal->environment->getStepsToday());

if (OswConfigAllKeys::settingDisplay.get()) {
char stepsTodayNGoal[20];
sprintf(stepsTodayNGoal, "%d/%d", hal->environment->getStepsToday(), max);
hal->gfx()->print(stepsTodayNGoal);
} else {
hal->gfx()->print(hal->environment->getStepsToday());
}
hal->gfx()->setTextCursor(DISP_W / 2, y + 1 + 8 + w * 4);
hal->gfx()->setTextColor(ui->getForegroundColor()); // Let's make the background transparent.
// See : https://github.com/Open-Smartwatch/open-smartwatch-os/issues/194
Expand Down
9 changes: 7 additions & 2 deletions src/osw_config_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ OswConfigKeyBool settingDisplayOverlays("s3", "Display", "Display Overlays", "Sh
OswConfigKeyBool settingDisplayOverlaysOnWatchScreen("s4", "Display", "Display Watchface Overlays", nullptr, DISPLAY_OVERLAYS_ON_WF);
OswConfigKeyDropDown settingDisplayDefaultWatchface("n", "Display",
"Default Watchface ID (analog, digital, mix, binary)", "0,1,2,3", String(CONFIG_DEFAULT_WATCHFACE_INDEX));

#if OSW_PLATFORM_ENVIRONMENT_ACCELEROMETER == 1
OswConfigKeyBool settingDisplay("g1", "Display", "Display Steps Goal", "Show goal steps", 1);
#endif
OswConfigKeyBool raiseToWakeEnabled("s5", "Power", "Raise/Tilt to Wake", "Enables Raise to Wake",
WAKE_FROM_RAISE);
OswConfigKeyShort raiseToWakeSensitivity("s6", "Power", "Raise to Wake Sensitivity",
Expand Down Expand Up @@ -81,7 +83,10 @@ OswConfigKey *oswConfigKeys[] = {
// display
&OswConfigAllKeys::settingDisplayTimeout, &OswConfigAllKeys::settingDisplayBrightness,
&OswConfigAllKeys::settingDisplayOverlays, &OswConfigAllKeys::settingDisplayOverlaysOnWatchScreen,
&OswConfigAllKeys::settingDisplayDefaultWatchface,
&OswConfigAllKeys::settingDisplayDefaultWatchface,
#if OSW_PLATFORM_ENVIRONMENT_ACCELEROMETER == 1
&OswConfigAllKeys::settingDisplay,
#endif
// energy
&OswConfigAllKeys::buttonToWakeEnabled, &OswConfigAllKeys::raiseToWakeEnabled,
&OswConfigAllKeys::raiseToWakeSensitivity, &OswConfigAllKeys::tapToWakeEnabled,
Expand Down

0 comments on commit a092d05

Please sign in to comment.