mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
Buffer size fix for float point values >= 100.00 in CLI
This commit is contained in:
parent
0592f9f8fc
commit
744e2a857f
2 changed files with 11 additions and 9 deletions
|
@ -1121,7 +1121,7 @@ static void cliMotorMix(char *cmdline)
|
|||
int i, check = 0;
|
||||
int num_motors = 0;
|
||||
uint8_t len;
|
||||
char buf[16];
|
||||
char ftoaBuffer[FTOA_BUFFER_SIZE];
|
||||
char *ptr;
|
||||
|
||||
if (isEmpty(cmdline)) {
|
||||
|
@ -1131,10 +1131,10 @@ static void cliMotorMix(char *cmdline)
|
|||
break;
|
||||
num_motors++;
|
||||
cliPrintf("#%d:\t", i);
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].throttle, buf));
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].roll, buf));
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].pitch, buf));
|
||||
cliPrintf("%s\r\n", ftoa(masterConfig.customMotorMixer[i].yaw, buf));
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].throttle, ftoaBuffer));
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].roll, ftoaBuffer));
|
||||
cliPrintf("%s\t", ftoa(masterConfig.customMotorMixer[i].pitch, ftoaBuffer));
|
||||
cliPrintf("%s\r\n", ftoa(masterConfig.customMotorMixer[i].yaw, ftoaBuffer));
|
||||
}
|
||||
return;
|
||||
} else if (strncasecmp(cmdline, "reset", 5) == 0) {
|
||||
|
@ -2259,7 +2259,7 @@ static void cliWrite(uint8_t ch)
|
|||
static void cliPrintVar(const clivalue_t *var, uint32_t full)
|
||||
{
|
||||
int32_t value = 0;
|
||||
char buf[8];
|
||||
char ftoaBuffer[FTOA_BUFFER_SIZE];
|
||||
|
||||
void *ptr = var->ptr;
|
||||
if ((var->type & VALUE_SECTION_MASK) == PROFILE_VALUE) {
|
||||
|
@ -2291,10 +2291,10 @@ static void cliPrintVar(const clivalue_t *var, uint32_t full)
|
|||
break;
|
||||
|
||||
case VAR_FLOAT:
|
||||
cliPrintf("%s", ftoa(*(float *)ptr, buf));
|
||||
cliPrintf("%s", ftoa(*(float *)ptr, ftoaBuffer));
|
||||
if (full && (var->type & VALUE_MODE_MASK) == MODE_DIRECT) {
|
||||
cliPrintf(" %s", ftoa((float)var->config.minmax.min, buf));
|
||||
cliPrintf(" %s", ftoa((float)var->config.minmax.max, buf));
|
||||
cliPrintf(" %s", ftoa((float)var->config.minmax.min, ftoaBuffer));
|
||||
cliPrintf(" %s", ftoa((float)var->config.minmax.max, ftoaBuffer));
|
||||
}
|
||||
return; // return from case for float only
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue