API Documentation v0.0.1
Loading...
Searching...
No Matches
SwitchRadar Class Reference

Specialized class for radar switches with pull-to-unlock functionality. More...

#include <5A7A1-SNSR_PANEL.h>

Public Member Functions

 SwitchRadar (const char *msg, const char *pullMsg, char pullPositionNumber, const byte *pins, char numberOfPins, bool reverse=false, unsigned long debounceDelay=50)
 
void SetControl (const char *msg, const char *pullMsg)
 
void resetThisState ()
 
void pollThisInput ()
 

Detailed Description

Specialized class for radar switches with pull-to-unlock functionality.

Extends the debounce logic by implementing additional "pull" logic for radar switches that have a lock or emergency position that requires a pull action before rotating.

Definition at line 164 of file 5A7A1-SNSR_PANEL.h.

Constructor & Destructor Documentation

◆ SwitchRadar()

SwitchRadar::SwitchRadar ( const char * msg,
const char * pullMsg,
char pullPositionNumber,
const byte * pins,
char numberOfPins,
bool reverse = false,
unsigned long debounceDelay = 50 )
inline

Constructor for initializing a radar switch with debounce and pull-to-unlock logic.

Parameters
msgDCS BIOS message for the switch state.
pullMsgDCS BIOS message for the pull action.
pullPositionNumberSwitch position number requiring a pull action.
pinsArray of physical pin numbers for switch positions.
numberOfPinsNumber of positions (pins) on the switch.
reverseSet to true to reverse the reading logic (for normally high switches).
debounceDelayDebounce time in milliseconds.

Definition at line 286 of file 5A7A1-SNSR_PANEL.h.

286 {
287 msg_ = msg;
288 pullMsg_ = pullMsg;
289 pins_ = pins;
290 pullPositionNumber_ = pullPositionNumber;
291 reverse_ = reverse;
292 numberOfPins_ = numberOfPins;
293 unsigned char i;
294 for (i = 0; i < numberOfPins; i++) {
295 if (pins[i] != DcsBios::PIN_NC)
296 pinMode(pins[i], INPUT_PULLUP);
297 }
298 lastState_ = readState();
299 debounceSteadyState_ = lastState_;
300 debounceDelay_ = debounceDelay;
301 }
unsigned long debounceDelay
The debounce delay duration in ms, increase if the output flickers.
const int * pins[15]
Array of pins to simplify the code working with the switches as joystick buttons.

References debounceDelay, and pins.

Member Function Documentation

◆ SetControl()

void SwitchRadar::SetControl ( const char * msg,
const char * pullMsg )
inline

Sets or changes the DCS BIOS messages for the switch and pull actions.

Parameters
msgNew DCS BIOS message for the switch state.
pullMsgNew DCS BIOS message for the pull action.

Definition at line 308 of file 5A7A1-SNSR_PANEL.h.

308 {
309 msg_ = msg;
310 pullMsg_ = pullMsg;
311 }

◆ resetThisState()

void SwitchRadar::resetThisState ( )
inline

Public interface to reset the state of the switch.

Definition at line 316 of file 5A7A1-SNSR_PANEL.h.

316 {
317 this->resetState();
318 }

◆ pollThisInput()

void SwitchRadar::pollThisInput ( )
inline

Public interface to check the input state of the switch and apply debounce and pull logic.

Definition at line 323 of file 5A7A1-SNSR_PANEL.h.

323 {
324 this->pollInput();
325 }

Referenced by loop().


The documentation for this class was generated from the following file: