Skip to content

Commit

Permalink
Reserve statusbar for something else
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Sep 18, 2024
1 parent 8f6ffd5 commit 45b59d2
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 63 deletions.
3 changes: 0 additions & 3 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,6 @@
"versionLabelFirmware": {
"message": "Firmware"
},
"versionLabelConnection": {
"message": "ISP"
},
"versionLabelConfigurator": {
"message": "Configurator"
},
Expand Down
25 changes: 0 additions & 25 deletions src/components/status-bar/ConnectionStatus.vue

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/status-bar/StatusBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
:value="cpuLoad"
unit="%"
/>
<ConnectionStatus
:network-status="networkStatus"
/>
<StatusBarVersion
:configurator-version="configuratorVersion"
:firmware-version="firmwareVersion"
Expand All @@ -36,14 +33,12 @@
<script>
import StatusBarVersion from "./StatusBarVersion.vue";
import ReadingStat from "./ReadingStat.vue";
import ConnectionStatus from "./ConnectionStatus.vue";
import PortUtilization from "./PortUtilization.vue";
export default {
components: {
PortUtilization,
ReadingStat,
ConnectionStatus,
StatusBarVersion,
},
props: {
Expand Down Expand Up @@ -72,11 +67,6 @@ export default {
default: 0,
},
networkStatus: {
type: String,
default: "",
},
configuratorVersion: {
type: String,
default: "",
Expand Down
2 changes: 0 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@
:cycle-time="FC.CONFIG.cycleTime"
:cpu-load="FC.CONFIG.cpuload"

:network-status="CONFIGURATOR.networkStatus"

:configurator-version="CONFIGURATOR.getDisplayVersion()"
:firmware-version="FC.CONFIG.flightControllerVersion"
:firmware-id="FC.CONFIG.flightControllerIdentifier"
Expand Down
1 change: 0 additions & 1 deletion src/js/data_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const CONFIGURATOR = {

connectionValid: false,
connectionValidCliOnly: false,
networkStatus: 'UNKNOWN',
virtualMode: false,
virtualApiVersion: '0.0.1',
cliActive: false,
Expand Down
9 changes: 0 additions & 9 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ function startProcess() {
gui_log(i18n.getMessage('infoVersionOs', { operatingSystem: GUI.operating_system }));
gui_log(i18n.getMessage('infoVersionConfigurator', { configuratorVersion: CONFIGURATOR.getDisplayVersion() }));

if (navigator.connection) {
console.log(`[ISP] Network connection type: ${navigator.connection.type}`);
console.log(`[ISP] Effective network type: ${navigator.connection.effectiveType}`);
console.log(`[ISP] Downlink Speed: ${navigator.connection.downlink}Mb/s`);
console.log(`[ISP] Round Trip Time: ${navigator.connection.rtt}ms`);
} else {
console.log(`[ISP] Navigator Connection API not supported`);
}

$('.connect_b a.connect').removeClass('disabled');
// with Vue reactive system we don't need to call these,
// our view is reactive to model changes
Expand Down
14 changes: 1 addition & 13 deletions src/js/utils/connection.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
import { get as getConfig } from "../ConfigStorage";
import CONFIGURATOR from "../data_storage";

export function ispConnected() {
const connected = navigator.onLine;
const isMetered = getConfig('meteredConnection').meteredConnection;

// navigator.connection is not available
if (!navigator.connection) {
return connected && !isMetered;
}

// navigator.connection is available
const type = navigator.connection.effectiveType;
const downlink = navigator.connection.downlink;
const rtt = navigator.connection.rtt;

if (isMetered || type === 'none' || !connected) {
CONFIGURATOR.networkStatus = 'Offline';
if (isMetered || navigator.connection.effectiveType === 'none' || !connected) {
return false;
} else if (type === 'slow-2g' || type === '2g' || downlink < 0.115 || rtt > 1000) {
CONFIGURATOR.networkStatus = 'Slow';
return true;
}

CONFIGURATOR.networkStatus = 'Online';
return true;
}

0 comments on commit 45b59d2

Please sign in to comment.