Skip to content

Commit

Permalink
Add network speed to status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Sep 17, 2024
1 parent 0aebfdd commit e3cb5b3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,9 @@
"versionLabelFirmware": {
"message": "Firmware"
},
"versionLabelConnection": {
"message": "ISP"
},
"versionLabelConfigurator": {
"message": "Configurator"
},
Expand Down
25 changes: 25 additions & 0 deletions src/components/status-bar/ConnectionStatus.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<div class="connection">
{{ $t("versionLabelConnection") }}: {{ networkSpeed }} Mb/s
</div>
</template>

<script>
export default {
props: {
networkSpeed: {
type: Number,
default: 0,
},
},
};
</script>

<style>
.connection {
margin: 0;
padding: 0;
border: 0;
margin-left: auto;
}
</style>
10 changes: 10 additions & 0 deletions src/components/status-bar/StatusBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
:value="cpuLoad"
unit="%"
/>
<ConnectionStatus
:network-speed="networkSpeed"
/>
<StatusBarVersion
:configurator-version="configuratorVersion"
:firmware-version="firmwareVersion"
Expand All @@ -33,12 +36,14 @@
<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 @@ -67,6 +72,11 @@ export default {
default: 0,
},
networkSpeed: {
type: Number,
default: 0,
},
configuratorVersion: {
type: String,
default: "",
Expand Down
2 changes: 2 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
:cycle-time="FC.CONFIG.cycleTime"
:cpu-load="FC.CONFIG.cpuload"

:network-speed="CONFIGURATOR.networkSpeed"

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

connectionValid: false,
connectionValidCliOnly: false,
networkSpeed: 0,
virtualMode: false,
virtualApiVersion: '0.0.1',
cliActive: false,
Expand Down
3 changes: 3 additions & 0 deletions src/js/utils/connection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { get as getConfig } from "../ConfigStorage";
import CONFIGURATOR from "../data_storage";

export function ispConnected() {

Expand All @@ -14,6 +15,8 @@ export function ispConnected() {
const rtt = navigator.connection.rtt;
const logHead = '[ISP] ';

CONFIGURATOR.networkSpeed = downlink;

if (isMetered) {
console.log(`${logHead}Metered connection is enabled`);
return false;
Expand Down

0 comments on commit e3cb5b3

Please sign in to comment.