mirror of
https://github.com/okalachev/flix.git
synced 2025-07-29 04:19:00 +00:00
Rename flushParameters to more clear syncParameters
This commit is contained in:
parent
acc0274175
commit
8d7a4595f5
@ -67,5 +67,5 @@ void loop() {
|
|||||||
processMavlink();
|
processMavlink();
|
||||||
#endif
|
#endif
|
||||||
logData();
|
logData();
|
||||||
flushParameters();
|
syncParameters();
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,11 @@ bool setParameter(const char *name, const float value) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void flushParameters() {
|
void syncParameters() {
|
||||||
static float lastFlush = 0;
|
static float lastSync = 0;
|
||||||
if (t - lastFlush < 1) return; // flush once per second
|
if (t - lastSync < 1) return; // sync once per second
|
||||||
if (motorsActive()) return; // don't use flash while flying, it may cause a delay
|
if (motorsActive()) return; // don't use flash while flying, it may cause a delay
|
||||||
lastFlush = t;
|
lastSync = t;
|
||||||
|
|
||||||
for (auto ¶meter : parameters) {
|
for (auto ¶meter : parameters) {
|
||||||
if (parameter.value == *parameter.variable) continue;
|
if (parameter.value == *parameter.variable) continue;
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
applyMotorForces();
|
applyMotorForces();
|
||||||
publishTopics();
|
publishTopics();
|
||||||
logData();
|
logData();
|
||||||
flushParameters();
|
syncParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyMotorForces() {
|
void applyMotorForces() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user