Color for vtx ready status (#3422)

* VTX ready change if device get ready

* minor change

* removed class from translated string

* Use of css way

* Now use CSS style

* reduce size of main.less

* xVx
master
HThuren 2023-04-27 13:23:50 +02:00 committed by GitHub
parent 8d5533bbd0
commit b523f0a0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 68 additions and 56 deletions

View File

@ -2560,10 +2560,10 @@
"message": "3D Fix:"
},
"gpsFixTrue": {
"message": "<span class=\"fixtrue\">True</span>"
"message": "True"
},
"gpsFixFalse": {
"message": "<span class=\"fixfalse\">False</span>"
"message": "False"
},
"gpsAltitude": {
"message": "Altitude:"
@ -6139,6 +6139,14 @@
"message": "You can select here the frequency for your VTX if it is supported",
"description": "Help text for the frequency field of the VTX tab"
},
"vtxReadyTrue": {
"message": "True",
"description": "vtx device are ready"
},
"vtxReadyFalse": {
"message": "False",
"description": "vtx device are not ready"
},
"vtxDeviceReady": {
"message": "Device ready",
"description": "Text of one of the fields of the VTX tab"

View File

@ -1715,19 +1715,15 @@ dialog {
height: auto;
}
}
.fixtrue {
background-color: #56ac1d;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
}
.fixfalse {
background-color: #e60000;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
.colorToggle {
background-color: #e60000;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
&.ready {
background-color: #56ac1d;
}
}
.buildInfoBtn {
position: relative;

View File

@ -192,7 +192,9 @@ gps.initialize = async function (callback) {
const healthyArray = ['gnssHealthyUnknown', 'gnssHealthyHealthy', 'gnssHealthyUnhealthy', 'gnssHealthyUnknown'];
let alt = FC.GPS_DATA.alt;
$('.GPS_info td.fix').html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
$('.GPS_info span.colorToggle').text(FC.GPS_DATA.fix ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
$('.GPS_info span.colorToggle').toggleClass('ready', FC.GPS_DATA.fix != 0);
$('.GPS_info td.alt').text(`${alt} m`);
$('.GPS_info td.lat a').prop('href', url).text(`${lat.toFixed(4)} deg`);
$('.GPS_info td.lon a').prop('href', url).text(`${lon.toFixed(4)} deg`);

View File

@ -192,7 +192,7 @@ setup.initialize = function (callback) {
rssi_e = $('.rssi'),
cputemp_e = $('.cpu-temp'),
arming_disable_flags_e = $('.arming-disable-flags'),
gpsFix_e = $('.gpsFix'),
gpsFix_e = $('.GPS_info span.colorToggle'),
gpsSats_e = $('.gpsSats'),
gpsLat_e = $('.gpsLat'),
gpsLon_e = $('.gpsLon'),
@ -428,7 +428,9 @@ setup.initialize = function (callback) {
// GPS info is acquired in the background using update_live_status() in serial_backend.js
gpsFix_e.html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
gpsFix_e.text(FC.GPS_DATA.fix ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
gpsFix_e.toggleClass('ready', FC.GPS_DATA.fix != 0);
gpsSats_e.text(FC.GPS_DATA.numSat);
gpsLat_e.text(`${(FC.GPS_DATA.lat / 10000000).toFixed(4)} deg`);
gpsLon_e.text(`${(FC.GPS_DATA.lon / 10000000).toFixed(4)} deg`);

View File

@ -40,12 +40,22 @@ vtx.isVtxDeviceStatusNotReady = function()
vtx.updateVtxDeviceStatus = function()
{
MSP.send_message(MSPCodes.MSP2_GET_VTX_DEVICE_STATUS, false, false, vtxDeviceStatusReceived);
function vtxDeviceStatusReceived()
{
$("#vtx_type_description").text(TABS.vtx.getVtxTypeString());
}
function vtxDeviceStatusReady()
{
const vtxReady_e = $('.VTX_info span.colorToggle');
// update device ready state
vtxReady_e.text(FC.VTX_CONFIG.vtx_device_ready ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
vtxReady_e.toggleClass('ready', FC.VTX_CONFIG.vtx_device_ready);
}
MSP.send_message(MSPCodes.MSP2_GET_VTX_DEVICE_STATUS, false, false, vtxDeviceStatusReceived);
MSP.send_message(MSPCodes.MSP_VTX_CONFIG, false, false, vtxDeviceStatusReady);
};
vtx.getVtxTypeString = function()
@ -205,7 +215,6 @@ vtx.initialize = function (callback) {
// Bands and channels
FC.VTX_CONFIG.vtx_table_bands = vtxConfig.vtx_table.bands_list.length;
let maxChannels = 0;
TABS.vtx.VTXTABLE_BAND_LIST = [];
for (let i = 1; i <= FC.VTX_CONFIG.vtx_table_bands; i++) {
@ -290,14 +299,14 @@ vtx.initialize = function (callback) {
$("#vtx_low_power_disarm").val(FC.VTX_CONFIG.vtx_low_power_disarm);
// Values of the current values
const yesMessage = i18n.getMessage("yes");
const noMessage = i18n.getMessage("no");
const vtxReady_e = $('.VTX_info span.colorToggle');
vtxReady_e.text(FC.VTX_CONFIG.vtx_device_ready ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
vtxReady_e.toggleClass('ready', FC.VTX_CONFIG.vtx_device_ready);
$("#vtx_device_ready_description").text(FC.VTX_CONFIG.vtx_device_ready ? yesMessage : noMessage);
$("#vtx_type_description").text(self.getVtxTypeString());
$("#vtx_channel_description").text(FC.VTX_CONFIG.vtx_channel);
$("#vtx_frequency_description").text(FC.VTX_CONFIG.vtx_frequency);
$("#vtx_pit_mode_description").text(FC.VTX_CONFIG.vtx_pit_mode ? yesMessage : noMessage);
$("#vtx_pit_mode_description").text(FC.VTX_CONFIG.vtx_pit_mode ? i18n.getMessage("Yes") : i18n.getMessage("No"));
$("#vtx_pit_mode_frequency_description").text(FC.VTX_CONFIG.vtx_pit_mode_frequency);
$("#vtx_low_power_disarm_description").text(i18n.getMessage(`vtxLowPowerDisarmOption_${FC.VTX_CONFIG.vtx_low_power_disarm}`));

View File

@ -7,7 +7,6 @@
<div class="grid-row">
<div class="grid-col col5">
<div class="gui_box grey gps">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationGPS"></div>
@ -77,7 +76,6 @@
</div>
<div class="grid-col col7">
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="gpsHead"></div>
@ -85,8 +83,8 @@
<div class="spacer_box GPS_info">
<table class="cf_table">
<tr>
<td style="width: 85px" i18n="gps3dFix"></td>
<td class="fix" i18n="gpsFixFalse"></td>
<td i18n="gps3dFix"></td>
<td><span class="colorToggle" i18n="gpsFixFalse"></span></td>
</tr>
<tr>
<td i18n="gpsAltitude"></td>

View File

@ -116,12 +116,12 @@
<div class="spacer_box_title" i18n="initialSetupGPSHead"></div>
<div class="helpicon cf_tip" i18n_title="initialSetupGPSHeadHelp"></div>
</div>
<div class="spacer_box">
<div class="spacer_box GPS_info">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
<tbody>
<tr>
<td i18n="gps3dFix"></td>
<td class="gpsFix"></td>
<td><span class="colorToggle" i18n="gpsFixFalse"></span></td>
</tr>
<tr>
<td i18n="gpsSats"></td>

View File

@ -125,50 +125,47 @@
<div class="spacer_box_title" i18n="vtxActualState"></div>
</div>
<div class="spacer_box">
<table class="cf_table">
<tbody>
<div class="spacer_box VTX_info">
<table class="cf_table">
<tbody>
<tr>
<td class="description_text" i18n="vtxDeviceReady"></td>
<td><span class="colorToggle" i18n="vtxReadyFalse"></span></td>
</tr>
<tr class="description vtx_type">
<td class="description_text" i18n="vtxType"></td>
<td class="description_value" id="vtx_type_description"></td>
</tr>
<tr class="description vtx_device_ready">
<td class="description_text" i18n="vtxDeviceReady"></td>
<td class="description_value" id="vtx_device_ready_description"></td>
</tr>
<tr class="description vtx_band">
<tr class="description vtx_band">
<td class="description_text" i18n="vtxBand"></td>
<td class="description_value" id="vtx_band_description"></td>
</tr>
<tr class="description vtx_channel">
</tr>
<tr class="description vtx_channel">
<td class="description_text" i18n="vtxChannel"></td>
<td class="description_value" id="vtx_channel_description"></td>
</tr>
</tr>
<tr class="description vtx_frequency">
<td class="description_text" i18n="vtxFrequency"></td>
<td class="description_value" id="vtx_frequency_description"></td>
</tr>
<tr class="description vtx_power">
</tr>
<tr class="description vtx_power">
<td class="description_text" i18n="vtxPower"></td>
<td class="description_value" id="vtx_power_description"></td>
</tr>
<tr class="description pit_mode">
</tr>
<tr class="description pit_mode">
<td class="description_text" i18n="vtxPitMode"></td>
<td class="description_value" id="vtx_pit_mode_description"></td>
</tr>
<tr class="description vtx_pit_mode">
</tr>
<tr class="description vtx_pit_mode">
<td class="description_text" i18n="vtxPitModeFrequency"></td>
<td class="description_value" id="vtx_pit_mode_frequency_description"></td>
</tr>
<tr class="description vtx_low_power_disarm">
</tr>
<tr class="description vtx_low_power_disarm">
<td class="description_text" i18n="vtxLowPowerDisarm"></td>
<td class="description_value" id="vtx_low_power_disarm_description"></td>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
</div>
</div>
</div>