@@ -6,6 +6,20 @@ const intervalPatterns = [
66 / ^ ( c o l d | h o t ) _ f i x _ t i m e o u t $ /
77] ;
88
9+ const grouping = {
10+ "^(hot|cold)_" : "satellite" ,
11+ "^sat_send_flag$" : "satellite" ,
12+ "^rejoin_interval$" : "lr" ,
13+ "^app_(key|eui)$" : "lr" ,
14+ "^device_eui$" : "lr" ,
15+ "^horizontal_accuracy$" : "ublox" ,
16+ "^motion_ths$" : "gps" ,
17+ "^enable_motion_trig_gps$" : "gps" ,
18+ "^rf_open_sky_detection" : 0 ,
19+ "^rf_scan" : 0 ,
20+ "(^.{2,}?)_" : 1
21+ } ;
22+
923const bitmapSettings = [ / ^ .* _ f l a g $ / ] ;
1024
1125const skipPorts = [ 'port_lr_messaging' , 'port_flash_log' , 'port_values' , 'port_messages' , 'port_commands' ] ;
@@ -116,7 +130,8 @@ function filterSettings() {
116130 const settings = group . querySelectorAll ( '.setting' ) ;
117131
118132 settings . forEach ( setting => {
119- const matchesSearch = setting . querySelector ( 'h4' ) . textContent . toLowerCase ( ) . includes ( query ) ;
133+ const dataSearch = setting . getAttribute ( 'data-search' ) || setting . querySelector ( 'h4' ) . textContent ;
134+ const matchesSearch = dataSearch . toLowerCase ( ) . includes ( query ) ;
120135 const isNonDefault = setting . classList . contains ( 'value-not-default' ) ;
121136 const shouldShow = matchesSearch && ( ! showNonDefaultOnly || isNonDefault ) ;
122137
@@ -253,16 +268,38 @@ function guessTimeUnit(seconds) {
253268 return '1' ;
254269}
255270
271+ function formatSettingName ( settingName , group ) {
272+ if ( settingName . startsWith ( group + "_" ) ) {
273+ settingName = settingName . replace ( group + "_" , "" ) ;
274+ }
275+
276+ return settingName ;
277+ }
278+
279+ function getGroupName ( key ) {
280+ for ( const [ rx , groupName ] of Object . entries ( grouping ) ) {
281+ const match = key . match ( rx ) ;
282+ if ( match ) {
283+ if ( typeof groupName === 'number' ) {
284+ return match [ groupName ] ;
285+ } else {
286+ return groupName ;
287+ }
288+ }
289+ }
290+ return key ;
291+ }
292+
256293function groupAndSortSettings ( ) {
257294 const grouped = { } ;
258295 const other = { } ;
259296
260297 for ( const key in settingsData . settings ) {
261- const prefix = key . split ( '_' ) [ 0 ] ;
262- if ( ! grouped [ prefix ] ) {
263- grouped [ prefix ] = { } ;
298+ const groupName = getGroupName ( key ) ;
299+ if ( ! grouped [ groupName ] ) {
300+ grouped [ groupName ] = { } ;
264301 }
265- grouped [ prefix ] [ key ] = settingsData . settings [ key ] ;
302+ grouped [ groupName ] [ key ] = settingsData . settings [ key ] ;
266303 }
267304
268305 // Move singletons into "_other"
@@ -273,13 +310,24 @@ function groupAndSortSettings() {
273310 delete grouped [ prefix ] ;
274311 }
275312 }
313+
276314 if ( Object . keys ( other ) . length > 0 ) {
277315 grouped [ "_other" ] = other ;
278316 }
279317
318+ for ( const groupName in grouped ) {
319+ for ( const key in grouped [ groupName ] ) {
320+ grouped [ groupName ] [ key ] . display_name = formatSettingName ( key , groupName ) ;
321+ }
322+ }
323+
280324 // Sort groups
281325 const sortedGroups = Object . keys ( grouped ) . sort ( ) . reduce ( ( acc , group ) => {
282- acc [ group ] = Object . keys ( grouped [ group ] ) . sort ( ) . reduce ( ( groupAcc , key ) => {
326+ acc [ group ] = Object . keys ( grouped [ group ] ) . sort ( ( a , b ) => {
327+ const nameA = grouped [ group ] [ a ] . display_name . toLowerCase ( ) ;
328+ const nameB = grouped [ group ] [ b ] . display_name . toLowerCase ( ) ;
329+ return nameA . localeCompare ( nameB ) ;
330+ } ) . reduce ( ( groupAcc , key ) => {
283331 groupAcc [ key ] = grouped [ group ] [ key ] ;
284332 return groupAcc ;
285333 } , { } ) ;
0 commit comments