Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAL : add getStepsAverage #269

Merged
merged 2 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/hal/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class OswHal::Environment {
uint32_t getStepsTotal();
uint32_t getStepsTotalWeek();
#ifdef OSW_FEATURE_STATS_STEPS
uint32_t getStepsAverage();
uint32_t getStepsOnDay(uint8_t dayOfWeek, bool lastWeek = false);
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/apps/tools/OswAppDistStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void OswAppDistStats::showStickChart() {
hal->gfx()->setTextCursor(DISP_W/2, 190);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsOnDay(tmpCursor,true))) ); // lastweek(before 7 day)
hal->gfx()->setTextCursor(DISP_W/2, 215);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsTotalWeek()) / 7)+String("/")+String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsTotalWeek()))); // Avg/Total
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsAverage())) + String("/") + String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsTotalWeek()))); // Avg/Total
hal->gfx()->setTextSize(2);
hal->gfx()->setTextCursor(DISP_W/2, 205);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateDistance(hal->environment->getStepsOnDay(tmpCursor)) + String(" m"))); // Big font Fitness value
Expand Down
2 changes: 1 addition & 1 deletion src/apps/tools/OswAppKcalStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void OswAppKcalStats::showCurvedChart() {
hal->gfx()->setTextCursor(DISP_W/2, 190);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsOnDay(wDay, true)))); // lastweek(before 7 day)
hal->gfx()->setTextCursor(DISP_W/2, 215);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsTotalWeek()) / 7) + String("/") + String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsTotalWeek()))); // Avg/Total
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsAverage())) + String("/") + String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsTotalWeek()))); // Avg/Total
hal->gfx()->setTextSize(2);
hal->gfx()->setTextCursor(DISP_W/2, 205);
hal->gfx()->print(String(OswAppWatchfaceFitness::calculateKcalorie(hal->environment->getStepsOnDay(wDay)) + String(" Kcal"))); // Big font Fitness value
Expand Down
2 changes: 1 addition & 1 deletion src/apps/tools/OswAppStepStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void OswAppStepStats::showStickChart() {
hal->gfx()->setTextCursor(DISP_W/2, 190);
hal->gfx()->print(String(hal->environment->getStepsOnDay(tmpCursor, true))); // lastweek(before 7 day)
hal->gfx()->setTextCursor(DISP_W/2, 215);
hal->gfx()->print(String(hal->environment->getStepsTotalWeek() / 7) + String("/") + String(hal->environment->getStepsTotalWeek())); // Avg/Total
hal->gfx()->print(String(hal->environment->getStepsAverage()) + String("/") + String(hal->environment->getStepsTotalWeek())); // Avg/Total
hal->gfx()->setTextSize(2);
hal->gfx()->setTextCursor(DISP_W/2, 205);
hal->gfx()->print(String(hal->environment->getStepsOnDay(tmpCursor))); // Big font Fitness value
Expand Down
5 changes: 5 additions & 0 deletions src/hal/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ uint32_t OswHal::Environment::getStepsTotalWeek() {
return this->getStepsTotal();
#endif
}
#ifdef OSW_FEATURE_STATS_STEPS
uint32_t OswHal::Environment::getStepsAverage() {
return this->getStepsTotalWeek() / 7;
}
#endif
#endif

#if OSW_PLATFORM_ENVIRONMENT_PRESSURE == 1
Expand Down