mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +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?
|
// Do we need to print an index in brackets after the name?
|
||||||
if (def->fieldNameIndex != -1) {
|
if (def->fieldNameIndex != -1) {
|
||||||
blackboxWrite('[');
|
charsWritten += blackboxPrintf("[%d]", def->fieldNameIndex);
|
||||||
// Assume the field index is a single digit:
|
|
||||||
blackboxWrite(def->fieldNameIndex + '0');
|
|
||||||
blackboxWrite(']');
|
|
||||||
charsWritten += 3;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//The other headers are integers
|
//The other headers are integers
|
||||||
if (def->arr[xmitState.headerIndex - 1] >= 10) {
|
charsWritten += blackboxPrintf("%d", def->arr[xmitState.headerIndex - 1]);
|
||||||
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++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue