Skip to content

Commit c81ddfb

Browse files
committed
Merge remote-tracking branch 'juergen/ethernet-support'
2 parents 708631e + aaf630e commit c81ddfb

28 files changed

+15841
-16473
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ssl_certs/cacert.pem
2222
.DS_Store
2323
.aid
2424
/scripts/__pycache__
25-
/site
25+
/site
26+
.DS_Store

docs/buildprocess.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Customize the settings as you see fit. A value of 0 will disable the specified f
4040
-D FT_DOWNLOAD_FIRMWARE=1
4141
-D FT_SLEEP=1
4242
-D FT_BATTERY=1
43+
-D FT_ETHERNET=1
4344
```
4445

4546
| Flag | Description |
@@ -51,6 +52,7 @@ Customize the settings as you see fit. A value of 0 will disable the specified f
5152
| FT_DOWNLOAD_FIRMWARE | Controls whether the firmware download feature is enabled. Disable this if you won't firmware pulled from a server. |
5253
| FT_SLEEP | Controls whether the deep sleep feature is enabled. Disable this if your device is not battery operated or you don't need to place it in deep sleep to save energy. |
5354
| FT_BATTERY | Controls whether the battery state of charge shall be reported to the clients. Disable this if your device is not battery operated. |
55+
| FT_ETHERNET | Controls whether an ethernet interface will be used. Disable this if your device has no ethernet interface connected. |
5456

5557
In addition custom features might be added or removed at runtime. See [Custom Features](statefulservice.md#custom-features) on how to use this in your application.
5658

docs/stores.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ It exposes the following properties you can subscribe to:
6666
| `$telemetry.download_ota.status` | `String` | Status of OTA |
6767
| `$telemetry.download_ota.progress` | `Number` | Progress of OTA |
6868
| `$telemetry.download_ota.error` | `String` | Error Message of OTA |
69+
| `$telemetry.ethernet.connected` | `Boolean` | Connection status of the ethernet interface |
6970

7071
## Analytics
7172

features.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ build_flags =
99
; -D FT_BATTERY=0 ; 🌙 defined in specific firmwares
1010
-D FT_ANALYTICS=1
1111
-D FT_COREDUMP=1
12+
-D FT_ETHERNET=1

interface/package-lock.json

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"svelte-check": "^4.2.2",
3232
"svelte-focus-trap": "^1.2.0",
3333
"tailwindcss": "^4.1.11",
34+
"terser": "^5.44.0",
3435
"tslib": "^2.8.1",
3536
"typescript": "^5.8.3",
3637
"unplugin-icons": "^22.1.0",
@@ -48,4 +49,4 @@
4849
"svelte-dnd-action": "^0.9.65",
4950
"svelte-modals": "^2.0.1"
5051
}
51-
}
52+
}

interface/src/lib/stores/telemetry.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { writable } from 'svelte/store';
22
import type { RSSI } from '../types/models';
33
import type { Battery } from '../types/models';
44
import type { DownloadOTA } from '../types/models';
5+
import type { Ethernet } from '../types/models';
56

67
let telemetry_data = {
78
rssi: {
@@ -23,6 +24,9 @@ let telemetry_data = {
2324
status: 'none',
2425
progress: 0,
2526
error: ''
27+
},
28+
ethernet: {
29+
connected: false
2630
}
2731
};
2832

@@ -57,6 +61,12 @@ function createTelemetry() {
5761
...telemetry_data,
5862
download_ota: { status: data.status, progress: data.progress, error: data.error }
5963
}));
64+
},
65+
setEthernet: (data: Ethernet) => {
66+
update((telemetry_data) => ({
67+
...telemetry_data,
68+
ethernet: { connected: data.connected }
69+
}));
6070
}
6171
};
6272
}

interface/src/lib/types/models.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,29 @@ export type MQTTSettings = {
173173
clean_session: boolean;
174174
message_interval_ms: number;
175175
};
176+
177+
178+
export type Ethernet = {
179+
connected: boolean;
180+
};
181+
182+
export type EthernetStatus = {
183+
connected: boolean;
184+
local_ip: string;
185+
mac_address: string;
186+
subnet_mask: string;
187+
gateway_ip?: string;
188+
dns_ip_1?: string;
189+
dns_ip_2?: string;
190+
link_speed?: number;
191+
};
192+
193+
export type EthernetSettings = {
194+
hostname: string;
195+
static_ip_config: boolean;
196+
local_ip?: string;
197+
subnet_mask?: string;
198+
gateway_ip?: string;
199+
dns_ip_1?: string;
200+
dns_ip_2?: string;
201+
};

interface/src/routes/+layout.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import type { Battery } from '$lib/types/models';
2222
import type { DownloadOTA } from '$lib/types/models';
2323
import Monitor from './moonbase/monitor/Monitor.svelte'; // 🌙
24+
import type { Ethernet } from '$lib/types/models';
2425
2526
interface Props {
2627
data: LayoutData;
@@ -61,6 +62,7 @@
6162
if (page.data.features.analytics) socket.on('analytics', handleAnalytics);
6263
if (page.data.features.battery) socket.on('battery', handleBattery);
6364
if (page.data.features.download_firmware) socket.on('otastatus', handleOAT);
65+
if (page.data.features.ethernet) socket.on('ethernet', handleEthernet);
6466
};
6567
6668
const removeEventListeners = () => {
@@ -71,6 +73,7 @@
7173
socket.off('notification', handleNotification);
7274
socket.off('battery', handleBattery);
7375
socket.off('otastatus', handleOAT);
76+
socket.off('ethernet', handleEthernet);
7477
};
7578
7679
async function validateUser(userdata: userProfile) {
@@ -141,6 +144,10 @@
141144
142145
const handleOAT = (data: DownloadOTA) => telemetry.setDownloadOTA(data);
143146
147+
const handleEthernet = (data: Ethernet) => {
148+
telemetry.setEthernet(data);
149+
};
150+
144151
let menuOpen = $state(false);
145152
146153
// 🌙
File renamed without changes.

0 commit comments

Comments
 (0)