160 return remote.leftHorizontal / 660.0;
165 return remote.leftVertical / 660.0;
170 return remote.rightHorizontal / 660.0;
175 return remote.rightVertical / 660.0;
180 return remote.leftSwitch;
185 return remote.rightSwitch;
189 BufferedSerial receiver;
192 static const int REMOTE_BUF_LEN = 18;
193 static const int REMOTE_READ_TIMEOUT = 6;
194 static const int REMOTE_DISCONNECT_TIMEOUT = 200;
195 static const int REMOTE_INT_PRI = 12;
196 static constexpr float STICK_MAX_VALUE = 660.0f;
201 uint32_t updateCounter = 0;
202 int16_t rightHorizontal = 0;
203 int16_t rightVertical = 0;
204 int16_t leftHorizontal = 0;
205 int16_t leftVertical = 0;
222 static void switchToState(RemoteInfo *remote);
224 bool badData(
const uint8_t rxBuffer[], RemoteInfo *remote);
227 bool connected =
false;
230 uint8_t rxBuffer[REMOTE_BUF_LEN]{0};
233 uint32_t lastRead = 0;
236 uint8_t currentBufferIndex = 0;
242 void clearRxBuffer();
Definition DJIRemote.h:21
float rightX() const
Definition DJIRemote.h:168
Channel
Definition DJIRemote.h:29
void printAxisData() const
Definition DJIRemote.cpp:109
int16_t getWheel() const
Definition DJIRemote.cpp:136
int16_t getMouseZ() const
Definition DJIRemote.cpp:128
void initialize()
Definition DJIRemote.cpp:16
__attribute__((unused)) bool isConnected() const
long badDataChainNumber
Definition DJIRemote.h:154
Remote::SwitchState rightSwitch() const
Definition DJIRemote.h:183
int16_t getMouseX() const
Definition DJIRemote.cpp:124
bool getMouseL() const
Definition DJIRemote.cpp:130
int16_t getChannelInt(Channel ch) const
Definition DJIRemote.cpp:77
SwitchState getSwitch(Switch sw) const
Definition DJIRemote.cpp:97
long goodDataChainNumber
Definition DJIRemote.h:155
bool keyPressed(Key key) const
Definition DJIRemote.cpp:134
void dumpInfo() const
Definition DJIRemote.cpp:113
float rightY() const
Definition DJIRemote.h:173
void read()
Definition DJIRemote.cpp:19
uint32_t getUpdateCounter() const
Definition DJIRemote.cpp:274
int16_t getMouseY() const
Definition DJIRemote.cpp:126
float getChannel(Channel ch) const
Definition DJIRemote.cpp:61
float leftY() const
Definition DJIRemote.h:163
bool unfiltered
Definition DJIRemote.h:156
Switch
Definition DJIRemote.h:40
Remote::SwitchState leftSwitch() const
Definition DJIRemote.h:178
float leftX() const
Definition DJIRemote.h:158
bool getMouseR() const
Definition DJIRemote.cpp:132
Key
Definition DJIRemote.h:60
SwitchState
Definition DJIRemote.h:49