From aeb727bcbf59ae37f4793415d59f1de40e0067ec Mon Sep 17 00:00:00 2001 From: bsongis Date: Thu, 27 Dec 2012 19:24:41 +0000 Subject: [PATCH] [X9D] Problem when changing trackname parameter when > 4 chars --- src/model_menus.cpp | 4 ++-- src/myeeprom.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/model_menus.cpp b/src/model_menus.cpp index 96c012b72..94dd59f6f 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -2855,8 +2855,8 @@ void menuModelCustomFunctions(uint8_t event) } lcd_putsiAtt(5*FW-2, y, STR_VFSWFUNC, func_displayed, attr); if (active) { - CHECK_INCDEC_MODELVAR( event, sd->func, 0, FUNC_MAX-1); - if (checkIncDec_Ret) FSW_PARAM(sd) = 0; + CHECK_INCDEC_MODELVAR(event, sd->func, 0, FUNC_MAX-1); + if (checkIncDec_Ret) FSW_RESET_PARAM(sd); } } else if (attr) { diff --git a/src/myeeprom.h b/src/myeeprom.h index 05564e440..b0624d29e 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -357,7 +357,8 @@ PACK(typedef struct t_FuncSwData { // Function Switches data uint8_t active; uint8_t spare; }) FuncSwData; -#define FSW_PARAM(p) (*((uint32_t*)(p)->param)) +#define FSW_PARAM(p) (*((uint32_t*)(p)->param)) +#define FSW_RESET_PARAM(p) memset(p->param, 0, sizeof(p->param)) #else PACK(typedef struct t_FuncSwData { // Function Switches data int8_t swtch; //input @@ -365,7 +366,8 @@ PACK(typedef struct t_FuncSwData { // Function Switches data uint8_t active:1; uint8_t param; }) FuncSwData; -#define FSW_PARAM(p) ((p)->param) +#define FSW_PARAM(p) ((p)->param) +#define FSW_RESET_PARAM(p) FSW_PARAM(p) = 0 #endif enum TelemetryUnit {