mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-22 15:55:48 +03:00
cpm16 / cmp32 functions
used to compare timestamps with correct wrap. A bit more readable that typecasting in code. Only few uses replaced now
This commit is contained in:
parent
3cdc4a23b5
commit
dc5a888633
2 changed files with 5 additions and 2 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "common/maths.h"
|
||||
#include "common/axis.h"
|
||||
#include "common/color.h"
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "drivers/sensor.h"
|
||||
#include "drivers/accgyro.h"
|
||||
|
@ -236,14 +237,14 @@ void annexCode(void)
|
|||
}
|
||||
|
||||
if (feature(FEATURE_VBAT)) {
|
||||
if ((int32_t)(currentTime - vbatLastServiced) >= VBATINTERVAL) {
|
||||
if (cmp32(currentTime, vbatLastServiced) >= VBATINTERVAL) {
|
||||
vbatLastServiced = currentTime;
|
||||
updateBattery();
|
||||
}
|
||||
}
|
||||
|
||||
if (feature(FEATURE_CURRENT_METER)) {
|
||||
int32_t ibatTimeSinceLastServiced = (int32_t) (currentTime - ibatLastServiced);
|
||||
int32_t ibatTimeSinceLastServiced = cmp32(currentTime, ibatLastServiced);
|
||||
|
||||
if (ibatTimeSinceLastServiced >= IBATINTERVAL) {
|
||||
ibatLastServiced = currentTime;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue