Really TARGET programming is weird! Be aware of things like this:
float donothing = 0;
int
SuperchargerControl (int ActualButton)
{
donothing = 0;
do
{
donothing = donothing + 1;
}
while (donothing < 16000000);
if (Throttle[APALT])
printf("APALT ");
donothing = 0;
do
{
donothing = donothing + 1;
}
while (donothing < 16000000);
if (Throttle[APPAT])
printf("APPAT ");
donothing = 0;
do
{
donothing = donothing + 1;
}
while (donothing < 16000000);
if (Throttle[APAH])
printf("APAH ");
}
int
main ()
{
if (Init(&EventHandle)) // declare the event handler, return on error
return 1;
//AP------------------------------------------------------------------------------------------------------------
// APPAT
MapKeyIO
(
&Throttle,
APPAT,
0,
EXEC("SuperchargerControl(APPAT);")
);
// APAH
MapKeyIO
(
&Throttle,
APAH,
0,
EXEC("SuperchargerControl(APAH);")
);
// APALT
MapKeyIO
(
&Throttle,
APALT,
0,
EXEC("SuperchargerControl(APALT);")
);
}
Using the switch you must get
APALT
APAH
APPAT
APAH
APALT
Instead you get
APALT
APAH
APPAT APAH
APAH
APALT APAH
So Throttle[] have two different values at once. I suspect the problem lies that the APAH position is not a true button.