|
API Documentation v0.0.1
|
Common class to control stepper-run gauges in OpenHornet. More...
#include <Hornet_Stepper.h>
Public Member Functions | |
| HornetStepper (int coil1, int coil2, int coil3, int coil4, int zeroPos, int maxPos, int dirForward, unsigned int capValue=65535, int normalSpeed=300, int normalAccel=600, MapPoint *mapPoints=nullptr, uint8_t numMapPoints=0) | |
| Constructor for HornetStepper. | |
| ~HornetStepper () | |
| Destructor to clean up allocated arrays. | |
| void | findZero () |
| findZero() is a function to zero the gauge | |
| void | testFullRange (int testSpeed=20, int testAccel=10) |
| testFullRange() is a function to test the range of the gauge | |
| void | setTarget (unsigned int targetVal) |
| setTarget() is a function to set the target position of the gauge | |
| void | run () |
| run() is a function to run the stepper motor (non-blocking) | |
Static Public Attributes | |
| static bool | ufcEntPressed = false |
| static bool | ufcClrPressed = false |
Common class to control stepper-run gauges in OpenHornet.
Uses the AccelStepper library to control the stepper motor.
Definition at line 100 of file Hornet_Stepper.h.
|
inline |
Constructor for HornetStepper.
| coil1 | Pin for coil 1 |
| coil2 | Pin for coil 2 |
| coil3 | Pin for coil 3 |
| coil4 | Pin for coil 4 |
| zeroPos | Position of the zero on the dial, in steps from low mechanical stop (absolute position, e.g., 20) |
| maxPos | Maximum number of steps from low mech stop to high mech stop |
| dirForward | Direction for forward movement (1 or -1) |
| capValue | DCS-BIOS value to cap at (default 65535). This is needed if mech stop is lower than game maximum. Values above this will be auto-capped, preventing the needle from exceeding maxPos position. |
| normalSpeed | Normal operating speed |
| normalAccel | Normal operating acceleration |
| mapPoints | Optional array of MapPoint structs for non-linear mapping (nullptr for linear mapping) |
| numMapPoints | Number of mapping points (required if mapPoints is provided) |
Definition at line 144 of file Hornet_Stepper.h.
|
inline |
Destructor to clean up allocated arrays.
Definition at line 196 of file Hornet_Stepper.h.
|
inline |
findZero() is a function to zero the gauge
Coordinate system:
Definition at line 212 of file Hornet_Stepper.h.
Referenced by run().
|
inline |
testFullRange() is a function to test the range of the gauge
Definition at line 233 of file Hornet_Stepper.h.
Referenced by run().
|
inline |
setTarget() is a function to set the target position of the gauge
| targetVal | The target value as pure DCS BIOS value (value range: 0-65535) |
Maps DCS BIOS value to stepper position: 1) cap targetVal at capValue as needed 2) map capped value to stepper position, using multiMapBS if useMultiMap is true, otherwise use standard linear mapping 3) call the moveTo() function of AccelStepper to pass the new target position.
Definition at line 257 of file Hornet_Stepper.h.
|
inline |
run() is a function to run the stepper motor (non-blocking)
Definition at line 280 of file Hornet_Stepper.h.
References findZero(), and testFullRange().
|
static |
Definition at line 123 of file Hornet_Stepper.h.
|
static |
Definition at line 124 of file Hornet_Stepper.h.