Finishing Power & Battery tab
parent
667c4d5af3
commit
3ee2884d62
|
@ -2007,7 +2007,7 @@
|
|||
"message": "Warning Cell Voltage"
|
||||
},
|
||||
"powerVoltageHead": {
|
||||
"message": "Voltage"
|
||||
"message": "Voltage Meter"
|
||||
},
|
||||
"powerVoltageValue": {
|
||||
"message": "$1 V"
|
||||
|
@ -2016,7 +2016,7 @@
|
|||
"message": "$1 A"
|
||||
},
|
||||
"powerVoltageId10": {
|
||||
"message": "Battery"
|
||||
"message": "Onboard ADC"
|
||||
},
|
||||
"powerVoltageId20": {
|
||||
"message": "5V"
|
||||
|
@ -2097,10 +2097,10 @@
|
|||
},
|
||||
|
||||
"powerAmperageHead": {
|
||||
"message": "Amperage"
|
||||
"message": "Amperage Meter"
|
||||
},
|
||||
"powerAmperageId10": {
|
||||
"message": "Battery"
|
||||
"message": "Onboard ADC"
|
||||
},
|
||||
"powerAmperageId50": {
|
||||
"message": "ESC Combined"
|
||||
|
@ -2149,15 +2149,18 @@
|
|||
},
|
||||
|
||||
"powerAmperageScale": {
|
||||
"message": "Scale the output voltage to milliamps [1/10th mV/A]"
|
||||
"message": "Scale"
|
||||
},
|
||||
"powerAmperageOffset": {
|
||||
"message": "Offset in millivolt steps"
|
||||
"message": "Offset in milliampere steps"
|
||||
},
|
||||
|
||||
"powerBatteryHead": {
|
||||
"message": "Battery"
|
||||
},
|
||||
"powerStateHead": {
|
||||
"message": "Power State"
|
||||
},
|
||||
"powerBatteryConnected": {
|
||||
"message": "Connected"
|
||||
},
|
||||
|
|
|
@ -1245,22 +1245,47 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(BATTERY_CONFIG.voltageMeterSource)
|
||||
.push8(BATTERY_CONFIG.currentMeterSource);
|
||||
break;
|
||||
// FIXME - Needs updating before it can be used.
|
||||
// case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||
// buffer.push8(MISC.vbatscale)
|
||||
// .push8(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 10))
|
||||
// .push8(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 10))
|
||||
// .push8(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 10));
|
||||
// if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||
// buffer.push8(BATTERY_CONFIG.voltageMeterSource);
|
||||
// }
|
||||
// break;
|
||||
// case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||
// buffer.push16(BF_CONFIG.currentscale)
|
||||
// .push16(BF_CONFIG.currentoffset)
|
||||
// .push8(BATTERY_CONFIG.currentMeterSource)
|
||||
// .push16(BF_CONFIG.batterycapacity)
|
||||
// break;
|
||||
|
||||
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push8(VOLTAGE_METER_CONFIGS.length)
|
||||
for (var i = 0; i < VOLTAGE_METER_CONFIGS.length; i++) {
|
||||
buffer.push8(4) // subframe length
|
||||
.push8(VOLTAGE_METER_CONFIGS[i].id)
|
||||
.push8(VOLTAGE_METER_CONFIGS[i].vbatscale)
|
||||
.push8(VOLTAGE_METER_CONFIGS[i].vbatresdivval)
|
||||
.push8(VOLTAGE_METER_CONFIGS[i].vbatresdivmultiplier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
buffer
|
||||
.push8(MISC.vbatscale)
|
||||
.push8(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 10))
|
||||
.push8(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 10))
|
||||
.push8(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 10));
|
||||
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||
buffer.push8(BATTERY_CONFIG.voltageMeterSource);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push8(CURRENT_METER_CONFIGS.length)
|
||||
for (var i = 0; i < CURRENT_METER_CONFIGS.length; i++) {
|
||||
buffer.push8(5) // subframe length
|
||||
.push8(CURRENT_METER_CONFIGS[i].id)
|
||||
.push16(CURRENT_METER_CONFIGS[i].scale)
|
||||
.push16(CURRENT_METER_CONFIGS[i].offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
buffer.push16(BF_CONFIG.currentscale)
|
||||
.push16(BF_CONFIG.currentoffset)
|
||||
.push8(BATTERY_CONFIG.currentMeterSource)
|
||||
.push16(BF_CONFIG.batterycapacity)
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_RX_CONFIG:
|
||||
buffer.push8(RX_CONFIG.serialrx_provider)
|
||||
.push16(RX_CONFIG.stick_max)
|
||||
|
|
|
@ -2,11 +2,20 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.tab-power .leftWrapper {
|
||||
float: left;
|
||||
width:calc(50% - 20px)
|
||||
}
|
||||
|
||||
.tab-power .rightWrapper {
|
||||
float: left;
|
||||
width: calc(50% - 0px);
|
||||
margin: 0 0 10px 20px;
|
||||
}
|
||||
|
||||
.tab-power td.configuration {
|
||||
padding-top: 5px;
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.tab-power .battery-state .configuration {
|
||||
|
@ -18,6 +27,10 @@
|
|||
width: 20%;
|
||||
}
|
||||
|
||||
.tab-power .label {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.tab-power .number input {
|
||||
width: 50px;
|
||||
padding-left: 3px;
|
||||
|
@ -32,11 +45,7 @@
|
|||
}
|
||||
|
||||
|
||||
.tab-power .spacer_box {
|
||||
padding-bottom: 10px;
|
||||
float: left;
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
|
||||
.tab-power .number,
|
||||
.tab-power .select
|
||||
|
|
130
tabs/power.html
130
tabs/power.html
|
@ -1,5 +1,5 @@
|
|||
<div class="tab-power toolbar_fixed_bottom">
|
||||
<div class="content_wrapper initialstyle">
|
||||
<div class="content_wrapper">
|
||||
<!-- should be the first DIV on each tab -->
|
||||
<div class="cf_column spacerbottom">
|
||||
<div class="tab_title" i18n="tabPower">Power</div>
|
||||
|
@ -7,47 +7,90 @@
|
|||
<a id="button-documentation" href="" target="_blank"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="require-support">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerBatteryHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box battery">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="battery-state">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerVoltageHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="voltage-meters">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerAmperageHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="amperage-meters">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="leftWrapper">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerBatteryHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box battery">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="battery-config">
|
||||
<td class="configuration" rowspan="4"></td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightWrapper">
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerStateHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box battery">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="battery-state">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="leftWrapper">
|
||||
<div class="gui_box grey boxVoltageConfiguration">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerVoltageHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="voltage-meters">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="leftWrapper">
|
||||
<div class="gui_box grey boxAmperageConfiguration">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="powerAmperageHead"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
|
||||
<tbody class="amperage-meters">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="note require-upgrade">
|
||||
<div class="note_spacer">
|
||||
<p i18n="powerFirmwareUpgradeRequired"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content_toolbar">
|
||||
<div class="btn save_btn">
|
||||
<a class="save" href="#" i18n="powerButtonSave"></a>
|
||||
|
@ -65,7 +108,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<table class="amperage-meters">
|
||||
<tbody>
|
||||
<tr class="amperage-meter">
|
||||
|
@ -75,13 +118,12 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="battery-states">
|
||||
|
||||
<table class="battery-state">
|
||||
<tbody class="battery-state">
|
||||
<tr class="connection-state">
|
||||
<td i18n="powerBatteryConnected"></td>
|
||||
<td class="value">?</td>
|
||||
<td class="configuration" rowspan="4"></td>
|
||||
</tr>
|
||||
<tr class="voltage">
|
||||
<td i18n="powerBatteryVoltage"></td>
|
||||
|
@ -97,7 +139,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="battery-configuration">
|
||||
<div class="select vbatmonitoring">
|
||||
<label>
|
||||
|
@ -133,7 +175,7 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="voltage-configuration">
|
||||
<div class="number">
|
||||
<label> <input type="number" name="vbatscale" step="1" min="10" max="255" /> <span
|
||||
|
@ -151,7 +193,7 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="amperage-configuration">
|
||||
<div class="number">
|
||||
<label> <input type="number" name="amperagescale" step="1" min="-1000" max="1500" /> <span
|
||||
|
@ -163,5 +205,5 @@
|
|||
i18n="powerAmperageOffset"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
119
tabs/power.js
119
tabs/power.js
|
@ -24,7 +24,7 @@ TABS.power.initialize = function (callback) {
|
|||
function load_current_meters() {
|
||||
MSP.send_message(MSPCodes.MSP_CURRENT_METERS, false, false, load_current_meter_configs);
|
||||
}
|
||||
|
||||
|
||||
function load_current_meter_configs() {
|
||||
MSP.send_message(MSPCodes.MSP_CURRENT_METER_CONFIG, false, false, load_voltage_meter_configs);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ TABS.power.initialize = function (callback) {
|
|||
function load_battery_state() {
|
||||
MSP.send_message(MSPCodes.MSP_BATTERY_STATE, false, false, load_battery_config);
|
||||
}
|
||||
|
||||
|
||||
function load_battery_config() {
|
||||
MSP.send_message(MSPCodes.MSP_BATTERY_CONFIG, false, false, load_html);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ TABS.power.initialize = function (callback) {
|
|||
function load_html() {
|
||||
$('#content').load("./tabs/power.html", process_html);
|
||||
}
|
||||
|
||||
|
||||
this.supported = semver.gte(CONFIG.apiVersion, "1.33.0");
|
||||
|
||||
if (!this.supported) {
|
||||
|
@ -61,94 +61,113 @@ TABS.power.initialize = function (callback) {
|
|||
$(".tab-power").addClass("supported");
|
||||
|
||||
// voltage meters
|
||||
|
||||
|
||||
var template = $('#tab-power-templates .voltage-meters .voltage-meter');
|
||||
var destination = $('.tab-power .voltage-meters');
|
||||
|
||||
var destination = $('.tab-power .voltage-meters');
|
||||
|
||||
if (BATTERY_CONFIG.voltageMeterSource == 0)
|
||||
$('.boxVoltageConfiguration').hide();
|
||||
|
||||
for (var index = 0; index < VOLTAGE_METERS.length; index++) {
|
||||
var meterElement = template.clone();
|
||||
$(meterElement).attr('id', 'voltage-meter-' + index);
|
||||
|
||||
|
||||
var message = chrome.i18n.getMessage('powerVoltageId' + VOLTAGE_METERS[index].id);
|
||||
$(meterElement).find('.label').text(message)
|
||||
destination.append(meterElement);
|
||||
|
||||
meterElement.hide();
|
||||
if ((BATTERY_CONFIG.voltageMeterSource == 1 && VOLTAGE_METERS[index].id == 10) // TODO: replace hardcoded constants
|
||||
|| (BATTERY_CONFIG.voltageMeterSource == 2 && VOLTAGE_METERS[index].id >= 50)) {
|
||||
meterElement.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var template = $('#tab-power-templates .voltage-configuration');
|
||||
for (var index = 0; index < VOLTAGE_METER_CONFIGS.length; index++) {
|
||||
var destination = $('#voltage-meter-' + index + ' .configuration');
|
||||
var element = template.clone();
|
||||
|
||||
var attributeNames = ["vbatscale", "vbatresdivval", "vbatresdivmultiplier"];
|
||||
|
||||
var attributeNames = ["vbatscale", "vbatresdivval", "vbatresdivmultiplier"];
|
||||
for (let attributeName of attributeNames) {
|
||||
$(element).find('input[name="' + attributeName + '"]').attr('name', attributeName + '-' + index);
|
||||
}
|
||||
destination.append(element);
|
||||
|
||||
$('input[name="vbatscale-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatscale).attr('disabled','disabled');
|
||||
$('input[name="vbatresdivval-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatresdivval).attr('disabled','disabled');
|
||||
$('input[name="vbatresdivmultiplier-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatresdivmultiplier).attr('disabled','disabled');
|
||||
|
||||
$('input[name="vbatscale-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatscale);
|
||||
$('input[name="vbatresdivval-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatresdivval);
|
||||
$('input[name="vbatresdivmultiplier-' + index + '"]').val(VOLTAGE_METER_CONFIGS[index].vbatresdivmultiplier);
|
||||
}
|
||||
|
||||
// amperage meters
|
||||
|
||||
var template = $('#tab-power-templates .amperage-meters .amperage-meter');
|
||||
var destination = $('.tab-power .amperage-meters');
|
||||
|
||||
var destination = $('.tab-power .amperage-meters');
|
||||
|
||||
if (BATTERY_CONFIG.currentMeterSource == 0)
|
||||
$('.boxAmperageConfiguration').hide();
|
||||
|
||||
for (var index = 0; index < CURRENT_METERS.length; index++) {
|
||||
var meterElement = template.clone();
|
||||
$(meterElement).attr('id', 'amperage-meter-' + index);
|
||||
|
||||
|
||||
var message = chrome.i18n.getMessage('powerAmperageId' + CURRENT_METERS[index].id);
|
||||
$(meterElement).find('.label').text(message)
|
||||
destination.append(meterElement);
|
||||
|
||||
meterElement.hide();
|
||||
if ((BATTERY_CONFIG.currentMeterSource == 1 && CURRENT_METERS[index].id == 10) // TODO: replace constants
|
||||
|| (BATTERY_CONFIG.currentMeterSource == 2 && CURRENT_METERS[index].id == 80)
|
||||
|| (BATTERY_CONFIG.currentMeterSource == 3 && CURRENT_METERS[index].id >= 50 && CURRENT_METERS[index].id < 80)) {
|
||||
meterElement.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var template = $('#tab-power-templates .amperage-configuration');
|
||||
for (var index = 0; index < CURRENT_METER_CONFIGS.length; index++) {
|
||||
var destination = $('#amperage-meter-' + index + ' .configuration');
|
||||
var element = template.clone();
|
||||
|
||||
var attributeNames = ["amperagescale", "amperageoffset"];
|
||||
|
||||
var attributeNames = ["amperagescale", "amperageoffset"];
|
||||
for (let attributeName of attributeNames) {
|
||||
$(element).find('input[name="' + attributeName + '"]').attr('name', attributeName + '-' + index);
|
||||
}
|
||||
destination.append(element);
|
||||
|
||||
$('input[name="amperagescale-' + index + '"]').val(CURRENT_METER_CONFIGS[index].scale).attr('disabled','disabled');
|
||||
$('input[name="amperageoffset-' + index + '"]').val(CURRENT_METER_CONFIGS[index].offset).attr('disabled','disabled');
|
||||
|
||||
$('input[name="amperagescale-' + index + '"]').val(CURRENT_METER_CONFIGS[index].scale);
|
||||
$('input[name="amperageoffset-' + index + '"]').val(CURRENT_METER_CONFIGS[index].offset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// battery
|
||||
|
||||
var template = $('#tab-power-templates .battery-states .battery-state');
|
||||
|
||||
var template = $('#tab-power-templates .battery-state .battery-state');
|
||||
var destination = $('.tab-power .battery-state');
|
||||
var element = template.clone();
|
||||
$(element).find('.connection-state').attr('id', 'battery-connection-state');
|
||||
$(element).find('.voltage').attr('id', 'battery-voltage');
|
||||
$(element).find('.mah-drawn').attr('id', 'battery-mah-drawn');
|
||||
$(element).find('.amperage').attr('id', 'battery-amperage');
|
||||
|
||||
|
||||
destination.append(element.children());
|
||||
|
||||
var template = $('#tab-power-templates .battery-configuration');
|
||||
var destination = $('.tab-power .battery .configuration');
|
||||
var element = template.clone();
|
||||
destination.append(element);
|
||||
|
||||
|
||||
$('input[name="mincellvoltage"]').val(BATTERY_CONFIG.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(BATTERY_CONFIG.vbatmaxcellvoltage);
|
||||
$('input[name="warningcellvoltage"]').val(BATTERY_CONFIG.vbatwarningcellvoltage);
|
||||
$('input[name="capacity"]').val(BATTERY_CONFIG.capacity);
|
||||
|
||||
var haveFc = (semver.lt(CONFIG.apiVersion, "1.35.0") || (CONFIG.boardType == 0 || CONFIG.boardType == 2));
|
||||
|
||||
|
||||
var batteryMeterTypes = [
|
||||
'None',
|
||||
'Onboard ADC',
|
||||
];
|
||||
|
||||
|
||||
if (haveFc) {
|
||||
batteryMeterTypes.push('ESC Sensor');
|
||||
}
|
||||
|
@ -184,8 +203,8 @@ TABS.power.initialize = function (callback) {
|
|||
});
|
||||
currentMeterType_e.val(BATTERY_CONFIG.currentMeterSource).change();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function get_slow_data() {
|
||||
MSP.send_message(MSPCodes.MSP_VOLTAGE_METERS, false, false, function () {
|
||||
for (var i = 0; i < VOLTAGE_METERS.length; i++) {
|
||||
|
@ -202,11 +221,11 @@ TABS.power.initialize = function (callback) {
|
|||
element.text(chrome.i18n.getMessage('powerAmperageValue', [CURRENT_METERS[i].amperage.toFixed(2)]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BATTERY_STATE, false, false, function () {
|
||||
var elementPrefix = '#battery';
|
||||
var element;
|
||||
|
||||
|
||||
element = $(elementPrefix + '-connection-state .value');
|
||||
element.text(BATTERY_STATE.cellCount > 0 ? chrome.i18n.getMessage('powerBatteryConnectedValueYes', [BATTERY_STATE.cellCount]) : chrome.i18n.getMessage('powerBatteryConnectedValueNo'));
|
||||
element = $(elementPrefix + '-voltage .value');
|
||||
|
@ -218,41 +237,37 @@ TABS.power.initialize = function (callback) {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('a.save').click(function () {
|
||||
|
||||
/* FIXME update for api 1.33.0
|
||||
|
||||
for (var index = 0; index < VOLTAGE_METER_CONFIGS.length; index++) {
|
||||
VOLTAGE_METER_CONFIGS[index].vbatscale = parseInt($('input[name="vbatscale-' + index + '"]').val());
|
||||
VOLTAGE_METER_CONFIGS[index].vbatresdivval = parseInt($('input[name="vbatresdivval-' + index + '"]').val());
|
||||
VOLTAGE_METER_CONFIGS[index].vbatresdivmultiplier = parseInt($('input[name="vbatresdivmultiplier-' + index + '"]').val());
|
||||
}
|
||||
|
||||
|
||||
for (var index = 0; index < CURRENT_METER_CONFIGS.length; index++) {
|
||||
CURRENT_METER_CONFIGS[index].scale = parseInt($('input[name="amperagescale-' + index + '"]').val());
|
||||
CURRENT_METER_CONFIGS[index].offset = parseInt($('input[name="amperageoffset-' + index + '"]').val());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
BATTERY_CONFIG.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val());
|
||||
BATTERY_CONFIG.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val());
|
||||
BATTERY_CONFIG.vbatwarningcellvoltage = parseFloat($('input[name="warningcellvoltage"]').val());
|
||||
BATTERY_CONFIG.capacity = parseInt($('input[name="capacity"]').val());
|
||||
|
||||
/* FIXME update for api 1.33.0
|
||||
function save_battery_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_BATTERY_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BATTERY_CONFIG), false, save_voltage_config);
|
||||
}
|
||||
|
||||
function save_voltage_config() {
|
||||
MSP.sendVoltageMeterConfigs(save_amperage_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG), false, save_amperage_config);
|
||||
}
|
||||
|
||||
function save_amperage_config() {
|
||||
MSP.sendAmperageMeterConfigs(save_battery_config);
|
||||
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CURRENT_METER_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
*/
|
||||
|
||||
function save_battery_config() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_BATTERY_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_BATTERY_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, save_completed);
|
||||
}
|
||||
|
@ -268,13 +283,13 @@ TABS.power.initialize = function (callback) {
|
|||
|
||||
GUI.interval_add('setup_data_pull_slow', get_slow_data, 200, true); // 5hz
|
||||
}
|
||||
|
||||
|
||||
function process_html() {
|
||||
update_ui();
|
||||
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue