So I am manually try to manage the tuning configuartaions and have setup a PERSISTENT variable that defines which tuning to use. This variable can be set by another processor and it is retained through power cycles. in main I look a the variable to see which tuning should be used and then call a function to change the parameters that are different.
void AdjustForTuning(uint8_t tuning_mode)
{
switch(tuning_mode)
{
default: // default = model = C; System tuning.
case C_PLASTICS:
SLD00_E00.ui8TouchThreshold = 5;
SLD00_E01.ui8TouchThreshold = 5;
SLD00_E02.ui8TouchThreshold = 5;
SLD00_E03.ui8TouchThreshold = 5;
SLD00_Params.SliderBeta = 200;
SLD00.ui16ConversionCount = 850;
SLD00.ui8FreqDiv = 4;
SLD00.ui16ProxThreshold = 50;
SLD00.ui16NegativeTouchThreshold = 100;
g_uiApp.ui16WakeOnProxModeScanPeriod = 100;
break;
case C_OPEN_AIR:
SLD00_E00.ui8TouchThreshold = 9;
SLD00_E01.ui8TouchThreshold = 10;
SLD00_E02.ui8TouchThreshold = 10;
SLD00_E03.ui8TouchThreshold = 10;
SLD00_Params.SliderBeta = 100;
SLD00.ui16ConversionCount = 650;
SLD00.ui8FreqDiv = 3;
SLD00.ui16ProxThreshold = 14;
SLD00.ui16NegativeTouchThreshold = 30;
g_uiApp.ui16WakeOnProxModeScanPeriod = 103;
break;
}
return;
}
Using the debugger I see the variables do change and stay at the values requested, but the tuning always seem to use the values that were generated in "CAPT_UserConfig.c"
How do I get capTIvate to use the changed parameters? I assume the parameters are being copied into some library function before I actually call my function to change them.
Jon