@@ -311,6 +311,26 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
311311 // translate to user-selected language
312312 i18n . localizePage ( ) ;
313313
314+ var gyro_align_content_e = $ ( '.tab-configuration .gyro_align_content' ) ;
315+ var legacy_gyro_alignment_e = $ ( '.tab-configuration .legacy_gyro_alignment' ) ;
316+ var legacy_accel_alignment_e = $ ( '.tab-configuration .legacy_accel_alignment' ) ;
317+
318+ // Hide the new multi gyro element by default
319+ gyro_align_content_e . hide ( ) ;
320+
321+ // If we are sent USE_MULTI_GYRO flag from the target, show the new element, while hiding the old ones.
322+ if ( SENSOR_ALIGNMENT . use_multi_gyro == 1 ) {
323+ gyro_align_content_e . show ( ) ;
324+ legacy_gyro_alignment_e . hide ( ) ;
325+ legacy_accel_alignment_e . hide ( ) ;
326+ }
327+
328+ // As the gyro_to_use does not have a 'DEFAULT' 0th element enum like alingments, the 0th element 'First' is excluded from here.
329+ var gyros = [
330+ i18n . getMessage ( 'configurationSensorGyroToUseSecond' ) ,
331+ i18n . getMessage ( 'configurationSensorGyroToUseBoth' )
332+ ] ;
333+
314334 var alignments = [
315335 'CW 0°' ,
316336 'CW 90°' ,
@@ -326,17 +346,32 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
326346 var orientation_acc_e = $ ( 'select.accalign' ) ;
327347 var orientation_mag_e = $ ( 'select.magalign' ) ;
328348
349+ var orientation_gyro_to_use_e = $ ( 'select.gyro_to_use' ) ;
350+ var orientation_gyro_1_align_e = $ ( 'select.gyro_1_align' ) ;
351+ var orientation_gyro_2_align_e = $ ( 'select.gyro_2_align' ) ;
352+
329353 if ( semver . lt ( CONFIG . apiVersion , "1.15.0" ) ) {
330354 $ ( '.tab-configuration .sensoralignment' ) . hide ( ) ;
331355 } else {
356+ for ( var i = 0 ; i < gyros . length ; i ++ ) {
357+ orientation_gyro_to_use_e . append ( '<option value="' + ( i + 1 ) + '">' + gyros [ i ] + '</option>' ) ;
358+ }
332359 for ( var i = 0 ; i < alignments . length ; i ++ ) {
333360 orientation_gyro_e . append ( '<option value="' + ( i + 1 ) + '">' + alignments [ i ] + '</option>' ) ;
334361 orientation_acc_e . append ( '<option value="' + ( i + 1 ) + '">' + alignments [ i ] + '</option>' ) ;
335362 orientation_mag_e . append ( '<option value="' + ( i + 1 ) + '">' + alignments [ i ] + '</option>' ) ;
363+
364+ orientation_gyro_1_align_e . append ( '<option value="' + ( i + 1 ) + '">' + alignments [ i ] + '</option>' ) ;
365+ orientation_gyro_2_align_e . append ( '<option value="' + ( i + 1 ) + '">' + alignments [ i ] + '</option>' ) ;
336366 }
337367 orientation_gyro_e . val ( SENSOR_ALIGNMENT . align_gyro ) ;
338368 orientation_acc_e . val ( SENSOR_ALIGNMENT . align_acc ) ;
339369 orientation_mag_e . val ( SENSOR_ALIGNMENT . align_mag ) ;
370+
371+ orientation_gyro_to_use_e . val ( SENSOR_ALIGNMENT . gyro_to_use ) ;
372+
373+ orientation_gyro_1_align_e . val ( SENSOR_ALIGNMENT . gyro_1_align ) ;
374+ orientation_gyro_2_align_e . val ( SENSOR_ALIGNMENT . gyro_2_align ) ;
340375 }
341376
342377 // ESC protocols
@@ -1023,6 +1058,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
10231058 SENSOR_ALIGNMENT . align_gyro = parseInt ( orientation_gyro_e . val ( ) ) ;
10241059 SENSOR_ALIGNMENT . align_acc = parseInt ( orientation_acc_e . val ( ) ) ;
10251060 SENSOR_ALIGNMENT . align_mag = parseInt ( orientation_mag_e . val ( ) ) ;
1061+ if ( semver . gte ( CONFIG . apiVersion , "1.41.0" ) ) {
1062+ SENSOR_ALIGNMENT . gyro_to_use = parseInt ( orientation_gyro_to_use_e . val ( ) ) ;
1063+ SENSOR_ALIGNMENT . gyro_1_align = parseInt ( orientation_gyro_1_align_e . val ( ) ) ;
1064+ SENSOR_ALIGNMENT . gyro_2_align = parseInt ( orientation_gyro_2_align_e . val ( ) ) ;
1065+ }
10261066
10271067 PID_ADVANCED_CONFIG . fast_pwm_protocol = parseInt ( esc_protocol_e . val ( ) - 1 ) ;
10281068 PID_ADVANCED_CONFIG . use_unsyncedPwm = $ ( 'input[id="unsyncedPWMSwitch"]' ) . is ( ':checked' ) ? 1 : 0 ;
0 commit comments