From 017006c243171c910a71ea9cb6e4c7463cfbfb2c Mon Sep 17 00:00:00 2001 From: philmoz Date: Mon, 16 Feb 2026 19:29:17 +1100 Subject: [PATCH] chore(cpn): remove magic numbers and align values with firmware (#7102) --- companion/src/constants.h | 6 ++++-- companion/src/firmwares/modeldata.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/companion/src/constants.h b/companion/src/constants.h index 5c0fe79d0..1ce4617ff 100644 --- a/companion/src/constants.h +++ b/companion/src/constants.h @@ -44,8 +44,10 @@ #define CPN_MAX_SWITCHES_STD 20 #define CPN_MAX_SWITCHES (CPN_MAX_SWITCHES_STD + CPN_MAX_SWITCHES_FLEX + CPN_MAX_SWITCHES_FUNCTION) #define CPN_MAX_SENSORS 99 -#define CPN_MAX_SCRIPTS 9 -#define CPN_MAX_SCRIPT_INPUTS 10 +#define CPN_MAX_SCRIPTS 9 // Max for Color LCD +#define CPN_LEN_SCRIPT_FILENAME 6 +#define CPN_LEN_SCRIPT_NAME 6 +#define CPN_MAX_SCRIPT_INPUTS 6 #define CPN_MAX_SCRIPT_OUTPUTS 6 #define CPN_MAX_SPACEMOUSE 6 #define CPN_MAX_INPUTS 32 // v2.10 replaces CPN_MAX_ANALOGS - the value is abitary as radio ADC refactor is still a WIP diff --git a/companion/src/firmwares/modeldata.h b/companion/src/firmwares/modeldata.h index 4dd91fe1b..753ecf779 100644 --- a/companion/src/firmwares/modeldata.h +++ b/companion/src/firmwares/modeldata.h @@ -67,8 +67,8 @@ class RSSIAlarmData { class ScriptData { public: ScriptData() { clear(); } - char filename[10+1]; - char name[10+1]; + char filename[CPN_LEN_SCRIPT_FILENAME+1]; + char name[CPN_LEN_SCRIPT_NAME+1]; int inputs[CPN_MAX_SCRIPT_INPUTS]; void clear() { memset(reinterpret_cast(this), 0, sizeof(ScriptData)); } };