@@ -2435,10 +2435,15 @@ OSD.reload = function(callback) {
24352435 OSD . data . supported = true ;
24362436 OSD . msp . decodePreferences ( resp ) ;
24372437
2438- MSP . promise ( MSPCodes . MSP2_INAV_CUSTOM_OSD_ELEMENTS ) . then ( ( ) => {
2438+ MSP . promise ( MSPCodes . MSP2_INAV_CUSTOM_OSD_ELEMENTS ) . then ( ( ) => {
24392439 mspHelper . loadOsdCustomElements ( ( ) => {
2440- createCustomElements ( ) ;
2441- done ( ) ;
2440+ MSP . promise ( MSPCodes . MSP2_INAV_LOGIC_CONDITIONS_CONFIGURED ) . then ( ( ) => {
2441+ createCustomElements ( ) ;
2442+ done ( ) ;
2443+ } ) . catch ( ( ) => {
2444+ createCustomElements ( ) ;
2445+ done ( ) ;
2446+ } ) ;
24422447 } ) ;
24432448 } ) ;
24442449 } ) ;
@@ -3558,10 +3563,6 @@ TABS.osd = {};
35583563TABS . osd . initialize = function ( callback ) {
35593564
35603565 mspHelper . loadServoMixRules ( ) ;
3561- mspHelper . loadLogicConditions ( function ( ) {
3562- // Refresh LC dropdowns now that conditions are loaded
3563- $ ( 'select.lc, select.ico_lc' ) . html ( getLCoptions ( ) ) ;
3564- } ) ;
35653566
35663567 if ( GUI . active_tab != 'osd' ) {
35673568 GUI . active_tab = 'osd' ;
@@ -4177,13 +4178,16 @@ function getGVoptions(){
41774178
41784179function getLCoptions ( ) {
41794180 var result = '' ;
4180- // Return empty if conditions aren't fully loaded yet - callback will refresh
4181- if ( FC . LOGIC_CONDITIONS . getCount ( ) < FC . LOGIC_CONDITIONS . getMaxLogicConditionCount ( ) ) {
4181+ var mask = FC . LOGIC_CONDITIONS_CONFIGURED_MASK ;
4182+ if ( ! mask ) {
41824183 return result ;
41834184 }
4184- for ( var i = 0 ; i < FC . LOGIC_CONDITIONS . getMaxLogicConditionCount ( ) ; i ++ ) {
4185- if ( FC . LOGIC_CONDITIONS . isEnabled ( i ) ) {
4186- result += `<option value="` + i + `">LC ` + i + `</option>` ;
4185+ for ( var i = 0 ; i < 64 ; i ++ ) {
4186+ var isConfigured = ( i < 32 ) ?
4187+ ( ( mask . lower >>> i ) & 1 ) === 1 :
4188+ ( ( mask . upper >>> ( i - 32 ) ) & 1 ) === 1 ;
4189+ if ( isConfigured ) {
4190+ result += '<option value="' + i + '">LC ' + i + '</option>' ;
41874191 }
41884192 }
41894193 return result ;
0 commit comments