Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color for vtx ready status #3422

Merged
merged 7 commits into from Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions locales/en/messages.json
Expand Up @@ -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:"
Expand Down Expand Up @@ -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"
Expand Down
40 changes: 27 additions & 13 deletions src/css/main.less
Expand Up @@ -1715,19 +1715,33 @@ 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;
.fix {
background-color: #e60000;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
}
.fix.active {
background-color: #56ac1d;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
}
.vtx_device_ready {
background-color: #e60000;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
}
.vtx_device_ready.active {
background-color: #56ac1d;
padding: 2px 5px;
border-radius: 3px;
color: #fff;
font-size: 10px;
HThuren marked this conversation as resolved.
Show resolved Hide resolved
}
.buildInfoBtn {
position: relative;
Expand Down
4 changes: 3 additions & 1 deletion src/js/tabs/gps.js
Expand Up @@ -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.fix').text((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
HThuren marked this conversation as resolved.
Show resolved Hide resolved
$('.GPS_info span.fix').toggleClass('active', FC.GPS_DATA.fix != 0);
HThuren marked this conversation as resolved.
Show resolved Hide resolved

$('.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`);
Expand Down
6 changes: 4 additions & 2 deletions src/js/tabs/setup.js
Expand Up @@ -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.fix'),
gpsSats_e = $('.gpsSats'),
gpsLat_e = $('.gpsLat'),
gpsLon_e = $('.gpsLon'),
Expand Down Expand Up @@ -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'));
HThuren marked this conversation as resolved.
Show resolved Hide resolved
gpsFix_e.toggleClass("active", FC.GPS_DATA.fix != 0);
HThuren marked this conversation as resolved.
Show resolved Hide resolved

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`);
Expand Down
23 changes: 16 additions & 7 deletions src/js/tabs/vtx.js
Expand Up @@ -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.vtx_device_ready');

// update device ready state
vtxReady_e.text((FC.VTX_CONFIG.vtx_device_ready) ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
HThuren marked this conversation as resolved.
Show resolved Hide resolved
vtxReady_e.toggleClass('active', 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()
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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.vtx_device_ready');
vtxReady_e.text((FC.VTX_CONFIG.vtx_device_ready) ? i18n.getMessage('vtxReadyTrue') : i18n.getMessage('vtxReadyFalse'));
HThuren marked this conversation as resolved.
Show resolved Hide resolved
vtxReady_e.toggleClass("active", 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}`));

Expand Down
6 changes: 2 additions & 4 deletions src/tabs/gps.html
Expand Up @@ -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>
Expand Down Expand Up @@ -77,16 +76,15 @@
</div>

<div class="grid-col col7">

<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="gpsHead"></div>
</div>
<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="fix" i18n="gpsFixFalse"></span></td>
</tr>
<tr>
<td i18n="gpsAltitude"></td>
Expand Down
4 changes: 2 additions & 2 deletions src/tabs/setup.html
Expand Up @@ -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="fix" i18n="gpsFixFalse"></span></td>
</tr>
<tr>
<td i18n="gpsSats"></td>
Expand Down
47 changes: 22 additions & 25 deletions src/tabs/vtx.html
Expand Up @@ -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="vtx_device_ready" 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>
Expand Down