Hello. NOOB here looking for project help. Sorry for the confusing topic title.
My project involves identical code loaded into two Mega2560's. The only difference between the two is that several dozen program constants are different between the two applications. All other code is exactly the same.
I have managed this now by duplicating all constants in the declarations and commenting out those that don't apply to application A or B, accordingly.
const int OSCoffsnip = 90; // used in both FOH and MONS
const int OSCmixsnip = 91; // used in both FOH and MONS
const int OSCfohsnip = 92;
const int OSCallsnip = 93;
//const int OSCoffsnip = 95; // used in both FOH and MONS
//const int OSCmixsnip = 96; // used in both FOH and MONS
//const int OSCfohsnip = 97;
//const int OSCallsnip = 98;
Is there an more elegant way to deal with this?
Thx in advance for any and all advice.
#define FIRST_SKETCH // comment this line out for 2nd sketch
.
.
.
#ifdef FIRST_SKETCH
const int OSCoffsnip = 90; // used in both FOH and MONS
const int OSCmixsnip = 91; // used in both FOH and MONS
const int OSCfohsnip = 92;
const int OSCallsnip = 93;
#else
const int OSCoffsnip = 95; // used in both FOH and MONS
const int OSCmixsnip = 96; // used in both FOH and MONS
const int OSCfohsnip = 97;
const int OSCallsnip = 98;```
#endif
Depending on what tools you use to compile the sketch, you could even dispense with the #define and include (or not) the definition of FIRST_SKETCH on the command line. So your source would be the same, and you'd chose which version to create by what parameters you included or omitted on the command line.
one still has compile/link the code and program the microcontroller with each change of parameters
usually not possible if the parameters are to be configured when installing equipment at a end-users site