Files
edgetx-gx12/radio/src/datastructs.h
T
bf931a5097 feat: Add facilty for custom throttle warning position (#1395)
* replace magic number for throttle idle with correct define

* settings for custom throttle warning position

* settings fixed not to break byte-aligment of bit-fields

* evaluate custom throttle warning position

* add requested throttle value to warning text

* comment about field alignment in ModelData struct

* Menu for editing custom throttle warning for 128x64 radios
Tested on RM TX12

* Improoved menu display

* move displayed strings to translation

* translation template added for each language

* support for 212x64 B&W radios

* menu for colorlcd
not tested

* corrected translation entry for TW

* corrected handling of padding bits in ModelData structure

* Companion support for custom throttle warning position

* Rebase catchup

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
2022-01-30 15:04:40 +10:00

149 lines
3.9 KiB
C

/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include "datastructs_private.h"
#if !defined(BACKUP)
/* Compile time check to test structure size has not changed *
Changing the size of one of the eeprom structs may cause wrong data to
be loaded. Error out if the struct size changes.
This function tries not avoid checking or using the defines
other than the CPU arch and board type so changes in other
defines also trigger the struct size changes */
#include "chksize.h"
#define CHKSIZE(x, y) check_size<struct x, y>()
#define CHKTYPE(x, y) check_size<x, y>()
static inline void check_struct()
{
CHKSIZE(CurveRef, 2);
/* Difference between Taranis/Horus is LEN_EXPOMIX_NAME */
/* LEN_xFUNCTION_NAME is the difference in CustomFunctionData */
CHKSIZE(VarioData, 5);
#if defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE)
CHKSIZE(MixData, 20);
CHKSIZE(ExpoData, 17);
CHKSIZE(LimitData, 11);
CHKSIZE(LogicalSwitchData, 9);
CHKSIZE(CustomFunctionData, 11);
CHKSIZE(FlightModeData, 28 + 2*NUM_TRIMS);
CHKSIZE(TimerData, 11);
CHKSIZE(SwashRingData, 8);
CHKSIZE(FrSkyBarData, 6);
CHKSIZE(FrSkyLineData, 4);
CHKTYPE(TelemetryScreenData, 24);
CHKSIZE(ModelHeader, 12);
CHKSIZE(CurveHeader, 4);
#elif defined(PCBTARANIS)
CHKSIZE(MixData, 20);
CHKSIZE(ExpoData, 17);
CHKSIZE(LimitData, 13);
CHKSIZE(LogicalSwitchData, 9);
CHKSIZE(CustomFunctionData, 11);
CHKSIZE(FlightModeData, 40);
CHKSIZE(TimerData, 16);
CHKSIZE(SwashRingData, 8);
CHKSIZE(FrSkyBarData, 6);
CHKSIZE(FrSkyLineData, 6);
CHKTYPE(TelemetryScreenData, 24);
CHKSIZE(ModelHeader, 24);
CHKSIZE(CurveHeader, 4);
#elif defined(PCBHORUS)
CHKSIZE(MixData, 20);
CHKSIZE(ExpoData, 17);
CHKSIZE(LimitData, 13);
CHKSIZE(CustomFunctionData, 9);
CHKSIZE(FlightModeData, 44);
CHKSIZE(TimerData, 16);
CHKSIZE(SwashRingData, 8);
CHKSIZE(ModelHeader, 31);
CHKSIZE(CurveHeader, 4);
CHKSIZE(CustomScreenData, 850);
CHKTYPE(TopBarPersistentData, 300);
#elif defined(PCBNV14)
// TODO
#else
// Common for all variants
CHKSIZE(LimitData, 5);
CHKSIZE(SwashRingData, 3);
CHKSIZE(FrSkyBarData, 3);
CHKSIZE(FrSkyLineData, 2);
CHKSIZE(ModelHeader, 11);
CHKTYPE(CurveHeader, 1);
CHKSIZE(MixData, 9);
CHKSIZE(ExpoData, 4);
CHKSIZE(CustomFunctionData, 3);
CHKSIZE(TimerData, 3);
CHKSIZE(FlightModeData, 30);
CHKSIZE(RadioData, 85);
#endif /* board specific ifdefs*/
CHKSIZE(LogicalSwitchData, 9);
CHKSIZE(TelemetrySensor, 14);
CHKSIZE(ModuleData, 29);
CHKSIZE(GVarData, 7);
CHKSIZE(RssiAlarmData, 2);
CHKSIZE(TrainerData, 16);
#if defined(PCBXLITES)
CHKSIZE(RadioData, 860);
CHKSIZE(ModelData, 6162);
#elif defined(PCBXLITE)
CHKSIZE(RadioData, 858);
CHKSIZE(ModelData, 6162);
#elif defined(RADIO_TPRO)
CHKSIZE(RadioData, 841);
CHKSIZE(ModelData, 6187);
#elif defined(PCBX7)
CHKSIZE(RadioData, 864);
CHKSIZE(ModelData, 6162);
#elif defined(PCBX9E)
CHKSIZE(RadioData, 954);
CHKSIZE(ModelData, 6614);
#elif defined(PCBX9D) || defined(PCBX9DP)
CHKSIZE(RadioData, 896);
CHKSIZE(ModelData, 6606);
#elif defined(PCBHORUS)
#if defined(PCBX10)
CHKSIZE(RadioData, 921);
CHKSIZE(ModelData, 11026);
#else
CHKSIZE(RadioData, 903);
CHKSIZE(ModelData, 11024);
#endif
#endif
#undef CHKSIZE
}
#endif /* BACKUP */