1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 03:20:00 +03:00

Fix codestyle (#14245)

Fix codestyle and prevent loop when commandLen is zero
This commit is contained in:
Mark Haslinghuis 2025-02-10 15:38:25 +01:00 committed by GitHub
parent 86767ba112
commit 6df8d0edda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -470,16 +470,17 @@ const uint8_t ubloxUTCStandardConfig_int[5] = {
};
struct ubloxVersion_s ubloxVersionMap[] = {
[UBX_VERSION_UNDEF] = {~0, "UNKNOWN"},
[UBX_VERSION_M5] = {0x00040005, "M5"},
[UBX_VERSION_M6] = {0x00040007, "M6"},
[UBX_VERSION_M7] = {0x00070000, "M7"},
[UBX_VERSION_M8] = {0x00080000, "M8"},
[UBX_VERSION_M9] = {0x00190000, "M9"},
[UBX_VERSION_M10] = {0x000A0000, "M10"},
[UBX_VERSION_UNDEF] = { ~0, "UNKNOWN" },
[UBX_VERSION_M5] = { 0x00040005, "M5" },
[UBX_VERSION_M6] = { 0x00040007, "M6" },
[UBX_VERSION_M7] = { 0x00070000, "M7" },
[UBX_VERSION_M8] = { 0x00080000, "M8" },
[UBX_VERSION_M9] = { 0x00190000, "M9" },
[UBX_VERSION_M10] = { 0x000A0000, "M10" },
};
static uint8_t ubloxAddValSet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key, const uint8_t * payload, const uint8_t offset) {
static uint8_t ubloxAddValSet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key, const uint8_t * payload, const uint8_t offset)
{
size_t len;
switch((key >> (8 * 3)) & 0xff) {
case 0x10:
@ -498,8 +499,8 @@ static uint8_t ubloxAddValSet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key,
default:
return 0;
}
if (offset + 4 + len > MAX_VALSET_SIZE)
{
if (offset + 4 + len > MAX_VALSET_SIZE) {
return 0;
}
@ -538,7 +539,8 @@ static size_t ubloxValGet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key, ubl
}
#endif // not used
static uint8_t ubloxValSet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key, uint8_t * payload, ubloxValLayer_e layer) {
static uint8_t ubloxValSet(ubxMessage_t * tx_buffer, ubxValGetSetBytes_e key, uint8_t * payload, ubloxValLayer_e layer)
{
memset(&tx_buffer->payload.cfg_valset, 0, sizeof(ubxCfgValSet_t));
// tx_buffer->payload.cfg_valset.version = 0;
@ -615,7 +617,8 @@ static void ubloxSendPollMessage(uint8_t msg_id)
ubloxSendMessage(&msg, false);
}
static void ubloxSendNAV5Message(uint8_t model) {
static void ubloxSendNAV5Message(uint8_t model)
{
DEBUG_SET(DEBUG_GPS_CONNECTION, 0, model);
ubxMessage_t tx_buffer;
if (gpsData.ubloxM9orAbove) {
@ -1538,7 +1541,8 @@ static void gpsNewData(uint16_t c)
}
#ifdef USE_GPS_UBLOX
static ubloxVersion_e ubloxParseVersion(const uint32_t version) {
static ubloxVersion_e ubloxParseVersion(const uint32_t version)
{
for (size_t i = 0; i < ARRAYLEN(ubloxVersionMap); ++i) {
if (version == ubloxVersionMap[i].hw) {
return (ubloxVersion_e) i;
@ -1836,7 +1840,7 @@ static bool writeGpsSolutionNmea(gpsSolutionData_t *sol, const gpsDataNmea_t *da
sol->groundCourse = data->ground_course;
#ifdef USE_RTC_TIME
// This check will miss 00:00:00.00, but we shouldn't care - next report will be valid
if(!rtcHasTime() && data->date != 0 && data->time != 0) {
if (!rtcHasTime() && data->date != 0 && data->time != 0) {
dateTime_t temp_time;
temp_time.year = (data->date % 100) + 2000;
temp_time.month = (data->date / 100) % 100;
@ -2567,8 +2571,7 @@ static void GPS_calculateDistanceFlown(bool initialize)
if (initialize) {
GPS_distanceFlownInCm = 0;
} else {
if (STATE(GPS_FIX_HOME) && ARMING_FLAG(ARMED)) {
} else if (STATE(GPS_FIX_HOME) && ARMING_FLAG(ARMED)) {
uint16_t speed = gpsConfig()->gps_use_3d_speed ? gpsSol.speed3d : gpsSol.groundSpeed;
// Only add up movement when speed is faster than minimum threshold
if (speed > GPS_DISTANCE_FLOWN_MIN_SPEED_THRESHOLD_CM_S) {
@ -2577,7 +2580,6 @@ static void GPS_calculateDistanceFlown(bool initialize)
GPS_distanceFlownInCm += dist;
}
}
}
lastLLH = gpsSol.llh;
}
@ -2724,4 +2726,3 @@ baudRate_e getGpsPortActualBaudRateIndex(void)
}
#endif // USE_GPS