Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #323 from dan557/development
Browse files Browse the repository at this point in the history
Add Current and Voltage readout on configuration tab
  • Loading branch information
hydra committed Feb 5, 2016
2 parents e2c4a62 + 9453528 commit ebd77db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@
"configurationBatteryVoltage": {
"message": "Battery Voltage"
},
"configurationBatteryCurrent": {
"message": "Battery Current"
},
"configurationBatteryMinimum": {
"message": "Minimum Cell Voltage"
},
Expand Down
9 changes: 9 additions & 0 deletions tabs/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@
i18n="configurationBatteryScale"></span>
</label>
</div>
<div class="number">
<label> <input type="text" name="batteryvoltage" readonly class="disabled" /> <span
i18n="configurationBatteryVoltage"></span>
</label>
</div>
</div>
</div>
<div class="gui_box grey">
Expand Down Expand Up @@ -275,6 +280,10 @@
i18n="configurationCurrentOffset"></span>
</label>
</div>
<div class="number">
<label> <input type="text" name="batterycurrent" readonly class="disabled" /> <span
i18n="configurationBatteryCurrent"></span>
</div>
<div class="checkbox">
<div class="numberspacer">
<input type="checkbox" name="multiwiicurrentoutput" class="toggle" />
Expand Down
11 changes: 9 additions & 2 deletions tabs/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
next_callback();
}
}
//Update Analog/Battery Data
function load_analog() {
MSP.send_message(MSP_codes.MSP_ANALOG, false, false, function () {
$('input[name="batteryvoltage"]').val([ANALOG.voltage.toFixed(1)]);
$('input[name="batterycurrent"]').val([ANALOG.amperage.toFixed(2)]);
});
}

function load_html() {
$('#content').load("./tabs/configuration.html", process_html);
Expand Down Expand Up @@ -381,7 +388,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('input[name="midthrottle"]').val(MISC.midrc);
$('input[name="maxthrottle"]').val(MISC.maxthrottle);
$('input[name="mincommand"]').val(MISC.mincommand);

// fill battery
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
Expand Down Expand Up @@ -581,7 +588,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
GUI.interval_add('status_pull', function status_pull() {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);

GUI.interval_add('config_load_analog', load_analog, 250, true); // 4 fps
GUI.content_ready(callback);
}
};
Expand Down

0 comments on commit ebd77db

Please sign in to comment.