Skip to content
Talbot edited this page Nov 30, 2021 · 3 revisions

Class Name

Switch2PosT

Description

Common 2 position (ON-OFF) switch.

Standard Template Name

Switch2Pos

Constructor

Switch2PosT(const char* msg, char pin, bool reverse = false, unsigned long debounceDelay = 50)

  • msg - The message to send to DCS when the switch is activated or deactivated.
  • reverse - Invert the polarity of the physical switch.
  • debounceDelay - Time in milliseconds that the switch is allowed to stop bouncing before being sent. Shorter = more responsive, longer = more bounce tolerance.

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::Switch2Pos switch2PosExample("AHCP_JTRS", 1); // A standard 2 position on/off switch

Example 2

DcsBios::Switch2Pos switch2PosExample("AHCP_TGP", 1, TRUE); // Inverted standard switch

Example 3

typedef DcsBios::Switch2PosT<200> LowPrioritySwitch2Pos; // A custom switch that will use less cpu on each loop LowPrioritySwitch2Pos("AHCP_CICU", 1);