mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Switch to static storage for error counters
Remove DEBUG_INCR, and switch to static counters.
This commit is contained in:
parent
8627af832c
commit
a543ed8887
2 changed files with 5 additions and 3 deletions
|
@ -25,7 +25,6 @@ extern int16_t debug[DEBUG16_VALUE_COUNT];
|
|||
extern uint8_t debugMode;
|
||||
|
||||
#define DEBUG_SET(mode, index, value) {if (debugMode == (mode)) {debug[(index)] = (value);}}
|
||||
#define DEBUG_INCR(mode, index) {if (debugMode == (mode)) {++debug[(index)];}}
|
||||
|
||||
#define DEBUG_SECTION_TIMES
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ static bool shouldSendTelemetryFrame(void)
|
|||
STATIC_UNIT_TESTED uint8_t ghstFrameStatus(rxRuntimeState_t *rxRuntimeState)
|
||||
{
|
||||
UNUSED(rxRuntimeState);
|
||||
static int16_t crcErrorCount = 0;
|
||||
|
||||
if (ghstFrameAvailable) {
|
||||
ghstFrameAvailable = false;
|
||||
|
@ -199,7 +200,7 @@ STATIC_UNIT_TESTED uint8_t ghstFrameStatus(rxRuntimeState_t *rxRuntimeState)
|
|||
}
|
||||
|
||||
if(crc != ghstValidatedFrame.bytes[fullFrameLength - 1] ) {
|
||||
DEBUG_INCR(DEBUG_GHST, DEBUG_GHST_CRC_ERRORS);
|
||||
DEBUG_SET(DEBUG_GHST, DEBUG_GHST_CRC_ERRORS, ++crcErrorCount);
|
||||
}
|
||||
|
||||
return RX_FRAME_DROPPED; // frame was invalid
|
||||
|
@ -219,6 +220,8 @@ static bool ghstProcessFrame(const rxRuntimeState_t *rxRuntimeState)
|
|||
|
||||
UNUSED(rxRuntimeState);
|
||||
|
||||
static int16_t unknownFrameCount = 0;
|
||||
|
||||
// do we have a telemetry buffer to send?
|
||||
if (shouldSendTelemetryFrame()) {
|
||||
ghstTransmittingTelemetry = true;
|
||||
|
@ -267,7 +270,7 @@ static bool ghstProcessFrame(const rxRuntimeState_t *rxRuntimeState)
|
|||
case GHST_UL_RC_CHANS_HS4_9TO12: startIdx = 8; break;
|
||||
case GHST_UL_RC_CHANS_HS4_13TO16: startIdx = 12; break;
|
||||
default:
|
||||
DEBUG_INCR(DEBUG_GHST, DEBUG_GHST_UNKNOWN_FRAMES);
|
||||
DEBUG_SET(DEBUG_GHST, DEBUG_GHST_UNKNOWN_FRAMES, ++unknownFrameCount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue