Hi
I need help to make a LED flash as long as a function is enabled(WeaponEnable) and stop when the flashing when WeaponDisable gets in effect.
The function that allows me to have a kind of MasterArm for IL2.
The code enable certain weapon fuctionality for 3 min (180000) when the MasterArm key is pressed.
BTW I did not make the code
MapKey(&Throttle, CHF, EXEC("WeaponsEnable(); DeferCall(180000, &WeaponsDisable, enablecount);")); // on CHF, enable weapons, then defer WeaponsDisable call after 180000ms (180s)
int enablecount;
int WeaponsEnable()
{
enablecount = enablecount + 1;
MapKeyUMD(&HCougar, S4, DX4, DX3, USB[0x05]);
MapKey(&Throttle, CHB, DX7);
//MapKey(&Throttle, CHB, PULSE+L_SHIFT+USB[0x18]);
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1));
}
int WeaponsDisable(int p)
{
if(p != enablecount) return 0; // take in account only the latest WeaponsEnable press
MapKeyUMD(&HCougar, S4, USB[0x05], USB[0x05], USB[0x05]);
MapKey(&Throttle, CHB, 0);
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1));
}