mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
blackbox - support arrays greater that 10 elements / use printf to print numbers
This commit is contained in:
parent
8d2dc82f4b
commit
35ef95cec7
1 changed files with 2 additions and 13 deletions
|
@ -839,22 +839,11 @@ static bool sendFieldDefinition(const char * const *headerNames, unsigned int he
|
|||
|
||||
// Do we need to print an index in brackets after the name?
|
||||
if (def->fieldNameIndex != -1) {
|
||||
blackboxWrite('[');
|
||||
// Assume the field index is a single digit:
|
||||
blackboxWrite(def->fieldNameIndex + '0');
|
||||
blackboxWrite(']');
|
||||
charsWritten += 3;
|
||||
charsWritten += blackboxPrintf("[%d]", def->fieldNameIndex);
|
||||
}
|
||||
} else {
|
||||
//The other headers are integers
|
||||
if (def->arr[xmitState.headerIndex - 1] >= 10) {
|
||||
blackboxWrite(def->arr[xmitState.headerIndex - 1] / 10 + '0');
|
||||
blackboxWrite(def->arr[xmitState.headerIndex - 1] % 10 + '0');
|
||||
charsWritten += 2;
|
||||
} else {
|
||||
blackboxWrite(def->arr[xmitState.headerIndex - 1] + '0');
|
||||
charsWritten++;
|
||||
}
|
||||
charsWritten += blackboxPrintf("%d", def->arr[xmitState.headerIndex - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue