diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index 88ce3f9bd..f5d8eb7d6 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -193,7 +193,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i return errors.to_ulong(); } -unsigned long Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) +unsigned long Er9xInterface::loadBackup(RadioData &radioData, const uint8_t *eeprom, int esize, int index) { std::bitset errors; errors.set(UNKNOWN_ERROR); diff --git a/companion/src/firmwares/er9x/er9xinterface.h b/companion/src/firmwares/er9x/er9xinterface.h index fbde7e781..645d4cb5f 100644 --- a/companion/src/firmwares/er9x/er9xinterface.h +++ b/companion/src/firmwares/er9x/er9xinterface.h @@ -43,7 +43,7 @@ class Er9xInterface : public EEPROMInterface virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size); - virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); + virtual unsigned long loadBackup(RadioData &, const uint8_t * eeprom, int esize, int index); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc); diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp index fce7850ee..d63787726 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp @@ -237,7 +237,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom return errors.to_ulong(); } -unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) +unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, const uint8_t *eeprom, int esize, int index) { std::bitset errors; errors.set(UNKNOWN_ERROR); diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.h b/companion/src/firmwares/ersky9x/ersky9xinterface.h index 561580b2e..c39cbaf5c 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.h +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.h @@ -43,7 +43,7 @@ class Ersky9xInterface : public EEPROMInterface virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size); - virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); + virtual unsigned long loadBackup(RadioData &, const uint8_t * eeprom, int esize, int index); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc); diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp index 0830a32e4..c2e522809 100644 --- a/companion/src/logsdialog.cpp +++ b/companion/src/logsdialog.cpp @@ -507,7 +507,7 @@ QString LogsDialog::formatTimeDelta(double timeDelta) return QString("%1 s").arg(timeDelta, 1, 'f', 1); } - int seconds = (int)round(abs(timeDelta)); + int seconds = (int)round(fabs(timeDelta)); int hours = seconds / 3600; seconds %= 3600; int minutes = seconds / 60; diff --git a/companion/src/simulation/telemetrysimu.h b/companion/src/simulation/telemetrysimu.h index cb3b67a5c..f6483ab0f 100644 --- a/companion/src/simulation/telemetrysimu.h +++ b/companion/src/simulation/telemetrysimu.h @@ -121,7 +121,6 @@ class TelemetrySimulator : public QDialog bool stepping; QDateTime parseTransmittterTimestamp(QString row); void calcLogFrequency(); - int32_t replayRate; }; private: @@ -162,8 +161,6 @@ private: uint32_t cellData1; uint32_t cellData2; uint32_t cellData3; - uint32_t cellDataTime; - double cell[MAXCELLS]; }; class GPSEmulator @@ -185,7 +182,6 @@ private: double course; double speedKNTS; double altitude; // in meters - uint32_t nextDataIndex; uint32_t encodeLatLon(double latLon, bool isLat); uint32_t encodeDateTime(uint8_t yearOrHour, uint8_t monthOrMinute, uint8_t dayOrSecond, bool isDate); }; diff --git a/companion/src/storage/mountlist.cpp b/companion/src/storage/mountlist.cpp index 2c4ced993..a17dfb261 100644 --- a/companion/src/storage/mountlist.cpp +++ b/companion/src/storage/mountlist.cpp @@ -227,7 +227,7 @@ #ifdef MOUNTED_GETMNTINFO -# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME +# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME && !defined(__clang__) static const char * fstype_to_string (short int t) { @@ -323,6 +323,7 @@ fstype_to_string (short int t) } # endif +#if !defined(__clang__) static const char * fsp_to_string (const struct statfs *fsp) { @@ -332,6 +333,7 @@ fsp_to_string (const struct statfs *fsp) return fstype_to_string (fsp->f_type); # endif } +#endif #endif /* MOUNTED_GETMNTINFO */ @@ -918,7 +920,7 @@ read_file_system_list (bool need_fs_type) *mtail = NULL; return mount_list; - +#if !defined(__clang__) free_then_fail: { int saved_errno = errno; @@ -938,6 +940,7 @@ read_file_system_list (bool need_fs_type) errno = saved_errno; return NULL; } +#endif } void free_file_system_list(struct mount_entry * mount_list) diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 0b7e53351..a65b7d2f7 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -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 " -o ") set(CMAKE_CXX_LINK_EXECUTABLE " -o ") diff --git a/radio/src/functions.cpp b/radio/src/functions.cpp index adb8134d4..40b52d880 100644 --- a/radio/src/functions.cpp +++ b/radio/src/functions.cpp @@ -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: diff --git a/radio/src/gui/128x64/model_outputs.cpp b/radio/src/gui/128x64/model_outputs.cpp index c983f0a90..ecfc3370f 100644 --- a/radio/src/gui/128x64/model_outputs.cpp +++ b/radio/src/gui/128x64/model_outputs.cpp @@ -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); diff --git a/radio/src/gui/212x64/view_main.cpp b/radio/src/gui/212x64/view_main.cpp index 8895d615c..896cbec70 100644 --- a/radio/src/gui/212x64/view_main.cpp +++ b/radio/src/gui/212x64/view_main.cpp @@ -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) { diff --git a/radio/src/gui/common/navigation.cpp b/radio/src/gui/common/navigation.cpp index 72aa2e1aa..1ed99264f 100644 --- a/radio/src/gui/common/navigation.cpp +++ b/radio/src/gui/common/navigation.cpp @@ -48,4 +48,4 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val) } return val; } -#endif \ No newline at end of file +#endif diff --git a/radio/src/gui/gui_common_arm.cpp b/radio/src/gui/gui_common_arm.cpp index 1e4f5654d..b7894f6ba 100644 --- a/radio/src/gui/gui_common_arm.cpp +++ b/radio/src/gui/gui_common_arm.cpp @@ -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 diff --git a/radio/src/rtc.cpp b/radio/src/rtc.cpp index 2b8fdddac..0b9e73b7e 100644 --- a/radio/src/rtc.cpp +++ b/radio/src/rtc.cpp @@ -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. */ diff --git a/radio/src/rtc.h b/radio/src/rtc.h index 01464cb86..5ddc31186 100644 --- a/radio/src/rtc.h +++ b/radio/src/rtc.h @@ -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 diff --git a/radio/src/storage/eeprom_rlc.h b/radio/src/storage/eeprom_rlc.h index 7236a76c4..39b6e0bde 100644 --- a/radio/src/storage/eeprom_rlc.h +++ b/radio/src/storage/eeprom_rlc.h @@ -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 diff --git a/radio/src/targets/horus/adc_driver.cpp b/radio/src/targets/horus/adc_driver.cpp index 98465e477..3a20f496c 100644 --- a/radio/src/targets/horus/adc_driver.cpp +++ b/radio/src/targets/horus/adc_driver.cpp @@ -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) diff --git a/radio/src/targets/sky9x/audio_driver.cpp b/radio/src/targets/sky9x/audio_driver.cpp index 9b81f1974..ace46b80e 100644 --- a/radio/src/targets/sky9x/audio_driver.cpp +++ b/radio/src/targets/sky9x/audio_driver.cpp @@ -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) { diff --git a/radio/src/targets/taranis/adc_driver.cpp b/radio/src/targets/taranis/adc_driver.cpp index 1297b761e..4405410ef 100644 --- a/radio/src/targets/taranis/adc_driver.cpp +++ b/radio/src/targets/taranis/adc_driver.cpp @@ -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 diff --git a/radio/src/targets/taranis/board.cpp b/radio/src/targets/taranis/board.cpp index c4aa418b3..d9a5c7c46 100644 --- a/radio/src/targets/taranis/board.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -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() { diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index de8409a29..eef590e98 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -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; diff --git a/radio/src/translations.h b/radio/src/translations.h index c35cef357..56b385506 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -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[];