-
Notifications
You must be signed in to change notification settings - Fork 23
SwitchMultiPos
SwitchMultiPosT
Common N position switch where only one position at at time can be active. Also usable for 4 and 5 way switches.
SwitchMultiPos
SwitchMultiPosT(const char* msg, const byte* pins, char numberOfPins, bool reverse = false)
- msg - The message to send to DCS when the switch position is changed.
- pins - An array of pin numbers representing the pin connected to each position in the DCS switch.
- reverse - Set to TRUE if the inactive positions are pulled down to ground and the active position is HIGH.
template <unsigned long pollIntervalMs = POLL_EVERY_TIME>
- pollIntervalMs - Time in milliseconds between times this control should be sampled. Increase for less time sensitive controls to lower the CPU load required for this control.
A single pin can be given the value DcsBios::PIN_NC
indicating that the pin is Not Connected. SwitchMultiPos has a special behaviour where a pin given this value is sent my default when no other pins are active. This has a special application for the A-10 emergency trim switch which requires a "center" position to return even after any of the directions are released.
// Center pos is not connected, so define PIN_NC so that it will return to center when no other pin is active
const byte efcpEmerTrimPins[5] = {DcsBios::PIN_NC, 2, 1, 3, 0};
DcsBios::SwitchMultiPos efcpEmerTrim("EFCP_EMER_TRIM", efcpEmerTrimPins, 5);
const byte tacanModePins[5] = {8, 9, 10, 11, 12};
`DcsBios::SwitchMultiPos tacanMode("TACAN_MODE", tacanModePins, 5);; // A 5 position rotary switch
typedef DcsBios::SwitchMultiPosT<200> LowPrioritySwitchMultiPos; // A custom switch that will use less cpu on each loop
const byte aapPagePins[4] = {1, 2, 3, 4};
LowPrioritySwitchMultiPos("AAP_PAGE", aapPagePins, 5);