mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
cppcheck - minor problems fixed (#13609)
This commit is contained in:
parent
a000913ed4
commit
4640a5da96
7 changed files with 12 additions and 9 deletions
|
@ -453,6 +453,7 @@ static void cliPrintError(const char *cmdName, const char *format, ...)
|
|||
va_list va;
|
||||
va_start(va, format);
|
||||
cliPrintErrorVa(cmdName, format, va);
|
||||
va_end(va);
|
||||
|
||||
if (!cliWriter) {
|
||||
// Supply our own linefeed in case we are printing inside a custom defaults operation
|
||||
|
@ -467,6 +468,7 @@ static void cliPrintErrorLinef(const char *cmdName, const char *format, ...)
|
|||
va_list va;
|
||||
va_start(va, format);
|
||||
cliPrintErrorVa(cmdName, format, va);
|
||||
va_end(va);
|
||||
cliPrintInternal(cliErrorWriter, "\r\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ STATIC_UNIT_TESTED void updateLEDDMABuffer(ledStripFormatRGB_e ledFormat, rgbCol
|
|||
}
|
||||
|
||||
unsigned dmaBufferOffset = 0;
|
||||
for (int index = bits_per_led-1; index >= 0; index--) {
|
||||
ledStripDMABuffer[ledIndex * bits_per_led + dmaBufferOffset++] = (packed_colour & (1 << index)) ? BIT_COMPARE_1 : BIT_COMPARE_0;
|
||||
for (int index = bits_per_led - 1; index >= 0; index--) {
|
||||
ledStripDMABuffer[ledIndex * bits_per_led + dmaBufferOffset++] = (packed_colour & (1U << index)) ? BIT_COMPARE_1 : BIT_COMPARE_0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ const adcTagMap_t adcTagMap[] = {
|
|||
{ DEFIO_TAG_E__NONE, ADC_DEVICE_FOR_INTERNAL, ADC_CHANNEL_VREFINT, 19 }, // 19 VREFINT
|
||||
{ DEFIO_TAG_E__NONE, ADC_DEVICE_FOR_INTERNAL, ADC_CHANNEL_TEMPSENSOR, 18 }, // 18 VSENSE
|
||||
{ DEFIO_TAG_E__NONE, ADC_DEVICE_FOR_INTERNAL, ADC_CHANNEL_VBAT, 17 }, // 17 VBAT/4
|
||||
#elif
|
||||
#else
|
||||
#error MCU not defined
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "common/time.h"
|
||||
|
||||
#define BEEPER_GET_FLAG(mode) (1 << (mode - 1))
|
||||
#define BEEPER_GET_FLAG(mode) (1 << ((mode) - 1))
|
||||
|
||||
#ifdef USE_DSHOT
|
||||
#define DSHOT_BEACON_GUARD_DELAY_US 1200000 // Time to separate dshot beacon and armining/disarming events
|
||||
|
|
|
@ -579,12 +579,13 @@ void esc4wayProcess(serialPort_t *mspPort)
|
|||
case cmd_InterfaceSetMode:
|
||||
{
|
||||
#if defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER) && defined(USE_SERIAL_4WAY_SK_BOOTLOADER)
|
||||
if ((ParamBuf[0] <= imARM_BLB) && (ParamBuf[0] >= imSIL_BLB)) {
|
||||
if ((ParamBuf[0] <= imARM_BLB) && (ParamBuf[0] >= imSIL_BLB))
|
||||
#elif defined(USE_SERIAL_4WAY_BLHELI_BOOTLOADER)
|
||||
if (((ParamBuf[0] <= imATM_BLB)||(ParamBuf[0] == imARM_BLB)) && (ParamBuf[0] >= imSIL_BLB)) {
|
||||
if (((ParamBuf[0] <= imATM_BLB)||(ParamBuf[0] == imARM_BLB)) && (ParamBuf[0] >= imSIL_BLB))
|
||||
#elif defined(USE_SERIAL_4WAY_SK_BOOTLOADER)
|
||||
if (ParamBuf[0] == imSK) {
|
||||
if (ParamBuf[0] == imSK)
|
||||
#endif
|
||||
{
|
||||
CurrentInterfaceMode = ParamBuf[0];
|
||||
} else {
|
||||
ACK_OUT = ACK_I_INVALID_PARAM;
|
||||
|
|
|
@ -153,7 +153,7 @@ void spektrumHandleRSSI(volatile uint8_t spekFrame[])
|
|||
0,resolution));
|
||||
#else
|
||||
// Do a direkt dBm to percent mapping, keeping the non-linear dBm logarithmic curve.
|
||||
spekChannelData[rssi_channel] = (uint16_t)(map(rssi),
|
||||
spekChannelData[rssi_channel] = (uint16_t)(map(rssi,
|
||||
SPEKTRUM_RSSI_MIN, SPEKTRUM_RSSI_MAX,
|
||||
0,resolution));
|
||||
#endif
|
||||
|
|
|
@ -226,7 +226,7 @@ bool srxl2ProcessControlData(const Srxl2Header* header, rxRuntimeState_t *rxRunt
|
|||
DEBUG_PRINTF("vtx region: %x\r\n", vtxData->region);
|
||||
// Pack data as it was used before srxl2 to use existing functions.
|
||||
// Get the VTX control bytes in a frame
|
||||
uint32_t vtxControl = (0xE0 << 24) | (0xE0 << 8) |
|
||||
uint32_t vtxControl = (0xE0U << 24) | (0xE0 << 8) |
|
||||
((vtxData->band & 0x07) << 21) |
|
||||
((vtxData->channel & 0x0F) << 16) |
|
||||
((vtxData->pit & 0x01) << 4) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue