changed ReadHrs and ReadAls to uint32, and did static_cast instead of hidden cast when using it
This commit is contained in:
parent
4cc95091ab
commit
464b689a03
|
@ -54,14 +54,14 @@ void Hrs3300::Disable() {
|
||||||
WriteRegister(static_cast<uint8_t>(Registers::Enable), value);
|
WriteRegister(static_cast<uint8_t>(Registers::Enable), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Hrs3300::ReadHrs() {
|
uint32_t Hrs3300::ReadHrs() {
|
||||||
auto m = ReadRegister(static_cast<uint8_t>(Registers::C0DataM));
|
auto m = ReadRegister(static_cast<uint8_t>(Registers::C0DataM));
|
||||||
auto h = ReadRegister(static_cast<uint8_t>(Registers::C0DataH));
|
auto h = ReadRegister(static_cast<uint8_t>(Registers::C0DataH));
|
||||||
auto l = ReadRegister(static_cast<uint8_t>(Registers::C0dataL));
|
auto l = ReadRegister(static_cast<uint8_t>(Registers::C0dataL));
|
||||||
return ((l & 0x30) << 12) | (m << 8) | ((h & 0x0f) << 4) | (l & 0x0f);
|
return ((l & 0x30) << 12) | (m << 8) | ((h & 0x0f) << 4) | (l & 0x0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Hrs3300::ReadAls() {
|
uint32_t Hrs3300::ReadAls() {
|
||||||
auto m = ReadRegister(static_cast<uint8_t>(Registers::C1dataM));
|
auto m = ReadRegister(static_cast<uint8_t>(Registers::C1dataM));
|
||||||
auto h = ReadRegister(static_cast<uint8_t>(Registers::C1dataH));
|
auto h = ReadRegister(static_cast<uint8_t>(Registers::C1dataH));
|
||||||
auto l = ReadRegister(static_cast<uint8_t>(Registers::C1dataL));
|
auto l = ReadRegister(static_cast<uint8_t>(Registers::C1dataL));
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace Pinetime {
|
||||||
void Init();
|
void Init();
|
||||||
void Enable();
|
void Enable();
|
||||||
void Disable();
|
void Disable();
|
||||||
uint16_t ReadHrs();
|
uint32_t ReadHrs();
|
||||||
uint16_t ReadAls();
|
uint32_t ReadAls();
|
||||||
void SetGain(uint8_t gain);
|
void SetGain(uint8_t gain);
|
||||||
void SetDrive(uint8_t drive);
|
void SetDrive(uint8_t drive);
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,7 @@ void HeartRateTask::Work() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (measurementStarted) {
|
if (measurementStarted) {
|
||||||
auto hrs = heartRateSensor.ReadHrs();
|
ppg.Preprocess(static_cast<float>(heartRateSensor.ReadHrs()));
|
||||||
ppg.Preprocess(hrs);
|
|
||||||
auto bpm = ppg.HeartRate();
|
auto bpm = ppg.HeartRate();
|
||||||
|
|
||||||
if (lastBpm == 0 && bpm == 0)
|
if (lastBpm == 0 && bpm == 0)
|
||||||
|
|
Loading…
Reference in a new issue