Rename flushParameters to more clear syncParameters

This commit is contained in:
Oleg Kalachev 2024-12-26 01:14:26 +03:00
parent acc0274175
commit 8d7a4595f5
3 changed files with 6 additions and 6 deletions

View File

@ -67,5 +67,5 @@ void loop() {
processMavlink();
#endif
logData();
flushParameters();
syncParameters();
}

View File

@ -107,11 +107,11 @@ bool setParameter(const char *name, const float value) {
return false;
}
void flushParameters() {
static float lastFlush = 0;
if (t - lastFlush < 1) return; // flush once per second
void syncParameters() {
static float lastSync = 0;
if (t - lastSync < 1) return; // sync once per second
if (motorsActive()) return; // don't use flash while flying, it may cause a delay
lastFlush = t;
lastSync = t;
for (auto &parameter : parameters) {
if (parameter.value == *parameter.variable) continue;

View File

@ -87,7 +87,7 @@ public:
applyMotorForces();
publishTopics();
logData();
flushParameters();
syncParameters();
}
void applyMotorForces() {