Skip to content

Switch3Pos

Talbot edited this page Nov 18, 2021 · 1 revision

Class Name

Switch3PosT

Description

Common 3 position (ON-OFF-ON) switch.

Standard Template Name

Switch3Pos

Constructor

Switch3PosT(const char* msg, char pinA, char pinB, unsigned long debounceDelay = 50)

  • msg - The message to send to DCS when the switch is activated or deactivated.
  • pinA - The pin that the normally "UP/RIGHT" side of the switch is connected to.
  • pinB - The pin that the normally "DOWN/LEFT" side of the switch is connected to.
  • 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::Switch3Pos lasteApMode("LASTE_AP_MODE", 1, 2); // A standard 3 position on/off switch connected to pins 1 and 2

Example 2

typedef DcsBios::Switch3PosT<200> LowPrioritySwitch3Pos; // A custom switch that will use less cpu on each loop

LowPrioritySwitch3Pos("CDU_DATA", 1, 2);