Make parameter names case-insensitive

+ minor fix
This commit is contained in:
Oleg Kalachev
2026-01-22 23:11:47 +03:00
parent 30326a5662
commit 0abb18c616
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -121,7 +121,7 @@ float getParameter(int index) {
float getParameter(const char *name) {
for (auto &parameter : 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 &parameter : 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;

View File

@@ -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() {