diff --git a/docs/usage.md b/docs/usage.md index 8011866..ae9894e 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -108,7 +108,7 @@ The drone is configured using parameters. To access and modify them, go to the Q -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 diff --git a/flix/parameters.ino b/flix/parameters.ino index b251fb4..469a1ba 100644 --- a/flix/parameters.ino +++ b/flix/parameters.ino @@ -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; diff --git a/flix/rc.ino b/flix/rc.ino index 5702316..0095d55 100644 --- a/flix/rc.ino +++ b/flix/rc.ino @@ -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() {