mirror of
https://github.com/okalachev/flix.git
synced 2026-02-17 07:31:56 +00:00
Make parameter names case-insensitive
+ minor fix
This commit is contained in:
@@ -108,7 +108,7 @@ The drone is configured using parameters. To access and modify them, go to the Q
|
||||
|
||||
<img src="img/parameters.png" width="400">
|
||||
|
||||
You can also work with parameters using `p` command in the console.
|
||||
You can also work with parameters using `p` command in the console. Parameter names are case-insensitive.
|
||||
|
||||
### Define IMU orientation
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ float getParameter(int index) {
|
||||
|
||||
float getParameter(const char *name) {
|
||||
for (auto ¶meter : parameters) {
|
||||
if (strcmp(parameter.name, name) == 0) {
|
||||
if (strcasecmp(parameter.name, name) == 0) {
|
||||
return parameter.getValue();
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ float getParameter(const char *name) {
|
||||
|
||||
bool setParameter(const char *name, const float value) {
|
||||
for (auto ¶meter : parameters) {
|
||||
if (strcmp(parameter.name, name) == 0) {
|
||||
if (strcasecmp(parameter.name, name) == 0) {
|
||||
if (parameter.integer && !isfinite(value)) return false; // can't set integer to NaN or Inf
|
||||
parameter.setValue(value);
|
||||
return true;
|
||||
|
||||
@@ -13,10 +13,10 @@ float channelZero[16]; // calibration zero values
|
||||
float channelMax[16]; // calibration max values
|
||||
|
||||
float controlRoll, controlPitch, controlYaw, controlThrottle; // pilot's inputs, range [-1, 1]
|
||||
float controlMode = NAN; //
|
||||
float controlMode = NAN;
|
||||
float controlTime; // time of the last controls update (0 when no RC)
|
||||
|
||||
// Channels mapping (using float to store in parameters):
|
||||
// Channels mapping (nan means not assigned):
|
||||
float rollChannel = NAN, pitchChannel = NAN, throttleChannel = NAN, yawChannel = NAN, modeChannel = NAN;
|
||||
|
||||
void setupRC() {
|
||||
|
||||
Reference in New Issue
Block a user