Skip to content

ActionButton

Talbot edited this page Nov 30, 2021 · 2 revisions

Class Name

ActionButtonT

Description

A single button (often momentary) where the falling edge of the button will send a specific message to DCS. This is a very flexible control that can be used creatively for more than just buttons. On the falling edge of an pin, any message with any value can be sent. 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).

Standard Template Name

ActionButton

Constructor

ActionButton(const char* msg, const char* arg, char pin)

  • msg - The message to send to DCS when the button is activated.
  • arg - The argument (aka value) to send to DCS
  • pin - The pin the button is connected to.

Template

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.

Example 1

DcsBios::ActionButton canopyDisengageToggle("CANOPY_DISENGAGE", "TOGGLE", 1); // Pin 1 will toggle the state of the canopy actuator disengage lever each time the control has a rising edge

Example 2

DcsBios::ActionButton iffDec("IFF_CODE", "INC", 1); DcsBios::ActionButton iffInc("IFF_CODE", "DEC", 27); // Hack 2 pins in a rotary control to increment/decrement IFF_CODE to work around a DCS bug.

Example 3

typedef DcsBios::ActionButtonT<200> LowPriorityActionButton; // A custom switch that will use less cpu on each loop ActionButton("AHCP_CICU", "1", 1); // Force CICU ON every time the button is activated