mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 23:21:53 +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) {
|
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);
|
service->OnNewStepCountValue(nbSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController:
|
||||||
|
|
||||||
stats = GetAccelStats();
|
stats = GetAccelStats();
|
||||||
|
|
||||||
int32_t deltaSteps = nbSteps - this->nbSteps[0];
|
int32_t deltaSteps = nbSteps - this->nbSteps[today];
|
||||||
if (deltaSteps > 0) {
|
if (deltaSteps > 0) {
|
||||||
currentTripSteps += deltaSteps;
|
currentTripSteps += deltaSteps;
|
||||||
}
|
}
|
||||||
this->nbSteps[0] = nbSteps;
|
this->nbSteps[today] = nbSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionController::AccelStats MotionController::GetAccelStats() const {
|
MotionController::AccelStats MotionController::GetAccelStats() const {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace Controllers {
|
namespace Controllers {
|
||||||
class MotionService;
|
class MotionService;
|
||||||
|
|
||||||
class MotionController {
|
class MotionController {
|
||||||
public:
|
public:
|
||||||
enum class DeviceTypes {
|
enum class DeviceTypes {
|
||||||
|
@ -19,6 +19,11 @@ namespace Pinetime {
|
||||||
BMA425,
|
BMA425,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Days {
|
||||||
|
today = 0,
|
||||||
|
yesterday = 1,
|
||||||
|
};
|
||||||
|
|
||||||
using step_t = uint32_t;
|
using step_t = uint32_t;
|
||||||
static constexpr size_t stepHistorySize = 2; // Store this many day's step counter
|
static constexpr size_t stepHistorySize = 2; // Store this many day's step counter
|
||||||
|
|
||||||
|
@ -37,7 +42,7 @@ namespace Pinetime {
|
||||||
}
|
}
|
||||||
|
|
||||||
step_t NbSteps() const {
|
step_t NbSteps() const {
|
||||||
return nbSteps[0];
|
return nbSteps[today];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetTrip() {
|
void ResetTrip() {
|
||||||
|
|
Loading…
Reference in a new issue