@@ -172,7 +172,7 @@ power.initialize = function (callback) {
172172 $ ( "#calibrationmanagercontent" ) . hide ( ) ;
173173 $ ( "#calibrationmanagerconfirmcontent" ) . hide ( ) ;
174174
175- // battery
175+ // battery
176176 const templateBatteryState = $ ( '#tab-power-templates .battery-state .battery-state' ) ;
177177 const destinationBatteryState = $ ( '.tab-power .battery-state' ) ;
178178 const elementBatteryState = templateBatteryState . clone ( ) ;
@@ -199,6 +199,7 @@ power.initialize = function (callback) {
199199
200200 const haveFc = FC . CONFIG . boardType === 0 || FC . CONFIG . boardType === 2 ;
201201
202+ // fill voltage
202203 const batteryMeterTypes = [
203204 i18n . getMessage ( 'powerBatteryVoltageMeterTypeNone' ) ,
204205 i18n . getMessage ( 'powerBatteryVoltageMeterTypeAdc' ) ,
@@ -208,11 +209,11 @@ power.initialize = function (callback) {
208209 batteryMeterTypes . push ( i18n . getMessage ( 'powerBatteryVoltageMeterTypeEsc' ) ) ;
209210 }
210211
211- let batteryMeterType_e = $ ( 'select.batterymetersource' ) ;
212-
212+ let batteryMeterType_e = $ ( '#batterymetersourceSelect' ) ;
213213 for ( let i = 0 ; i < batteryMeterTypes . length ; i ++ ) {
214- batteryMeterType_e . append ( `<option value=" ${ i } "> ${ batteryMeterTypes [ i ] } </option>` ) ;
214+ batteryMeterType_e . append ( new Option ( batteryMeterTypes [ i ] , i ) ) ;
215215 }
216+ batteryMeterType_e . sortSelect ( batteryMeterTypes [ 0 ] ) ;
216217
217218 // fill current
218219 const currentMeterTypes = [
@@ -226,11 +227,11 @@ power.initialize = function (callback) {
226227 currentMeterTypes . push ( i18n . getMessage ( 'powerBatteryCurrentMeterTypeMsp' ) ) ;
227228 }
228229
229- let currentMeterType_e = $ ( 'select.currentmetersource' ) ;
230-
230+ let currentMeterType_e = $ ( '#currentmetersourceSelect' ) ;
231231 for ( let i = 0 ; i < currentMeterTypes . length ; i ++ ) {
232- currentMeterType_e . append ( `<option value=" ${ i } "> ${ currentMeterTypes [ i ] } </option>` ) ;
232+ currentMeterType_e . append ( new Option ( currentMeterTypes [ i ] , i ) ) ;
233233 }
234+ currentMeterType_e . sortSelect ( currentMeterTypes [ 0 ] ) ;
234235
235236 updateDisplay ( FC . VOLTAGE_METER_CONFIGS , FC . CURRENT_METER_CONFIGS ) ;
236237
@@ -462,10 +463,11 @@ power.initialize = function (callback) {
462463 }
463464
464465 function process_html ( ) {
465- initDisplay ( ) ;
466466 // translate to user-selected language
467467 i18n . localizePage ( ) ;
468468
469+ initDisplay ( ) ;
470+
469471 GUI . content_ready ( callback ) ;
470472 }
471473} ;
0 commit comments