@@ -304,50 +304,42 @@ setup.initialize = function (callback) {
304304 }
305305 }
306306
307- if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_46 ) ) {
308- MSP . send_message ( MSPCodes . MSP2_SENSOR_CONFIG_ACTIVE , false , false , function ( ) {
309- addSensorInfo (
310- FC . SENSOR_CONFIG_ACTIVE . gyro_hardware ,
311- sensor_gyro_e ,
312- "gyro" ,
313- sensorTypes ( ) . gyro . elements ,
314- ) ;
315- addSensorInfo (
316- FC . SENSOR_CONFIG_ACTIVE . acc_hardware ,
317- sensor_acc_e ,
318- "acc" ,
319- sensorTypes ( ) . acc . elements ,
320- ) ;
321- addSensorInfo (
322- FC . SENSOR_CONFIG_ACTIVE . baro_hardware ,
323- sensor_baro_e ,
324- "baro" ,
325- sensorTypes ( ) . baro . elements ,
326- ) ;
327- addSensorInfo (
328- FC . SENSOR_CONFIG_ACTIVE . mag_hardware ,
329- sensor_mag_e ,
330- "mag" ,
331- sensorTypes ( ) . mag . elements ,
332- ) ;
307+ MSP . send_message ( MSPCodes . MSP2_SENSOR_CONFIG_ACTIVE , false , false , function ( ) {
308+ addSensorInfo (
309+ FC . SENSOR_CONFIG_ACTIVE . gyro_hardware ,
310+ sensor_gyro_e ,
311+ "gyro" ,
312+ sensorTypes ( ) . gyro . elements ,
313+ ) ;
314+ addSensorInfo ( FC . SENSOR_CONFIG_ACTIVE . acc_hardware , sensor_acc_e , "acc" , sensorTypes ( ) . acc . elements ) ;
315+ addSensorInfo (
316+ FC . SENSOR_CONFIG_ACTIVE . baro_hardware ,
317+ sensor_baro_e ,
318+ "baro" ,
319+ sensorTypes ( ) . baro . elements ,
320+ ) ;
321+ addSensorInfo ( FC . SENSOR_CONFIG_ACTIVE . mag_hardware , sensor_mag_e , "mag" , sensorTypes ( ) . mag . elements ) ;
322+ addSensorInfo (
323+ FC . SENSOR_CONFIG_ACTIVE . sonar_hardware ,
324+ sensor_sonar_e ,
325+ "sonar" ,
326+ sensorTypes ( ) . sonar . elements ,
327+ ) ;
328+
329+ // opticalflow sensor is available since 1.47
330+ if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_47 ) ) {
333331 addSensorInfo (
334- FC . SENSOR_CONFIG_ACTIVE . sonar_hardware ,
335- sensor_sonar_e ,
336- "sonar " ,
337- sensorTypes ( ) . sonar . elements ,
332+ FC . SENSOR_CONFIG_ACTIVE . opticalflow_hardware ,
333+ sensor_opticalflow_e ,
334+ "opticalflow " ,
335+ sensorTypes ( ) . opticalflow . elements ,
338336 ) ;
337+ }
338+ } ) ;
339+ } ;
339340
340- // opticalflow sensor is available since 1.47
341- if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_47 ) ) {
342- addSensorInfo (
343- FC . SENSOR_CONFIG_ACTIVE . opticalflow_hardware ,
344- sensor_opticalflow_e ,
345- "opticalflow" ,
346- sensorTypes ( ) . opticalflow . elements ,
347- ) ;
348- }
349- } ) ;
350- }
341+ const hideSensorInfo = function ( ) {
342+ $ ( "#sensorInfoBox" ) . hide ( ) ;
351343 } ;
352344
353345 // Fills in the "Build type" part of the "Firmware info" box
@@ -524,7 +516,11 @@ setup.initialize = function (callback) {
524516 }
525517
526518 prepareDisarmFlags ( ) ;
527- showSensorInfo ( ) ;
519+ if ( semver . gte ( FC . CONFIG . apiVersion , API_VERSION_1_46 ) ) {
520+ showSensorInfo ( ) ;
521+ } else {
522+ hideSensorInfo ( ) ;
523+ }
528524 showFirmwareInfo ( ) ;
529525 showNetworkStatus ( ) ;
530526
0 commit comments