mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Added an enum for the index of today and yesterday
This commit is contained in:
parent
9687154f2f
commit
090c3bfe21
|
@ -37,7 +37,7 @@ namespace {
|
|||
}
|
||||
|
||||
void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController::step_t nbSteps) {
|
||||
if (this->nbSteps[0] != nbSteps && service != nullptr) {
|
||||
if (this->nbSteps[today] != nbSteps && service != nullptr) {
|
||||
service->OnNewStepCountValue(nbSteps);
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,11 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController:
|
|||
|
||||
stats = GetAccelStats();
|
||||
|
||||
int32_t deltaSteps = nbSteps - this->nbSteps[0];
|
||||
int32_t deltaSteps = nbSteps - this->nbSteps[today];
|
||||
if (deltaSteps > 0) {
|
||||
currentTripSteps += deltaSteps;
|
||||
}
|
||||
this->nbSteps[0] = nbSteps;
|
||||
this->nbSteps[today] = nbSteps;
|
||||
}
|
||||
|
||||
MotionController::AccelStats MotionController::GetAccelStats() const {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
namespace Pinetime {
|
||||
namespace Controllers {
|
||||
class MotionService;
|
||||
|
||||
|
||||
class MotionController {
|
||||
public:
|
||||
enum class DeviceTypes {
|
||||
|
@ -19,6 +19,11 @@ namespace Pinetime {
|
|||
BMA425,
|
||||
};
|
||||
|
||||
enum Days {
|
||||
today = 0,
|
||||
yesterday = 1,
|
||||
};
|
||||
|
||||
using step_t = uint32_t;
|
||||
static constexpr size_t stepHistorySize = 2; // Store this many day's step counter
|
||||
|
||||
|
@ -37,7 +42,7 @@ namespace Pinetime {
|
|||
}
|
||||
|
||||
step_t NbSteps() const {
|
||||
return nbSteps[0];
|
||||
return nbSteps[today];
|
||||
}
|
||||
|
||||
void ResetTrip() {
|
||||
|
|
Loading…
Reference in a new issue