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:
parent
e0ef5b0261
commit
cf57493fdb
5 changed files with 763 additions and 705 deletions
|
@ -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;
|
||||
|
@ -58,13 +64,11 @@ helper.defaultsDialog = (function (data) {
|
|||
} else {
|
||||
const $content = $container.find('.defaults-dialog__wizard');
|
||||
|
||||
$.get("./wizard/" + stepName + ".html", function(data) {
|
||||
$content.html(data);
|
||||
});
|
||||
|
||||
$.get("./wizard/buttons.html", function(data) {
|
||||
$.get("./wizard/" + stepName + ".html", function (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();
|
||||
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
@ -191,8 +225,8 @@ helper.defaultsDialogData = [{
|
|||
value: "DROP"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
"title": 'Airplane with a Tail',
|
||||
"notRecommended": false,
|
||||
"id": 3,
|
||||
|
@ -390,8 +424,8 @@ helper.defaultsDialogData = [{
|
|||
state: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
"title": 'Airplane without a Tail (Wing, Delta, etc)',
|
||||
"notRecommended": false,
|
||||
"id": 3,
|
||||
|
@ -589,8 +623,8 @@ helper.defaultsDialogData = [{
|
|||
state: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
"title": 'Rovers & Boats',
|
||||
"id": 1,
|
||||
"notRecommended": false,
|
||||
|
@ -658,8 +692,8 @@ helper.defaultsDialogData = [{
|
|||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
"title": 'Keep current settings (Not recommended)',
|
||||
"id": 0,
|
||||
"notRecommended": true,
|
||||
|
@ -670,5 +704,5 @@ helper.defaultsDialogData = [{
|
|||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
|
@ -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);
|
||||
|
|
|
@ -25,7 +25,8 @@ TABS.setup.initialize = function (callback) {
|
|||
mspHelper.loadFeatures,
|
||||
mspHelper.queryFcStatus,
|
||||
mspHelper.loadMixerConfig,
|
||||
mspHelper.loadMiscV2
|
||||
mspHelper.loadMiscV2,
|
||||
mspHelper.loadSerialPorts
|
||||
];
|
||||
|
||||
loadChainer.setChain(loadChain);
|
||||
|
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue