Capitalising Day enum's members "Today" and "Yesterday"

This commit is contained in:
Sándor Rátkai 2024-09-11 08:40:38 +02:00 committed by Hunman
parent 29f8c8e30c
commit 355178bdc4
3 changed files with 15 additions and 15 deletions

View file

@ -38,14 +38,14 @@ namespace {
void MotionController::AdvanceDay() {
--nbSteps; // Higher index = further in the past
nbSteps[today] = 0;
nbSteps[Today] = 0;
if (service != nullptr) {
service->OnNewStepCountValue(nbSteps[today]);
service->OnNewStepCountValue(nbSteps[Today]);
}
}
void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController::step_t nbSteps) {
if (this->nbSteps[today] != nbSteps && service != nullptr) {
if (this->nbSteps[Today] != nbSteps && service != nullptr) {
service->OnNewStepCountValue(nbSteps);
}
@ -65,11 +65,11 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController:
stats = GetAccelStats();
int32_t deltaSteps = nbSteps - this->nbSteps[today];
int32_t deltaSteps = nbSteps - this->nbSteps[Today];
if (deltaSteps > 0) {
currentTripSteps += deltaSteps;
}
this->nbSteps[today] = nbSteps;
this->nbSteps[Today] = nbSteps;
}
MotionController::AccelStats MotionController::GetAccelStats() const {

View file

@ -20,8 +20,8 @@ namespace Pinetime {
};
enum Days {
today = 0,
yesterday = 1,
Today = 0,
Yesterday = 1,
};
using step_t = uint32_t;
@ -44,7 +44,7 @@ namespace Pinetime {
}
step_t NbSteps() const {
return nbSteps[today];
return nbSteps[Today];
}
const Utility::CircularBuffer<step_t, stepHistorySize>& StepCounterHistory() const {

View file

@ -28,14 +28,14 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti
lv_arc_set_range(stepsArc, 0, 500);
lv_obj_align(stepsArc, nullptr, LV_ALIGN_CENTER, 0, 0);
currentTripSteps = stepsCount[Controllers::MotionController::Days::today] - motionController.GetTripSteps();
currentTripSteps = stepsCount[Controllers::MotionController::Days::Today] - motionController.GetTripSteps();
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount[Controllers::MotionController::Days::today] / settingsController.GetStepsGoal()));
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount[Controllers::MotionController::Days::Today] / settingsController.GetStepsGoal()));
lSteps = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME);
lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
lv_label_set_text_fmt(lSteps, "%lu", stepsCount[Controllers::MotionController::Days::today]);
lv_label_set_text_fmt(lSteps, "%lu", stepsCount[Controllers::MotionController::Days::Today]);
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
lv_obj_t* lstepsL = lv_label_create(lv_scr_act(), nullptr);
@ -45,7 +45,7 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti
lStepsYesterday = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(lStepsYesterday, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
lv_label_set_text_fmt(lStepsYesterday, yesterdayStr, stepsCount[Controllers::MotionController::Days::yesterday]);
lv_label_set_text_fmt(lStepsYesterday, yesterdayStr, stepsCount[Controllers::MotionController::Days::Yesterday]);
lv_label_set_align(lStepsYesterday, LV_LABEL_ALIGN_CENTER);
lv_obj_align(lStepsYesterday, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
@ -83,10 +83,10 @@ Steps::~Steps() {
void Steps::Refresh() {
currentTripSteps = motionController.GetTripSteps();
lv_label_set_text_fmt(lSteps, "%lu", stepsCount[Controllers::MotionController::Days::today]);
lv_label_set_text_fmt(lSteps, "%lu", stepsCount[Controllers::MotionController::Days::Today]);
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
lv_label_set_text_fmt(lStepsYesterday, yesterdayStr, stepsCount[Controllers::MotionController::Days::yesterday]);
lv_label_set_text_fmt(lStepsYesterday, yesterdayStr, stepsCount[Controllers::MotionController::Days::Yesterday]);
lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40);
if (currentTripSteps < 100000) {
@ -94,7 +94,7 @@ void Steps::Refresh() {
} else {
lv_label_set_text_fmt(tripLabel, "Trip: 99999+");
}
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount[Controllers::MotionController::Days::today] / settingsController.GetStepsGoal()));
lv_arc_set_value(stepsArc, int16_t(500 * stepsCount[Controllers::MotionController::Days::Today] / settingsController.GetStepsGoal()));
}
void Steps::lapBtnEventHandler(lv_event_t event) {