Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Rename flushParameters to more clear syncParameters

Oleg Kalachev8d7a4595f5c7
diff --git a/flix/flix.ino b/flix/flix.ino
index c5de571..cc59ed4 100644
--- a/flix/flix.ino
+++ b/flix/flix.ino
@@ -67,5 +67,5 @@ void loop() {
processMavlink();
#endif
logData();
- flushParameters();
+ syncParameters();
}
diff --git a/flix/parameters.ino b/flix/parameters.ino
index 6b9e688..d39cb50 100644
--- a/flix/parameters.ino
+++ b/flix/parameters.ino
@@ -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;
diff --git a/gazebo/simulator.cpp b/gazebo/simulator.cpp
index 235ff72..e83e578 100644
--- a/gazebo/simulator.cpp
+++ b/gazebo/simulator.cpp
@@ -87,7 +87,7 @@ public:
applyMotorForces();
publishTopics();
logData();
- flushParameters();
+ syncParameters();
}
void applyMotorForces() {