cppcheck warning removal

This commit is contained in:
atomiclama 2016-12-16 13:23:22 +00:00 committed by atomiclama
parent 61cddacd5c
commit cdf7e43ab1
3 changed files with 8 additions and 14 deletions

View File

@ -215,9 +215,8 @@ static void serializeNames(sbuf_t *dst, const char *s)
static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId) static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId)
{ {
uint8_t boxIndex; uint8_t boxIndex;
const box_t *candidate;
for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) { for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
candidate = &boxes[boxIndex]; const box_t *candidate = &boxes[boxIndex];
if (candidate->boxId == activeBoxId) { if (candidate->boxId == activeBoxId) {
return candidate; return candidate;
} }
@ -228,9 +227,8 @@ static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId)
static const box_t *findBoxByPermenantId(uint8_t permenantId) static const box_t *findBoxByPermenantId(uint8_t permenantId)
{ {
uint8_t boxIndex; uint8_t boxIndex;
const box_t *candidate;
for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) { for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
candidate = &boxes[boxIndex]; const box_t *candidate = &boxes[boxIndex];
if (candidate->permanentId == permenantId) { if (candidate->permanentId == permenantId) {
return candidate; return candidate;
} }
@ -1381,7 +1379,6 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
#ifdef USE_SERVOS #ifdef USE_SERVOS
if (dataSize != 1 + sizeof(servoParam_t)) { if (dataSize != 1 + sizeof(servoParam_t)) {
return MSP_RESULT_ERROR; return MSP_RESULT_ERROR;
break;
} }
i = sbufReadU8(src); i = sbufReadU8(src);
if (i >= MAX_SUPPORTED_SERVOS) { if (i >= MAX_SUPPORTED_SERVOS) {
@ -1535,7 +1532,6 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
case MSP_SET_TRANSPONDER_CONFIG: case MSP_SET_TRANSPONDER_CONFIG:
if (dataSize != sizeof(masterConfig.transponderData)) { if (dataSize != sizeof(masterConfig.transponderData)) {
return MSP_RESULT_ERROR; return MSP_RESULT_ERROR;
break;
} }
for (unsigned int i = 0; i < sizeof(masterConfig.transponderData); i++) { for (unsigned int i = 0; i < sizeof(masterConfig.transponderData); i++) {
masterConfig.transponderData[i] = sbufReadU8(src); masterConfig.transponderData[i] = sbufReadU8(src);

View File

@ -110,8 +110,8 @@ static void taskHandleSerial(timeUs_t currentTimeUs)
static void taskUpdateBattery(timeUs_t currentTimeUs) static void taskUpdateBattery(timeUs_t currentTimeUs)
{ {
#if defined(USE_ADC) || defined(USE_ESC_SENSOR) #if defined(USE_ADC) || defined(USE_ESC_SENSOR)
static uint32_t vbatLastServiced = 0;
if (feature(FEATURE_VBAT) || feature(FEATURE_ESC_SENSOR)) { if (feature(FEATURE_VBAT) || feature(FEATURE_ESC_SENSOR)) {
static uint32_t vbatLastServiced = 0;
if (cmp32(currentTimeUs, vbatLastServiced) >= VBATINTERVAL) { if (cmp32(currentTimeUs, vbatLastServiced) >= VBATINTERVAL) {
vbatLastServiced = currentTimeUs; vbatLastServiced = currentTimeUs;
updateBattery(); updateBattery();
@ -119,8 +119,8 @@ static void taskUpdateBattery(timeUs_t currentTimeUs)
} }
#endif #endif
static uint32_t ibatLastServiced = 0;
if (feature(FEATURE_CURRENT_METER) || feature(FEATURE_ESC_SENSOR)) { if (feature(FEATURE_CURRENT_METER) || feature(FEATURE_ESC_SENSOR)) {
static uint32_t ibatLastServiced = 0;
const int32_t ibatTimeSinceLastServiced = cmp32(currentTimeUs, ibatLastServiced); const int32_t ibatTimeSinceLastServiced = cmp32(currentTimeUs, ibatLastServiced);
if (ibatTimeSinceLastServiced >= IBATINTERVAL) { if (ibatTimeSinceLastServiced >= IBATINTERVAL) {

View File

@ -568,13 +568,11 @@ static void applyLedBatteryLayer(bool updateNow, timeUs_t *timer)
{ {
static bool flash = false; static bool flash = false;
int state;
int timerDelayUs = HZ_TO_US(1); int timerDelayUs = HZ_TO_US(1);
if (updateNow) { if (updateNow) {
state = getBatteryState();
switch (state) { switch (getBatteryState()) {
case BATTERY_OK: case BATTERY_OK:
flash = true; flash = true;
timerDelayUs = HZ_TO_US(1); timerDelayUs = HZ_TO_US(1);
@ -605,11 +603,10 @@ static void applyLedRssiLayer(bool updateNow, timeUs_t *timer)
{ {
static bool flash = false; static bool flash = false;
int state;
int timerDelay = HZ_TO_US(1); int timerDelay = HZ_TO_US(1);
if (updateNow) { if (updateNow) {
state = (rssi * 100) / 1023; int state = (rssi * 100) / 1023;
if (state > 50) { if (state > 50) {
flash = true; flash = true;
@ -634,11 +631,12 @@ static void applyLedRssiLayer(bool updateNow, timeUs_t *timer)
#ifdef GPS #ifdef GPS
static void applyLedGpsLayer(bool updateNow, timeUs_t *timer) static void applyLedGpsLayer(bool updateNow, timeUs_t *timer)
{ {
static uint8_t gpsFlashCounter = 0;
static uint8_t gpsPauseCounter = 0; static uint8_t gpsPauseCounter = 0;
const uint8_t blinkPauseLength = 4; const uint8_t blinkPauseLength = 4;
if (updateNow) { if (updateNow) {
static uint8_t gpsFlashCounter = 0;
if (gpsPauseCounter > 0) { if (gpsPauseCounter > 0) {
gpsPauseCounter--; gpsPauseCounter--;
} else if (gpsFlashCounter >= GPS_numSat) { } else if (gpsFlashCounter >= GPS_numSat) {