1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 00:05:19 +03:00

Add settings framework

This commit is contained in:
Pawel Spychalski (DzikuVx) 2022-05-30 13:42:27 +02:00
parent e0ef5b0261
commit cf57493fdb
5 changed files with 763 additions and 705 deletions

View file

@ -43,6 +43,12 @@ helper.defaultsDialog = (function (data) {
privateScope.wizard(selectedDefaultPreset, wizardStep + 1);
};
privateScope.handleTabLoadReceiver = function ($content) {
console.log('ready to handle receiver');
},
privateScope.wizard = function (selectedDefaultPreset, wizardStep) {
const steps = selectedDefaultPreset.wizardPages;
@ -59,12 +65,10 @@ helper.defaultsDialog = (function (data) {
const $content = $container.find('.defaults-dialog__wizard');
$.get("./wizard/" + stepName + ".html", function (data) {
$content.html(data);
});
$(data).appendTo($content);
$.get("./wizard/buttons.html", function (data) {
$(data).appendTo($content);
});
$container.on('click', '#wizard-next', function () {
privateScope.saveWizardStep(selectedDefaultPreset, wizardStep);
@ -74,12 +78,22 @@ helper.defaultsDialog = (function (data) {
privateScope.wizard(selectedDefaultPreset, wizardStep + 1);
});
if (stepName == "receiver") {
privateScope.handleTabLoadReceiver($container);
}
Settings.configureInputs().then(
function () {
console.log('configure done');
$container.find('.defaults-dialog__content').hide();
$container.find('.defaults-dialog__wizard').show();
savingDefaultsModal.close();
$container.show();
}
);
});
});
}
};

View file

@ -1,6 +1,40 @@
var helper = helper || {};
helper.defaultsDialogData = [{
helper.defaultsDialogReceivers = {
0: "SPEK1024",
1: "SPEK2048",
2: "SBUS",
3: "SUMD",
4: "SUMH",
5: "XB-B",
6: "XB-B-RJ01",
7: "IBUS",
8: "JETIEXBUS",
9: "CRSF",
10: "FPORT",
11: "SBUS_FAST",
12: "FPORT2",
13: "SRXL2",
14: "GHST",
15: "MAVLINK"
}
helper.defaultsDialogData = [
{
"title": 'Test',
"id": 17,
"notRecommended": false,
"reboot": true,
"mixerToApply": 3,
"wizardPages": ['receiver', 'outputs', 'gps', 'filters', 'pids'],
"settings": [
{
key: "model_preview_type",
value: 3
}
]
},
{
"title": 'Mini Quad with 3"-7" propellers',
"id": 2,
"notRecommended": false,

View file

@ -3263,6 +3263,9 @@ var mspHelper = (function (gui) {
MSP.send_message(MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS, false, false, callback);
};
self.loadSerialPorts = function (callback) {
MSP.send_message(MSPCodes.MSP2_CF_SERIAL_CONFIG, false, false, callback);
}
return self;
})(GUI);

View file

@ -25,7 +25,8 @@ TABS.setup.initialize = function (callback) {
mspHelper.loadFeatures,
mspHelper.queryFcStatus,
mspHelper.loadMixerConfig,
mspHelper.loadMiscV2
mspHelper.loadMiscV2,
mspHelper.loadSerialPorts
];
loadChainer.setChain(loadChain);

View file

@ -1 +1,7 @@
<h2>Receiver wizard</h2>
<div>
<label for="wizard-receiver-port">Receiver Serial Port</label><select id="wizard-receiver-port"/>
</div>
<div>
<label for="wizard-receiver-protocol">Receiver Protocol</label><select id="wizard-receiver-protocol" data-setting="serialrx_provider"></select>
</div>