-
Notifications
You must be signed in to change notification settings - Fork 23
ToggleButton
ToggleButtonT
A single button (often momentary) where the falling edge of the button will alternate between two different messages to DCS. This is a very flexible control that can be used creatively for more than just buttons. Note that no message/argument is sent on the rising edge so this should not be used if the DCS control needs to be released (Use Switch2Pos for that).
ToggleButton
ToggleButton(const char* msg, const char* argA, const char* argB, char pin)
- msg - The message to send to DCS when the button is activated.
- argA - The argument (aka value) to send to DCS on odd counts of falling edges.
- argB - The argument (aka value) to send to DCS on even counts of falling edges.
- pin - The pin the button is connected to.
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.
DcsBios::ToggleButton lampTestBtn("LAMP_TEST_BTN", "0", "1", 1); // Pin 1 will toggle the state of the lamp test button each time the control has a rising edge
DcsBios::ToggleButton tacanVol("TACAN_VOL", 1, "6553" "52428"); // Pin 1 will toggle the TACAN volume between a low (10%) and high (80%)
typedef DcsBios::ToggleButtonT<200> LowPriorityToggleButton; // A custom toggle button that will use less cpu on each loop
LowPriorityToggleButton("TACAN_XY", "0", "1", 1); // Toggle TACAN X/Y channel each time the button is pressed