Skip to content

Commit

Permalink
new design
Browse files Browse the repository at this point in the history
  • Loading branch information
HThuren committed Sep 9, 2023
1 parent d31eee6 commit 2dac83a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -1730,14 +1730,14 @@ dialog {
border-radius: 3px;
color: #fff;
font-size: 10px;
&.search {
&.low {
background-color: #808080;
}
&.locked {
&.notReady {
background-color: #ffcc3f;
}
&.almostReady {
background-color: #ffa500;
&.locked {
background-color: #ff9500;
}
&.ready {
background-color: #008000;
Expand Down
40 changes: 23 additions & 17 deletions src/js/tabs/gps.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ gps.initialize = async function (callback) {
const qualityArray = ['gnssQualityNoSignal', 'gnssQualitySearching', 'gnssQualityAcquired', 'gnssQualityUnusable', 'gnssQualityLocked',
'gnssQualityFullyLocked', 'gnssQualityFullyLocked', 'gnssQualityFullyLocked'];
const usedArray = ['gnssUsedUnused', 'gnssUsedUsed'];
const healthyArray = ['gnssHealthyUnknown', 'gnssHealthyHealthy', 'gnssHealthyUnhealthy', 'gnssHealthyUnknown'];
// const healthyArray = ['gnssHealthyUnknown', 'gnssHealthyHealthy', 'gnssHealthyUnhealthy', 'gnssHealthyUnknown'];
let alt = FC.GPS_DATA.alt;

$('.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);

const gspUnitText = i18n.getMessage('gpsPositionUnit');
$('.GPS_info td.alt').text(`${alt} m`);
$('.GPS_info td.latLon a').prop('href', url).text(`${lat.toFixed(4)} / ${lon.toFixed(4)} ${gspUnitText}`);
$('.GPS_info td.latLon a').prop('href', url).text(`${lat.toFixed(6)} / ${lon.toFixed(6)} ${gspUnitText}`);
$('.GPS_info td.heading').text(`${magHeadingDeg.toFixed(4)} / ${gpsHeading.toFixed(4)} ${gspUnitText}`);
$('.GPS_info td.speed').text(`${FC.GPS_DATA.speed} cm/s`);
$('.GPS_info td.sats').text(FC.GPS_DATA.numSat);
Expand Down Expand Up @@ -250,6 +250,7 @@ gps.initialize = async function (callback) {

for (let i = 0; i < channels; i++) {
let rowContent = '';
let usedColor = '';
if (FC.GPS_DATA.chn[i] <= 6) {
rowContent += `<td>${gnssArray[FC.GPS_DATA.chn[i]]}</td>`;
} else {
Expand All @@ -266,44 +267,49 @@ gps.initialize = async function (callback) {

let quality = i18n.getMessage(qualityArray[FC.GPS_DATA.quality[i] & 0x7]);
let used = i18n.getMessage(usedArray[(FC.GPS_DATA.quality[i] & 0x8) >> 3]);
let healthy = i18n.getMessage(healthyArray[(FC.GPS_DATA.quality[i] & 0x30) >> 4]);
// let healthy = i18n.getMessage(healthyArray[(FC.GPS_DATA.quality[i] & 0x30) >> 4]);

// Add color to the text
// 1st column: unused = red, used = green
// 2nd column: unknown = red, non healthy = grey, healthy = orange
// 3d column: no signal = red, unusable = red, searching = grey, locked = yellow and fully locked = orange

if (used.startsWith(i18n.getMessage('gnssUsedUsed'))) {
used = `<span class="colorToggle ready">&nbsp${used}&nbsp</span>`;
} else {
used = `<span class="colorToggle">${used}</span>`;
}

// 2nd column: no signal = red, unusable = red, searching = red, locked = yellow and fully locked = green
if (quality.startsWith(i18n.getMessage('gnssQualityFullyLocked'))) {
quality = `<span class="colorToggle almostReady">${quality}</span>`;
usedColor = 'locked';
quality = `<span class="colorToggle ready">${quality}</span>`;
} else {
if (quality.startsWith(i18n.getMessage('gnssQualityLocked'))) {
usedColor = 'notReady';
quality = `<span class="colorToggle locked">${quality}</span>`;
} else {
usedColor = '';
if (quality.startsWith(i18n.getMessage('gnssQualitySearching'))) {
quality = `<span class="colorToggle search">${quality}</span>`;
quality = `<span class="colorToggle">${quality}</span>`;
} else {
quality = `<span class="colorToggle">${quality}</span>`;
}
}
}

// 1st column: unused = red, used = green
if (used.startsWith(i18n.getMessage('gnssUsedUsed'))) {
used = `<span class="colorToggle ready">&nbsp${used}&nbsp</span>`;
} else {
used = `<span class="colorToggle ${usedColor}">${used}</span>`;
}

/*
// 3d column: unknown = red, non healthy = grey, healthy = orange
if (healthy.startsWith(i18n.getMessage('gnssHealthyHealthy'))) {
healthy = `<span class="colorToggle almostReady">${healthy}</span>`;
healthy = `<span class="colorToggle notReady">${healthy}</span>`;
} else {
if (healthy.startsWith(i18n.getMessage('gnssHealthyUnhealthy'))) {
healthy = `<span class="colorToggle search">${healthy}</span>`;
} else {
healthy = `<span class="colorToggle">${healthy}</span>`;
}
}

rowContent += `<td>${used} | ${healthy} | ${quality}</td>`;
*/

rowContent += `<td>${used} | ${quality}</td>`;
}
eSsTable.append(`<tr>${rowContent}</tr>`);
}
Expand Down

0 comments on commit 2dac83a

Please sign in to comment.