Skip to content

Commit 85ea6c0

Browse files
committed
Change to category
1 parent c30edd4 commit 85ea6c0

File tree

2 files changed

+65
-20
lines changed

2 files changed

+65
-20
lines changed

src/js/tabs/auxiliary.js

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { i18n } from '../localization';
2-
import GUI from '../gui';
2+
import GUI, { TABS } from '../../js/gui';
33
import { get as getConfig, set as setConfig } from '../ConfigStorage';
44
import { bit_check } from '../bit';
55
import { mspHelper } from '../msp/MSPHelper';
@@ -16,11 +16,51 @@ const auxiliary = {};
1616
const flightModes = ["ARM","ANGLE","HORIZON","ANTI GRAVITY","MAG","HEADFREE","HEADADJ","SERVO1","SERVO2","SERVO3",
1717
"FAILSAFE","AIR MODE","3D","FPV ANGLE MIX","FLIP OVER AFTER CRASH","USER1","USER2","USER3","USER4","ACRO TRAINER","LAUNCH CONTROL"];
1818

19+
// 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");
37+
38+
function createTable(data) {
39+
// Create a dynamic table with fixed values
40+
let table = [];
41+
42+
for (let i = 0; i < data.length; i++) {
43+
let row = data[i].slice(); // Use slice to clone the array
44+
table.push(row);
45+
}
46+
47+
return table;
48+
}
49+
50+
// Function to display the table in the console
51+
function displayTable(table) {
52+
for (let i = 0; i < table.length; i++) {
53+
console.log(table[i].join('\t'));
54+
}
55+
}
56+
1957
auxiliary.initialize = function (callback) {
2058
GUI.active_tab_ref = this;
2159
GUI.active_tab = 'auxiliary';
2260
let prevChannelsValues = null;
2361

62+
this._selectCategory = $('#auxiliary_filter_category');
63+
2464
function get_mode_ranges() {
2565
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_mode_ranges_extra);
2666
}
@@ -311,6 +351,10 @@ auxiliary.initialize = function (callback) {
311351

312352
// translate to user-selected language
313353
i18n.localizePage();
354+
//categoryFieldsSelect
355+
356+
// generate category multiple select
357+
displayTable(categoryTable);
314358

315359
const length = Math.max(...(FC.AUX_CONFIG.map(el => el.length)));
316360
$('.tab-auxiliary .mode .info').css('min-width', `${Math.round(length * getTextWidth('A'))}px`);
@@ -494,39 +538,31 @@ auxiliary.initialize = function (callback) {
494538

495539
let hideUnused = hideUnusedModes && hasUsedMode;
496540
let hideNoFlight = hideNoFlightMode && hasUsedMode;
497-
console.log(`0 hideUnusedModes: ${hideUnusedModes}, hideNoFlightMode: ${hideNoFlightMode}`);
498-
console.log(`0 hasUsedMode: ${hasUsedMode}, hideUnused: ${hideUnused}, hideNoFlight: ${hideNoFlight}`);
499541

500542
for (let i = 1; i < FC.AUX_CONFIG.length; i++) { // ARM has index 0
501543
let modeElement = $(`#mode-${i}`);
502-
let style = modeElement.css('display');
503544

504545
if (modeElement.find(' .range').length == 0 && modeElement.find(' .link').length == 0) {
505546
// unused mode
506-
style = modeElement.css('display');
507-
console.log(`1 HIDE: ${FC.AUX_CONFIG[i]} ${style}`);
508-
509547
modeElement.toggle(!hideUnused);
510-
511-
style = modeElement.css('display');
512-
console.log(`2 HIDE: ${FC.AUX_CONFIG[i]} ${style}`);
513548
}
514549

550+
/*
515551
if ( ! isFlightMode(FC.AUX_CONFIG[i])) {
516552
// not flightMode mode
553+
hide = hide || !hideNoFlight;
517554
style = modeElement.css('display');
518-
console.log(`1 NOT flightmode: ${FC.AUX_CONFIG[i]} - ${hideNoFlight} - ${style}`);
555+
console.log(`1 HIDE not flightmode: ${FC.AUX_CONFIG[i]} -> ${hide}`);
519556
// modeElement.toggle(!hideNoFlight);
557+
/ *
520558
if( hideNoFlight && ! style === 'none') {
521559
modeElement.toggle(!hideUnused);
522560
}
523561
style = modeElement.css('display');
524-
console.log(`2 NOT flightmode: ${FC.AUX_CONFIG[i]} - ${hideNoFlight} - ${style}`);
525-
}
526-
else {
527-
style = modeElement.css('display');
528-
console.log(`Flightmode: ${FC.AUX_CONFIG[i]} - ${style}`);
562+
console.log(`2 NOT flightmode: ${FC.AUX_CONFIG[i]} - ${style}`);
563+
* /
529564
}
565+
*/
530566
}
531567

532568
auto_select_channel(FC.RC.channels, FC.RC.active_channels, FC.RSSI_CONFIG.channel);

src/tabs/auxiliary.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@
88
<p i18n="auxiliaryHelp"></p>
99
</div>
1010

11+
<div id="auxiliary_main_content">
12+
<div class="auxiliary_search_settings">
13+
<div class="auxiliary_filter_table_wrapper">
14+
<div class="auxiliary_filter_row">
15+
<div class = "auxiliary_fitler_table_header" i18n="auxiliaryFilterCategory"></div>
16+
<div class = "auxiliary_fitler_table_value">
17+
<select multiple="multiple" class="presets_filter_select" id="auxiliary_filter_category"></select>
18+
</div>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
1124
<div class="toolbox">
12-
<form>
13-
<input type="checkbox" id="switch-toggle-hideNoFlightMode" name="switch-toggle-hideNoFlightMode" class="toggle" />
14-
<span i18n="auxiliaryToggleNoFlightMode"></span>
15-
</form>
1625
<form>
1726
<input type="checkbox" id="switch-toggle-unused" name="switch-toggle-unused" class="toggle" />
1827
<span i18n="auxiliaryToggleUnused"></span>

0 commit comments

Comments
 (0)