2021-01-13 17:56:47 +08:00
|
|
|
#ifndef REMOTECONTROL_H
|
|
|
|
|
#define REMOTECONTROL_H
|
|
|
|
|
|
|
|
|
|
#include <QFrame>
|
|
|
|
|
#include "joystick.h"
|
|
|
|
|
#include "switch.h"
|
|
|
|
|
#include "QLabel"
|
|
|
|
|
#include "ToolsUI/ToolsWidget.h"
|
|
|
|
|
|
2021-04-29 09:54:21 +08:00
|
|
|
#include "QTimer"
|
|
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
class RemoteControl : public ToolsWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
RightHand = 0x00,
|
|
|
|
|
LeftHand = 0x01,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
REVERSE = -1,
|
|
|
|
|
NORMAL = 1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
explicit RemoteControl(QWidget *parent = 0);
|
|
|
|
|
~RemoteControl();
|
|
|
|
|
|
|
|
|
|
//void setDirection(uint16_t Channel,uint16_t Value);
|
|
|
|
|
void setFixed(bool value);
|
|
|
|
|
void setMode(uint8_t value);
|
2021-01-13 21:51:51 +08:00
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
|
|
|
|
|
signals:
|
2021-04-29 09:54:21 +08:00
|
|
|
void RemoteActive(uint32_t);
|
|
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
void RemoteControlUpdate(QList<uint16_t>);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
2021-01-13 21:51:51 +08:00
|
|
|
void setChannelOveride(QList<uint16_t> rc);
|
|
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
void Left_stickUpdate(uint16_t channel0, uint16_t channel1);
|
|
|
|
|
void Right_stickUpdate(uint16_t channel0, uint16_t channel1);
|
|
|
|
|
|
|
|
|
|
void AUX5SwitchUpdate(uint16_t value);
|
|
|
|
|
void AUX6SwitchUpdate(uint16_t value);
|
|
|
|
|
void AUX7SwitchUpdate(uint16_t value);
|
|
|
|
|
void AUX8SwitchUpdate(uint16_t value);
|
|
|
|
|
|
|
|
|
|
void PowerSwitchUpdate(uint16_t value);
|
|
|
|
|
//void stickCalibration();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void stateChanged(void);
|
|
|
|
|
|
|
|
|
|
|
2021-04-29 09:54:21 +08:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
void timerout(void);
|
|
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
private:
|
|
|
|
|
QLabel *remotelabel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JoyStick *joystick_left = nullptr;
|
|
|
|
|
JoyStick *joystick_right = nullptr;
|
|
|
|
|
|
|
|
|
|
Switch *PowerSwitch = nullptr;
|
|
|
|
|
|
|
|
|
|
Switch *TrimSwitch_left0 = nullptr;
|
|
|
|
|
Switch *TrimSwitch_left1 = nullptr;
|
|
|
|
|
Switch *TrimSwitch_right0 = nullptr;
|
|
|
|
|
Switch *TrimSwitch_right1 = nullptr;
|
|
|
|
|
|
|
|
|
|
Switch *AUX5Switch = nullptr;
|
|
|
|
|
Switch *AUX6Switch = nullptr;
|
|
|
|
|
Switch *AUX7Switch = nullptr;
|
|
|
|
|
Switch *AUX8Switch = nullptr;
|
|
|
|
|
|
|
|
|
|
//遥控输出
|
|
|
|
|
bool isFixed = 0;
|
|
|
|
|
uint8_t RSSI = 0;
|
|
|
|
|
uint16_t channel[20] = {0,
|
|
|
|
|
1500,1500,1100,1500,1100,1100,1100,1100,
|
|
|
|
|
1100,1100,1100,1100,1100,1100,1100,1100,1100,1100,1100};
|
|
|
|
|
|
|
|
|
|
//遥控配置
|
2021-01-16 13:21:39 +08:00
|
|
|
uint8_t mode = 0;//右手0 左手1
|
2021-01-13 17:56:47 +08:00
|
|
|
|
|
|
|
|
//开关
|
2021-01-13 21:51:51 +08:00
|
|
|
uint32_t isActive= 0;
|
2021-01-13 17:56:47 +08:00
|
|
|
|
2021-04-29 09:54:21 +08:00
|
|
|
|
|
|
|
|
QTimer *timer = nullptr;
|
|
|
|
|
|
2021-01-13 17:56:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // REMOTECONTROL_H
|