feat(h7): increase GVAR limit to 15 (#6597)

Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
3djc
2025-10-01 19:07:08 +10:00
committed by GitHub
co-authored by elecpower
parent 4de56d8096
commit 0da292001d
16 changed files with 100 additions and 43 deletions
+5 -5
View File
@@ -51,7 +51,7 @@ static inline void check_struct()
CHKSIZE(GVarData, 7);
CHKSIZE(RFAlarmData, 2);
CHKSIZE(TrainerData, 16);
CHKSIZE(FlightModeData, 22 + 2 * MAX_TRIMS + LEN_FLIGHT_MODE_NAME);
CHKSIZE(FlightModeData, 4 + 2 * MAX_GVARS + 2 * MAX_TRIMS + LEN_FLIGHT_MODE_NAME);
CHKSIZE(CustomFunctionData, 11);
#if defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE)
@@ -119,15 +119,15 @@ static inline void check_struct()
CHKSIZE(ModelData, 27693);
#endif
#elif defined(PCBST16)
CHKSIZE(ModelData, 27761);
CHKSIZE(ModelData, 27911);
#elif defined(PCBPA01)
CHKSIZE(ModelData, 27522);
CHKSIZE(ModelData, 27672);
#elif defined(RADIO_T15)
CHKSIZE(ModelData, 27683);
#elif defined(RADIO_T15PRO)
CHKSIZE(ModelData, 27761);
CHKSIZE(ModelData, 27911);
#elif defined(RADIO_TX15)
CHKSIZE(ModelData, 27761);
CHKSIZE(ModelData, 27911);
#elif defined(RADIO_H7RS)
// CHKSIZE()
#elif defined(PCBHORUS)
+9 -1
View File
@@ -39,7 +39,7 @@ enum MenuModelFlightModeItems {
ITEM_MODEL_FLIGHT_MODE_TRIMS2,
ITEM_MODEL_FLIGHT_MODE_FADE_IN,
ITEM_MODEL_FLIGHT_MODE_FADE_OUT,
#if defined(GVARS)
#if MAX_GVARS > 0
ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL,
ITEM_MODEL_FLIGHT_MODE_GV1,
ITEM_MODEL_FLIGHT_MODE_GV2,
@@ -50,6 +50,14 @@ enum MenuModelFlightModeItems {
ITEM_MODEL_FLIGHT_MODE_GV7,
ITEM_MODEL_FLIGHT_MODE_GV8,
ITEM_MODEL_FLIGHT_MODE_GV9,
#if MAX_GVARS > 9
ITEM_MODEL_FLIGHT_MODE_GV10,
ITEM_MODEL_FLIGHT_MODE_GV11,
ITEM_MODEL_FLIGHT_MODE_GV12,
ITEM_MODEL_FLIGHT_MODE_GV13,
ITEM_MODEL_FLIGHT_MODE_GV14,
ITEM_MODEL_FLIGHT_MODE_GV15,
#endif
#endif
ITEM_MODEL_FLIGHT_MODE_MAX
};
+4
View File
@@ -25,7 +25,11 @@
#define GVAR_MAX 1024
#define GVAR_MIN -GVAR_MAX
#if defined(STM32H7) || defined(STM32H7RS) || defined(STM32H5)
#define MAX_GVARS 15
#else
#define MAX_GVARS 9
#endif
// GVars have one value per flight mode
#define GVAR_VALUE(gv, fm) g_model.flightModeData[fm].gvars[gv]
@@ -48,7 +48,11 @@ static inline void check_yaml_funcs()
{
static_assert(offsetof(ModuleData, ppm) == 4,"");
check_size<ModuleData, 29>();
#if defined(STM32H7) || defined(STM32H7RS) || defined(STM32H5)
static_assert(MAX_GVARS == 15,"");
#else
static_assert(MAX_GVARS == 9,"");
#endif
}
static bool w_semver(void* user, uint8_t* data, uint32_t bitoffs,
@@ -567,7 +567,7 @@ static const struct YamlNode struct_FlightModeData[] = {
YAML_PADDING( 6 ),
YAML_UNSIGNED( "fadeIn", 8 ),
YAML_UNSIGNED( "fadeOut", 8 ),
YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active),
YAML_ARRAY("gvars", 16, 15, struct_signed_16, gvar_is_active),
YAML_END
};
static const struct YamlNode struct_GVarData[] = {
@@ -902,11 +902,11 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL),
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
YAML_ARRAY("flightModeData", 448, 9, struct_FlightModeData, fmd_is_active),
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
YAML_ARRAY("gvars", 56, 15, struct_GVarData, NULL),
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
@@ -567,7 +567,7 @@ static const struct YamlNode struct_FlightModeData[] = {
YAML_PADDING( 6 ),
YAML_UNSIGNED( "fadeIn", 8 ),
YAML_UNSIGNED( "fadeOut", 8 ),
YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active),
YAML_ARRAY("gvars", 16, 15, struct_signed_16, gvar_is_active),
YAML_END
};
static const struct YamlNode struct_GVarData[] = {
@@ -902,11 +902,11 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL),
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
YAML_ARRAY("flightModeData", 480, 9, struct_FlightModeData, fmd_is_active),
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
YAML_ARRAY("gvars", 56, 15, struct_GVarData, NULL),
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
@@ -567,7 +567,7 @@ static const struct YamlNode struct_FlightModeData[] = {
YAML_PADDING( 6 ),
YAML_UNSIGNED( "fadeIn", 8 ),
YAML_UNSIGNED( "fadeOut", 8 ),
YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active),
YAML_ARRAY("gvars", 16, 15, struct_signed_16, gvar_is_active),
YAML_END
};
static const struct YamlNode struct_GVarData[] = {
@@ -902,11 +902,11 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL),
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
YAML_ARRAY("flightModeData", 480, 9, struct_FlightModeData, fmd_is_active),
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
YAML_ARRAY("gvars", 56, 15, struct_GVarData, NULL),
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
@@ -567,7 +567,7 @@ static const struct YamlNode struct_FlightModeData[] = {
YAML_PADDING( 6 ),
YAML_UNSIGNED( "fadeIn", 8 ),
YAML_UNSIGNED( "fadeOut", 8 ),
YAML_ARRAY("gvars", 16, 9, struct_signed_16, gvar_is_active),
YAML_ARRAY("gvars", 16, 15, struct_signed_16, gvar_is_active),
YAML_END
};
static const struct YamlNode struct_GVarData[] = {
@@ -902,11 +902,11 @@ static const struct YamlNode struct_ModelData[] = {
YAML_ARRAY("logicalSw", 72, 64, struct_LogicalSwitchData, NULL),
YAML_ARRAY("customFn", 88, 64, struct_CustomFunctionData, cfn_is_active),
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
YAML_ARRAY("flightModeData", 480, 9, struct_FlightModeData, fmd_is_active),
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
YAML_ARRAY("gvars", 56, 15, struct_GVarData, NULL),
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),