[BRANCH] Created possibility to increase GVARS number; is set to 9

Warning!!!
==========
Be aware this version is in branch and is not supported currently by Companion9x. Whatever you configure will be lost in final version!

Because EEPROM interpretation changes anyway because of higher offset and weight values possible in this branch, I tried to align the bits a little bit different to allow a higher number of GVARS. The code change is nearly flash neutral. It costs only 18 bytes flash, but would us allow to either increase range for weight and offset further, or allow more GVARS.
I set it to 9 for this branch now. Please try and report.
It's very easy now to adjust the GVARS number by changing the constant in myeeprom.h. Just change the MAX_GVARS constant for your build in myeeprom.h in the beginning of the file.
The lower MAX_GVARS the higher is the possible number for weight and offset and vice versa.
That is quite likely too complicated for conversion so we need to agree maximum for GVARS.
Not sure in the moment, but this is a branch only and is just to play with it.
Not sure how Bertrand would like this anyway, so may be removed at all.
This commit is contained in:
open.20.fsguruh@xoxy.net
2013-03-03 13:57:30 +00:00
parent 214bc9c4d4
commit 9f2b486152
5 changed files with 106 additions and 61 deletions
+30 -28
View File
@@ -65,6 +65,34 @@
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
#endif
typedef int16_t gvar_t;
#if !defined(CPUM64)
typedef char gvar_name_t[6];
#define GVAR_MAX 1024
#endif
#if defined(CPUM64) && defined(GVARS)
#define MAX_GVARS 9
#define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS];
#define PHASE_GVARS_DATA
#define GVAR_VALUE(x, p) g_model.gvars[x]
#elif defined(CPUM64)
#define MAX_GVARS 0
#define MODEL_GVARS_DATA
#define PHASE_GVARS_DATA
#elif defined(GVARS)
#define MAX_GVARS 9
#define MODEL_GVARS_DATA gvar_name_t gvarsNames[MAX_GVARS];
#define PHASE_GVARS_DATA gvar_t gvars[MAX_GVARS]
#define GVAR_VALUE(x, p) g_model.phaseData[p].gvars[x]
#else
#define MAX_GVARS 0
#define MODEL_GVARS_DATA gvar_name_t gvarsNames[5];
#define PHASE_GVARS_DATA gvar_t gvars[5]
#endif
PACK(typedef struct t_TrainerMix {
uint8_t srcChn:6; // 0-7 = ch1-8
uint8_t mode:2; // off,add-mode,subst-mode
@@ -427,7 +455,8 @@ enum Functions {
#endif
#if defined(GVARS)
FUNC_ADJUST_GV1,
FUNC_ADJUST_GV5 = FUNC_ADJUST_GV1 + 4,
// FUNC_ADJUST_GV5 = FUNC_ADJUST_GV1 + 4,
FUNC_ADJUST_GVLAST = (FUNC_ADJUST_GV1 + (MAX_GVARS-1)),
#endif
#if defined(DEBUG)
FUNC_TEST, // should remain the last before MAX as not added in companion9x
@@ -693,33 +722,6 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data
#define TRIM_ARRAY int16_t trim[4]
#endif
typedef int16_t gvar_t;
#if !defined(CPUM64)
typedef char gvar_name_t[6];
#define GVAR_MAX 1024
#endif
#if defined(CPUM64) && defined(GVARS)
#define MAX_GVARS 5
#define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS];
#define PHASE_GVARS_DATA
#define GVAR_VALUE(x, p) g_model.gvars[x]
#elif defined(CPUM64)
#define MAX_GVARS 0
#define MODEL_GVARS_DATA
#define PHASE_GVARS_DATA
#elif defined(GVARS)
#define MAX_GVARS 5
#define MODEL_GVARS_DATA gvar_name_t gvarsNames[MAX_GVARS];
#define PHASE_GVARS_DATA gvar_t gvars[MAX_GVARS]
#define GVAR_VALUE(x, p) g_model.phaseData[p].gvars[x]
#else
#define MAX_GVARS 0
#define MODEL_GVARS_DATA gvar_name_t gvarsNames[5];
#define PHASE_GVARS_DATA gvar_t gvars[5]
#endif
PACK(typedef struct t_PhaseData {
TRIM_ARRAY;
int8_t swtch; // swtch of phase[0] is not used