feat(radio,cpn): Updates for new joystick system (#3400)

* Reduce RAM usage for advanced joystick system on radio:
- Don't allocate memory blocks unless joystick mode is being used.
Support multiple radio joystick configurations in Companion:
- Save configured joystick settings by joystick name in Companion settings.
- Save last joystick name used in each profile.
- Reload joystick settings by name when profile is changed.

* Only show configuration for used axes and buttons in Companion.
Send actual number of configured joystick buttons from radio in USB packet.

* Fix issue where USB joystick not recognised if no buttons configured.

* Fix compiler warnings.

* Remove debugging.

* Fix crash in Companion.

* Change channel 8 to type 'dial', workaround for Linux mapping issue.

---------

Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
This commit is contained in:
philmoz
2023-04-21 14:27:41 +10:00
committed by GitHub
co-authored by Phil Mitchell
parent 62a40f1c47
commit e1fe7fce89
10 changed files with 537 additions and 294 deletions
+5 -2
View File
@@ -46,7 +46,7 @@ class joystickDialog : public QDialog
Q_OBJECT
public:
explicit joystickDialog(QWidget *parent = 0, int stick=-1);
explicit joystickDialog(QWidget *parent = 0);
~joystickDialog();
Joystick *joystick;
@@ -58,12 +58,15 @@ class joystickDialog : public QDialog
QSlider * sliders[MAX_JS_AXES + MAX_JS_BUTTONS];
int step;
int numAxes;
int numButtons;
bool started;
void loadGrid();
private slots:
void populateSourceCombo(QComboBox * cb);
void populateButtonCombo(QComboBox * cb);
bool loadJoysticks(int stick = -1);
bool loadJoysticks();
void joystickOpen(int stick);
void joystickSetEnabled(bool enable);
void onjoystickAxisValueChanged(int axis, int value);