Skip to content

Commit 38cc7bd

Browse files
committed
BuildOptions
1 parent 85ea6c0 commit 38cc7bd

File tree

3 files changed

+92
-35
lines changed

3 files changed

+92
-35
lines changed

locales/en/messages.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,18 @@
369369
"tabAuxiliary": {
370370
"message": "Modes"
371371
},
372-
373372
"logActionHide": {
374373
"message": "Hide Log"
375374
},
376375
"logActionShow": {
377376
"message": "Show Log"
378377
},
379-
380378
"serialErrorFrameError": {
381379
"message": "Serial connection error: bad framing"
382380
},
383381
"serialErrorParityError": {
384382
"message": "Serial connection error: bad parity"
385383
},
386-
387384
"serialPortOpened": {
388385
"message": "Serial port <span class=\"message-positive\">successfully</span> opened with ID: $1"
389386
},
@@ -2299,9 +2296,9 @@
22992296
"auxiliaryToggleUnused": {
23002297
"message": "Hide unused modes"
23012298
},
2302-
"auxiliaryToggleNoFlightMode": {
2303-
"message": "Show only flight modes",
2304-
"descripton": "Toggle if all modes are shown or only Flight modes"
2299+
"auxiliaryFilterCategory": {
2300+
"message": "Category",
2301+
"descripton": "Category for Flight modes"
23052302
},
23062303
"auxiliaryMin": {
23072304
"message": "Min"
@@ -2451,7 +2448,7 @@
24512448
"message": "Enable MSP Override mode",
24522449
"description": "Help text to MSP OVERRIDE mode"
24532450
},
2454-
"auxiliaryHelpMode_OSDDISABLE": {
2451+
"auxiliaryHelpMode_OSD": {
24552452
"message": "Enable/Disable On-Screen-Display",
24562453
"description": "Help text to OSD mode"
24572454
},
@@ -2511,7 +2508,7 @@
25112508
"message": "Use to toggle customized USER4. Controls arbitrary output via PINIO",
25122509
"description": "Help text to customized USER4 mode"
25132510
},
2514-
"auxiliaryHelpMode_VTXCONTROLDISABLE": {
2511+
"auxiliaryHelpMode_DISABLEVTXCONTROL": {
25152512
"message": "Disable the control of VTX settings through the OSD",
25162513
"description": "Help text to VTX CONTROL DISABLE mode"
25172514
},

src/js/tabs/auxiliary.js

Lines changed: 86 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,50 @@ import inflection from "inflection";
1313

1414
const auxiliary = {};
1515

16+
// BF build Options mapped to build Key
17+
let buildMap = [
18+
{ buildKey: 'xxx', buildOption: ['USE_ARCO_TRAINER', 'USE_DASHBOARD', 'USE_PINIO']},
19+
{ buildKey: 'cam', buildOption: ['USE_CAMERA_CONTROL']},
20+
{ buildKey: 'dshot', buildOption: ['USE_DSHOT']},
21+
{ buildKey: 'gps', buildOption: ['USE_GPS', 'USE_GPS_PLUS_CODES']},
22+
{ buildKey: 'led_strip', buildOption: ['USE_LED_STRIP', 'USE_LED_STRIP_64']},
23+
{ buildKey: 'mag', buildOption: ['USE_MAG']},
24+
{ buildKey: 'osd', buildOption: ['USE_OSD', 'USE_OSD_SD', 'USE_OSD_HD', 'USE_FRSKYOSD']},
25+
{ buildKey: 'serial', buildOption: ['USE_SERIALRX', 'USE_SERIALRX_FPORT']},
26+
{ buildKey: 'servos', buildOption: ['USE_SERVOS']},
27+
{ buildKey: 'telemetry', buildOption: ['USE_TELEMETRY', 'USE_TELEMETRY_SMARTPORT']},
28+
{ buildKey: 'vtx', buildOption: ['USE_VTX']},
29+
];
30+
1631
const flightModes = ["ARM","ANGLE","HORIZON","ANTI GRAVITY","MAG","HEADFREE","HEADADJ","SERVO1","SERVO2","SERVO3",
17-
"FAILSAFE","AIR MODE","3D","FPV ANGLE MIX","FLIP OVER AFTER CRASH","USER1","USER2","USER3","USER4","ACRO TRAINER","LAUNCH CONTROL"];
32+
"FAILSAFE","AIR MODE","FPV ANGLE MIX","FLIP OVER AFTER CRASH","USER1","USER2","USER3","USER4","ACRO TRAINER","LAUNCH CONTROL"];
1833

1934
// Categories
20-
let categoryTable = createTable([
21-
['3D', '3D DISABLE / SWITCH'],
22-
['BEEP', 'BEEPER', 'BEEPER MUTE', 'GPS BEEP SATELLITE COUNT'],
23-
['BLACKBOX', 'BLACKBOX', 'BLACKBOX ERASE'],
24-
['CAM', 'CAMERA CONTROL 1', 'CAMERA CONTROL 2', 'CAMERA CONTROL 3'],
25-
['FLIGHTMODE', 'ARM','ANGLE','HORIZON','ANTI GRAVITY','MAG','HEADFREE','HEADADJ','SERVO1','SERVO2','SERVO3',
26-
'FAILSAFE','AIR MODE','3D','FPV ANGLE MIX','FLIP OVER AFTER CRASH','USER1','USER2','USER3','USER4','ACRO TRAINER','LAUNCH CONTROL'],
27-
['GPS', 'GPS BEEP SATELLITE COUNT', 'GPS RESCUE'],
28-
['LED', 'LEDLOW'],
29-
['OSD', 'OSD DISABLE'],
30-
['OTHER', 'CALIB', 'MSP OVERRIDE', 'LAP TIMER RESET', 'PASSTHRU', 'PARALYZE', 'PID AUDIO', 'PREARM', 'TELEMETRY'],
31-
['SERVO', 'SERVO1', 'SERVO2', 'SERVO3'],
32-
['USER', 'USER1', 'USER2', 'USER3', 'USER4'],
33-
['VTX', 'STICK COMMANDS DISABLE', 'VTX CONTROL DISABLE', 'VTX PIT MODE'],
34-
]);
35-
36-
const categoryFieldsSelect = $(".auxiliary_filter_category select");
35+
let categoryTable = [
36+
{ name: '3D', buildKey: ['dshot'], modes: ['3D', '3D DISABLE / SWITCH']},
37+
{ name: 'BEEP', buildKey: ['all'], modes: ['BEEPER', 'BEEPER MUTE', 'GPS BEEP SATELLITE COUNT']},
38+
{ name: 'BLACKBOX', buildKey: ['all'], modes: ['BLACKBOX', 'BLACKBOX ERASE']},
39+
{ name: 'CAM', buildKey: ['cam'], modes: ['CAMERA CONTROL 1', 'CAMERA CONTROL 2', 'CAMERA CONTROL 3']},
40+
{ name: 'FLIGHTMODE', buildKey: ['all'], modes: flightModes},
41+
{ name: 'GPS', buildKey: ['gps'], modes: ['GPS BEEP SATELLITE COUNT', 'GPS RESCUE']},
42+
{ name: 'LED', buildKey: ['led_strip'], modes: ['LEDLOW']},
43+
{ name: 'OSD', buildKey: ['osd'], modes: ['OSD DISABLE']},
44+
{ name: 'OTHER', buildKey: ['all'], modes: ['CALIB', 'MSP OVERRIDE', 'LAP TIMER RESET', 'PASSTHRU', 'PARALYZE', 'PID AUDIO', 'PREARM']},
45+
{ name: 'SERVO', buildKey: ['servos'], modes: ['SERVO1', 'SERVO2', 'SERVO3']},
46+
{ name: 'TELEMETRI', buildKey: ['telemetry'], modes: ['TELEMETRY']},
47+
{ name: 'USER', buildKey: ['all'], modes: ['USER1', 'USER2', 'USER3', 'USER4']},
48+
{ name: 'VTX', buildKey: ['vtx'], modes: ['STICK COMMANDS DISABLE', 'VTX CONTROL DISABLE', 'VTX PIT MODE']},
49+
];
50+
51+
52+
const categoryFieldsSelect = $('.auxiliary_category');
3753

3854
function createTable(data) {
3955
// Create a dynamic table with fixed values
4056
let table = [];
4157

4258
for (let i = 0; i < data.length; i++) {
43-
let row = data[i].slice(); // Use slice to clone the array
59+
let row = data[i].modes.slice(); // Use slice to clone the array
4460
table.push(row);
4561
}
4662

@@ -50,17 +66,64 @@ function createTable(data) {
5066
// Function to display the table in the console
5167
function displayTable(table) {
5268
for (let i = 0; i < table.length; i++) {
53-
console.log(table[i].join('\t'));
69+
console.log(`${table[i].name}: ${table[i].modes}`);
70+
}
71+
}
72+
73+
// Function to simulate mouseover and select an option
74+
function simulateMouseoverAndSelectOption(selectElement, optionIndex) {
75+
// Trigger mouseover event
76+
const mouseoverEvent = new Event('mouseover');
77+
selectElement.dispatchEvent(mouseoverEvent);
78+
79+
// Select the specified option
80+
selectElement.selectedIndex = optionIndex;
81+
82+
// Trigger change event to notify any listeners
83+
const changeEvent = new Event('change');
84+
selectElement.dispatchEvent(changeEvent);
85+
}
86+
87+
// Function to iterate over options and simulate mouseover and selection
88+
function simulateMouseoverAndSelectForEachOption() {
89+
// Get the select element
90+
const selectElement = document.getElementById('yourSelectElementId'); // Replace with your actual select element ID
91+
92+
// Iterate over each option and simulate mouseover and selection
93+
for (let i = 0; i < selectElement.options.length; i++) {
94+
simulateMouseoverAndSelectOption(selectElement, i);
95+
// You can add a delay here if needed
96+
// setTimeout(() => {
97+
// simulateMouseoverAndSelectOption(selectElement, i);
98+
// }, 1000 * i); // Adjust the delay as needed
99+
}
100+
}
101+
102+
// Call the function when needed
103+
//simulateMouseoverAndSelectForEachOption();
104+
/*
105+
Replace 'yourSelectElementId' with the actual ID of your select element.
106+
The simulateMouseoverAndSelectForEachOption function iterates over each option in the select element, simulates a mouseover, and selects the option.
107+
You can also add a delay between each iteration if needed (commented out in the code). Adjust the delay according to your requirements.
108+
*/
109+
110+
function createCategorySelect(table) {
111+
for (let i = 0; i < table.length; i++) {
112+
const str = `<option value="${table[i].name}">${table[i].name}</option>`;
113+
$('#auxiliary_filter_category .select').append(`<option value="${table[i].name}">${table[i].name}</option>`);
114+
console.log(str);
54115
}
55116
}
56117

118+
function isFlightMode(name) {
119+
return flightModes.includes(name);
120+
}
121+
57122
auxiliary.initialize = function (callback) {
58123
GUI.active_tab_ref = this;
59124
GUI.active_tab = 'auxiliary';
60125
let prevChannelsValues = null;
61126

62-
this._selectCategory = $('#auxiliary_filter_category');
63-
64127
function get_mode_ranges() {
65128
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_mode_ranges_extra);
66129
}
@@ -89,10 +152,6 @@ auxiliary.initialize = function (callback) {
89152
$('#content').load("./tabs/auxiliary.html", process_html);
90153
}
91154

92-
function isFlightMode(name) {
93-
return flightModes.includes(name);
94-
}
95-
96155
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
97156

98157
function createMode(modeIndex, modeId) {
@@ -355,6 +414,7 @@ auxiliary.initialize = function (callback) {
355414

356415
// generate category multiple select
357416
displayTable(categoryTable);
417+
createCategorySelect(categoryTable);
358418

359419
const length = Math.max(...(FC.AUX_CONFIG.map(el => el.length)));
360420
$('.tab-auxiliary .mode .info').css('min-width', `${Math.round(length * getTextWidth('A'))}px`);

src/tabs/auxiliary.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div class="auxiliary_filter_row">
1515
<div class = "auxiliary_fitler_table_header" i18n="auxiliaryFilterCategory"></div>
1616
<div class = "auxiliary_fitler_table_value">
17-
<select multiple="multiple" class="presets_filter_select" id="auxiliary_filter_category"></select>
17+
<select id="auxiliary_category" multiple="multiple" class="auxiliary_filter_select"></select>
1818
</div>
1919
</div>
2020
</div>

0 commit comments

Comments
 (0)