Clean up build warnings (#4169)
* [build][OSX] Fix clang warnings. * [build][OSX] A few more warnings taken care of. * [build] Fixed yet more build warnings across all platforms. * [build] Fix final warning due to bad CMake flag. * [build] Remove unused variables as requested, fix indent. * Fix output display limit type for 8-bit targets.
This commit is contained in:
committed by
Bertrand Songis
parent
1666fd7355
commit
1eead1504c
@@ -371,6 +371,8 @@ set(CMAKE_COMMON_FLAGS "")
|
||||
set(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG "")
|
||||
set(CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "")
|
||||
# similar for -Wl,-search_paths_first (fix "arch_paths_first" warning)
|
||||
set(CMAKE_CXX_LINK_FLAGS "")
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
|
||||
|
||||
|
||||
@@ -376,9 +376,7 @@ void evalFunctions()
|
||||
case FUNC_SET_TIMER:
|
||||
timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn));
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case FUNC_SET_FAILSAFE:
|
||||
{
|
||||
unsigned int moduleIndex = CFN_PARAM(cfn);
|
||||
@@ -393,7 +391,6 @@ void evalFunctions()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
case FUNC_RANGECHECK:
|
||||
@@ -405,7 +402,8 @@ void evalFunctions()
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(CPUARM)
|
||||
|
||||
#if defined(GVARS)
|
||||
case FUNC_ADJUST_GVAR:
|
||||
@@ -593,7 +591,7 @@ void evalFunctions()
|
||||
}
|
||||
else {
|
||||
functionsContext.lastFunctionTime[i] = 0;
|
||||
#if defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
#if defined(CPUARM) && defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
if (functionsContext.activeSwitches & switch_mask) {
|
||||
switch (CFN_FUNC(cfn)) {
|
||||
case FUNC_RANGECHECK:
|
||||
|
||||
@@ -143,7 +143,7 @@ void menuModelLimits(event_t event)
|
||||
lcdDrawChar(LIMITS_DIRECTION_POS, y, swVal);
|
||||
#endif
|
||||
|
||||
int8_t limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 100);
|
||||
limit_min_max_t limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 100);
|
||||
|
||||
putsChn(0, y, k+1, IS_LINE_SELECTED(sub, k) ? INVERS : 0);
|
||||
|
||||
|
||||
@@ -410,15 +410,6 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
|
||||
}
|
||||
}
|
||||
|
||||
const MenuItem MAIN_MENU[] = {
|
||||
{ "RADIO SETTINGS", menuRadioSetup },
|
||||
{ "MODEL SELECT", menuModelSelect },
|
||||
{ "MODEL SETTINGS", menuModelSetup },
|
||||
{ "CHECKLIST", menuModelNotes },
|
||||
{ "SD MANAGER", menuRadioSdManager },
|
||||
{ "VERSION", menuRadioVersion }
|
||||
};
|
||||
|
||||
bool isMenuAvailable(int index)
|
||||
{
|
||||
if (index == 4) {
|
||||
|
||||
@@ -48,4 +48,4 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val)
|
||||
}
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -278,16 +278,16 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
bool negative = false;
|
||||
|
||||
if (swtch < 0) {
|
||||
negative = true;
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
negative = true;
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
|
||||
negative = negative;
|
||||
(void)negative;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ static inline gtime_t ydhms_diff(long int year1, long int yday1, int hour1, int
|
||||
int year0, int yday0, int hour0, int min0, int sec0)
|
||||
{
|
||||
static_assert(-1 / 2 == 0, "no C99 integer division");
|
||||
static_assert(INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX, "long int year and yday are not wide enough");
|
||||
static_assert(INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= INT_MAX, "long int year and yday are not wide enough");
|
||||
|
||||
/* Compute intervening leap days correctly even if year is negative.
|
||||
Take care to avoid integer overflow here. */
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#define SECS_PER_DAY 86400ul
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
#define TIME_T_MIN (-__LONG_MAX__)
|
||||
#define TIME_T_MAX (__LONG_MAX__)
|
||||
|
||||
typedef long int gtime_t;
|
||||
|
||||
struct gtm
|
||||
|
||||
@@ -129,7 +129,6 @@ class RlcFile: public EFile
|
||||
uint8_t m_bRlc; // control byte for run length decoder
|
||||
uint8_t m_zeroes;
|
||||
|
||||
uint8_t m_flags;
|
||||
#define WRITE_FIRST_LINK 0x01
|
||||
#define WRITE_NEXT_LINK_1 0x02
|
||||
#define WRITE_NEXT_LINK_2 0x03
|
||||
|
||||
@@ -247,9 +247,9 @@ void adcRead()
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, -1,-1, -1,1, 0,0,0};
|
||||
|
||||
#if !defined(SIMU)
|
||||
uint16_t getAnalogValue(uint8_t index)
|
||||
{
|
||||
if (ana_direction[index] < 0)
|
||||
|
||||
@@ -22,13 +22,15 @@
|
||||
|
||||
volatile uint8_t dacStarted = false;
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
#if !defined(SOFTWARE_VOLUME)
|
||||
const int8_t volumeScale[VOLUME_LEVEL_MAX+1] =
|
||||
{
|
||||
0, 2, 4, 6, 8, 10, 13, 17, 22, 27, 33, 40,
|
||||
64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127
|
||||
} ;
|
||||
|
||||
#if !defined(SIMU)
|
||||
#endif
|
||||
|
||||
void setSampleRate(uint32_t frequency)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define SAMPTIME 2 // sample time = 28 cycles
|
||||
#define SAMPTIME_LONG 3 // sample time = 56 cycles
|
||||
|
||||
#if !defined(SIMU)
|
||||
#if defined(PCBX9E) && defined(HORUS_STICKS)
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1};
|
||||
#elif defined(PCBX9E)
|
||||
@@ -37,15 +38,18 @@
|
||||
#else
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,0, -1,1, 1};
|
||||
#endif
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
#if defined(PCBX9E)
|
||||
#define NUMBER_ANALOG_ADC1 10
|
||||
#define NUMBER_ANALOG_ADC3 (NUMBER_ANALOG - 10)
|
||||
#if !defined(SIMU)
|
||||
// mapping from adcValues order to enum Analogs
|
||||
const uint8_t ana_mapping[NUMBER_ANALOG] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/,
|
||||
10 /*POT1*/, 4 /*POT2*/, 5 /*POT3*/, 6 /*POT4*/,
|
||||
11 /*SLIDER1*/, 12 /*SLIDER2*/, 7 /*SLIDER3*/, 8 /*SLIDER4*/,
|
||||
9 /*TX_VOLTAGE*/ };
|
||||
#endif // !defined(SIMU)
|
||||
#else
|
||||
#define NUMBER_ANALOG_ADC1 NUMBER_ANALOG
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9E)
|
||||
#if defined(PCBX9E) && !defined(SIMU)
|
||||
#define PWR_PRESS_DURATION_MIN 200 // 2s
|
||||
#define PWR_PRESS_DURATION_MAX 500 // 5s
|
||||
|
||||
@@ -109,7 +109,7 @@ const pm_uchar bmp_startup[] PROGMEM = {
|
||||
const pm_uchar bmp_lock[] PROGMEM = {
|
||||
#include "lock.lbm"
|
||||
};
|
||||
#endif
|
||||
#endif // defined(PCBX9E) && !defined(SIMU)
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
|
||||
@@ -309,7 +309,9 @@ const pm_char STR_PPM_TRAINER[] PROGMEM = TR_PPM_TRAINER;
|
||||
const pm_char STR_CH[] PROGMEM = TR_CH;
|
||||
const pm_char STR_MODEL[] PROGMEM = TR_MODEL;
|
||||
const pm_char STR_FP[] PROGMEM = TR_FP;
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_MIX[] PROGMEM = TR_MIX;
|
||||
#endif
|
||||
const pm_char STR_ALERT[] PROGMEM = TR_ALERT;
|
||||
const pm_char STR_PRESSANYKEYTOSKIP[] PROGMEM = TR_PRESSANYKEYTOSKIP;
|
||||
const pm_char STR_THROTTLENOTIDLE[] PROGMEM = TR_THROTTLENOTIDLE;
|
||||
@@ -496,6 +498,7 @@ const pm_char STR_RESET_BTN[] PROGMEM = TR_RESET_BTN;
|
||||
#if defined(SDCARD)
|
||||
const pm_char STR_BACKUP_MODEL[] PROGMEM = TR_BACKUP_MODEL;
|
||||
const pm_char STR_RESTORE_MODEL[] PROGMEM = TR_RESTORE_MODEL;
|
||||
const pm_char STR_DELETE_ERROR[] PROGMEM = TR_DELETE_ERROR;
|
||||
const pm_char STR_SDCARD_ERROR[] PROGMEM = TR_SDCARD_ERROR;
|
||||
const pm_char STR_NO_SDCARD[] PROGMEM = TR_NO_SDCARD;
|
||||
const pm_char STR_SDCARD_FULL[] PROGMEM = TR_SDCARD_FULL;
|
||||
@@ -507,8 +510,6 @@ const pm_char STR_MODELS_PATH[] PROGMEM = MODELS_PATH;
|
||||
const pm_char STR_MODELS_EXT[] PROGMEM = MODELS_EXT;
|
||||
#endif
|
||||
|
||||
|
||||
const pm_char STR_DELETE_ERROR[] PROGMEM = TR_DELETE_ERROR;
|
||||
const pm_char STR_CAT_NOT_EMPTY[] PROGMEM = TR_CAT_NOT_EMPTY;
|
||||
const pm_char STR_WARNING[] PROGMEM = TR_WARNING;
|
||||
const pm_char STR_THROTTLEWARN[] PROGMEM = TR_THROTTLEWARN;
|
||||
|
||||
@@ -723,9 +723,10 @@ extern const pm_char STR_RESET_BTN[];
|
||||
extern const pm_char STR_BACKUP_MODEL[];
|
||||
extern const pm_char STR_RESTORE_MODEL[];
|
||||
extern const pm_char STR_DELETE_ERROR[];
|
||||
extern const pm_char STR_SDCARD_ERROR[];
|
||||
extern const pm_char STR_NO_SDCARD[];
|
||||
extern const pm_char STR_SDCARD_FULL[];
|
||||
extern const pm_char STR_SDCARD_NOWIZ[];
|
||||
extern const pm_char STR_SDCARD_NOWIZ[];
|
||||
extern const pm_char STR_INCOMPATIBLE[];
|
||||
extern const pm_char STR_LOGS_PATH[];
|
||||
extern const pm_char STR_LOGS_EXT[];
|
||||
@@ -734,7 +735,6 @@ extern const pm_char STR_SDCARD_NOWIZ[];
|
||||
#define STR_UPDATE_LIST STR_DELAYDOWN
|
||||
#endif
|
||||
|
||||
extern const pm_char STR_SDCARD_ERROR[];
|
||||
extern const pm_char STR_CAT_NOT_EMPTY[];
|
||||
extern const pm_char STR_WARNING[];
|
||||
extern const pm_char STR_STORAGE_WARNING[];
|
||||
|
||||
Reference in New Issue
Block a user