1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 06:15:13 +03:00

Renamed global dataflash components, fixed detection for global dataflash display.

This commit is contained in:
NightHawk32 2015-11-24 18:01:56 -05:00
parent 0aefcd5959
commit 6157c875f9
3 changed files with 55 additions and 55 deletions

View file

@ -250,21 +250,12 @@ function onConnect() {
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active'); $('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
$('div#connectbutton a.connect').addClass('active'); $('div#connectbutton a.connect').addClass('active');
$('#tabs ul.mode-disconnected').hide(); $('#tabs ul.mode-disconnected').hide();
$('#tabs ul.mode-connected').show(); $('#tabs ul.mode-connected').show();
var sensor_state = $('#sensor-status');
sensor_state.show();
var port_picker = $('#portsinput');
port_picker.hide();
var dataflash = $('#dataflash_wrapper');
dataflash.show();
MSP.send_message(MSP_codes.MSP_STATUS, false, false); MSP.send_message(MSP_codes.MSP_STATUS, false, false);
// TEST code for dataflash status in header // TEST code for dataflash status in header
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false); //MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, update_html());
function formatFilesize(bytes) { function formatFilesize(bytes) {
if (bytes < 1024) { if (bytes < 1024) {
@ -281,34 +272,45 @@ function onConnect() {
return megabytes.toFixed(1) + "MB"; return megabytes.toFixed(1) + "MB";
} }
function update_html() { function update_dataflash_global() {
if (DATAFLASH.usedSize > 0) { var supportsDataflash = DATAFLASH.totalSize > 0;
$(".dataflash-used").css({ if (supportsDataflash){
width: (DATAFLASH.usedSize / DATAFLASH.totalSize * 100) + "%",
display: 'block'
});
$(".dataflash-used div").text('Dataflash: used ' + formatFilesize(DATAFLASH.usedSize));
} else {
$(".dataflash-used").css({
display: 'none'
});
}
if (DATAFLASH.totalSize - DATAFLASH.usedSize > 0) { $(".noflash_global").css({
$(".dataflash-free").css({ display: 'none'
width: ((DATAFLASH.totalSize - DATAFLASH.usedSize) / DATAFLASH.totalSize * 100) + "%", });
display: 'block'
}); $(".dataflash-contents_global").css({
$(".dataflash-free div").text('Dataflash: free ' + formatFilesize(DATAFLASH.totalSize - DATAFLASH.usedSize)); display: 'block'
});
$(".dataflash-free_global").css({
width: (100-(DATAFLASH.totalSize - DATAFLASH.usedSize) / DATAFLASH.totalSize * 100) + "%",
display: 'block'
});
$(".dataflash-free_global div").text('Dataflash: free ' + formatFilesize(DATAFLASH.totalSize - DATAFLASH.usedSize));
} else { } else {
$(".dataflash-free").css({ $(".noflash_global").css({
display: 'none' display: 'block'
}); });
}
$(".dataflash-contents_global").css({
display: 'none'
});
}
} }
update_html();
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, update_dataflash_global);
var sensor_state = $('#sensor-status');
sensor_state.show();
var port_picker = $('#portsinput');
port_picker.hide();
var dataflash = $('#dataflash_wrapper_global');
dataflash.show();
@ -335,7 +337,7 @@ function onClosed(result) {
var port_picker = $('#portsinput'); var port_picker = $('#portsinput');
port_picker.show(); port_picker.show();
var dataflash = $('#dataflash_wrapper'); var dataflash = $('#dataflash_wrapper_global');
dataflash.hide(); dataflash.hide();
} }

View file

@ -1347,7 +1347,7 @@ dialog {
} }
/* Dataflash element styling*/ /* Dataflash element styling*/
#dataflash_wrapper { #dataflash_wrapper_global {
color:white; color:white;
font-size:10px; font-size:10px;
margin-top: 20px; margin-top: 20px;
@ -1376,7 +1376,7 @@ dialog {
line-height: 12px; line-height: 12px;
} }
.dataflash-contents { .dataflash-contents_global {
margin-top: 18px; margin-top: 18px;
border: 1px solid #4A4A4A; border: 1px solid #4A4A4A;
background-color: #4A4A4A; background-color: #4A4A4A;
@ -1390,11 +1390,17 @@ dialog {
} }
.dataflash-contents .notsupported { .dataflash-free_global {
background-color: #59AA29;
border-radius: 4px;
}
.dataflash-contents_global .notsupported_global {
display: none; display: none;
} }
.dataflash-contents li { .dataflash-contents_global li {
height: 5px; height: 5px;
position: relative; position: relative;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.20); box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.20);
@ -1402,7 +1408,7 @@ dialog {
} }
.dataflash-contents li div { .dataflash-contents_global li div {
position: absolute; position: absolute;
top: -18px; top: -18px;
margin-top: 0px; margin-top: 0px;
@ -1414,12 +1420,7 @@ dialog {
color:silver; color:silver;
} }
.dataflash-used { .dataflash-contents_global progress::-webkit-progress-bar {
background-color: #59AA29;
border-radius: 2px;
}
.dataflash-contents progress::-webkit-progress-bar {
height: 8px; height: 8px;
background-color: #eee; background-color: #eee;
} }
@ -1428,7 +1429,7 @@ dialog {
background-color: #bcf; background-color: #bcf;
} }
.noflash { .noflash_gloabal {
display:none; display:none;
color: #4f4f4f; color: #4f4f4f;
text-align: center; text-align: center;

View file

@ -126,13 +126,10 @@
</div> </div>
</div> </div>
<div class="header-wrapper"> <div class="header-wrapper">
<div id="dataflash_wrapper"> <div id="dataflash_wrapper_global">
<div class="noflash" align="center">No dataflash <br>chip found</div> <div class="noflash_global" align="center">No dataflash <br>chip found</div>
<ul class="dataflash-contents"> <ul class="dataflash-contents_global">
<li class="dataflash-used"> <li class="dataflash-free_global">
<div class="legend">Dataflash: used space</div>
</li>
<li class="dataflash-free">
<div class="legend">Dataflash: free space</div> <div class="legend">Dataflash: free space</div>
</li> </li>
</ul> </ul>