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:
@@ -97,12 +97,13 @@ void AppPreferencesDialog::accept()
|
||||
if (ui->joystickChkB ->isChecked()) {
|
||||
g.jsSupport(ui->joystickChkB ->isChecked());
|
||||
// Don't overwrite selected joystick if not connected. Avoid surprising the user.
|
||||
if (ui->joystickCB->isEnabled())
|
||||
g.jsCtrl(ui->joystickCB ->currentIndex());
|
||||
if (ui->joystickCB->isEnabled()) {
|
||||
profile.jsName(ui->joystickCB->currentText());
|
||||
g.loadNamedJS();
|
||||
}
|
||||
}
|
||||
else {
|
||||
g.jsSupport(false);
|
||||
g.jsCtrl(0);
|
||||
}
|
||||
|
||||
// Updates tab
|
||||
@@ -287,7 +288,8 @@ void AppPreferencesDialog::initSettings()
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
ui->joystickCB->setCurrentIndex(g.jsCtrl());
|
||||
int stick = joystick->findCurrent(g.currentProfile().jsName());
|
||||
ui->joystickCB->setCurrentIndex(stick);
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
@@ -614,8 +616,9 @@ void AppPreferencesDialog::on_joystickChkB_clicked() {
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_joystickcalButton_clicked() {
|
||||
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
|
||||
jd->exec();
|
||||
g.currentProfile().jsName(ui->joystickCB->currentText());
|
||||
joystickDialog * jd = new joystickDialog(this);
|
||||
jd->exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user