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

Flasher and hierarchical config manager #110

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
f48553f
Add button to clear device list
trelbutate Dec 16, 2022
7fcba60
Setup page start
trelbutate Dec 16, 2022
a158178
Update PageNav to take pages as parameters
trelbutate Dec 16, 2022
ec9a1b3
Add device list to setup page
trelbutate Dec 17, 2022
fa981c2
Add config store; make config page use either device config or template
trelbutate Dec 18, 2022
ddb82ab
Add barebones flashing page
trelbutate Dec 18, 2022
4822684
Start on flashing
trelbutate Dec 18, 2022
faf3bf5
Merge master
trelbutate Feb 5, 2023
aeba42b
Fix sidebar
trelbutate Feb 5, 2023
6a4c23b
Make everything working again
trelbutate Feb 6, 2023
6a1a5a1
alright
trelbutate Feb 23, 2023
289bf7b
New page layout and stuff
trelbutate Feb 23, 2023
3f4094e
Config selection button
trelbutate Feb 24, 2023
3af5499
Add presets
trelbutate Feb 24, 2023
487017a
Config stuff
trelbutate Feb 24, 2023
a06a9f6
Make config page use preset
trelbutate Feb 24, 2023
654afde
fix qr dialog select
sachaw Feb 25, 2023
d8006f5
Better map markers
sachaw Feb 25, 2023
5649074
Fix full height
sachaw Feb 25, 2023
674881c
add overflow to sidebar
sachaw Feb 27, 2023
7b52987
Quick and dirty flasher
trelbutate Mar 1, 2023
af35dca
Flashing works now
trelbutate Mar 1, 2023
dd98112
Tree structure for presets
trelbutate Mar 6, 2023
a2aebc8
Handle config selection
trelbutate Mar 11, 2023
45799d8
Presets can now be deleted
trelbutate Mar 11, 2023
40f8ccc
Make config presets renamable
trelbutate Mar 11, 2023
0501276
Add override button to form
trelbutate Mar 12, 2023
610bce5
Disable overrides for root config
trelbutate Mar 12, 2023
32cbd88
Save and restore presets to/from local storage
trelbutate Mar 12, 2023
a5e053e
Export config
trelbutate Mar 15, 2023
4b1c565
Quick and dirty auto-connect existing devices
trelbutate Mar 18, 2023
60ccfca
Serial flashing
trelbutate Mar 20, 2023
bdacb1f
Start on cancelling flashing; however, it doesn't work yet
trelbutate Mar 20, 2023
591ad3d
Fix override values not being restored from save
trelbutate Mar 21, 2023
ca42ded
Create final config
trelbutate Mar 22, 2023
141e90c
Fix override toggles not appearing when they should
trelbutate Mar 22, 2023
e38b08d
Better flashing layout and style
trelbutate Mar 22, 2023
35e74e4
Add dropdown list to select firmwares
trelbutate Mar 22, 2023
3ae0a22
Firmware selection values
trelbutate Mar 23, 2023
7f7089b
Update README.md
trelbutate Mar 23, 2023
08e7fbf
Temp: Make this work on lt
trelbutate Mar 23, 2023
d967d73
Flesh out firmware selection and start with firmware download
trelbutate Mar 23, 2023
0d7bf9f
Store firmwares in DB
trelbutate Mar 24, 2023
215cd83
Store firmware list between sessions + show download indicator
trelbutate Mar 24, 2023
22aea0b
Add a few button titles
trelbutate Mar 24, 2023
ac344c7
Show firmware download progress
trelbutate Mar 25, 2023
74c835f
Fix CORS issues by making the local server act as a proxy
trelbutate Mar 25, 2023
76d8914
Device selector
trelbutate Mar 25, 2023
9575411
Fix errors, mute deprecation warning
trelbutate Mar 26, 2023
1825845
Full reinstall toggle
trelbutate Mar 26, 2023
d753d10
Handle "latest version" for firmware selection
trelbutate Mar 26, 2023
003dab6
Fix config values not persisting
trelbutate Mar 26, 2023
f38e080
Fix Channel Saving
sachaw Feb 25, 2023
8395c36
Revert full height
trelbutate Mar 26, 2023
81b4254
Skip erasing step if not needed and improve progress percentage
trelbutate Mar 26, 2023
e9d8416
Finally have a fully working config after flashing
trelbutate Mar 27, 2023
ab89802
Use disconnect instead of freePort
trelbutate Mar 27, 2023
872da63
Custom firmware upload
trelbutate Mar 27, 2023
0ea363d
Fix wrong firmware being selected
trelbutate Mar 27, 2023
57b66b3
Add func to delete file from db
trelbutate Mar 27, 2023
4369a08
Import and export preset configs
trelbutate Mar 27, 2023
93125a2
Reset default config
trelbutate Mar 27, 2023
f4bef99
Somewhat improved startup device detection
trelbutate Mar 28, 2023
d7bc49c
Add handling for remaining config tabs
trelbutate Mar 28, 2023
ca120a5
Fix CSS scrolling
trelbutate Mar 28, 2023
726e6be
Add flashing state texts and styles
trelbutate Mar 28, 2023
72a409e
Change layout
trelbutate Mar 28, 2023
4899cb8
Auto-connect and disconnect devices
trelbutate Mar 28, 2023
b284a3f
Fix some flashing bugs
trelbutate Mar 28, 2023
7445d90
Minor help text adjustments
trelbutate Apr 11, 2023
e097b4d
Change readme
trelbutate Apr 12, 2023
568fe76
Merge branch 'setuppage' into setuppage2
trelbutate Apr 12, 2023
6060f16
Remove all those annoying debugger statements
trelbutate Apr 13, 2023
9202f84
Handle prereleases
trelbutate Apr 13, 2023
d26b8f2
Skip flashing if device has selected firmware already installed
trelbutate Apr 14, 2023
5c23711
Error handling
trelbutate Apr 14, 2023
510b2a8
Start refactoring
trelbutate Apr 14, 2023
acd8926
Refactor dashboard components
trelbutate Apr 14, 2023
2c1da9b
Show configs assigned to devices
trelbutate Apr 18, 2023
8bbf583
Disable UI while flashing
trelbutate Apr 18, 2023
0f01ee1
Start adding module config
trelbutate Apr 19, 2023
2b38d32
Fix override state not getting restored properly
trelbutate Apr 19, 2023
04a8e74
Change layout
trelbutate Apr 20, 2023
e2fbb1f
More layout improvements
trelbutate Apr 20, 2023
b2ee6fe
Hopefully fix install errors
trelbutate Apr 22, 2023
823feef
Switch flasher
trelbutate Apr 22, 2023
66466ac
Fixes
trelbutate Apr 24, 2023
95236de
Set all the configs, plus some remaining fixes
trelbutate Apr 24, 2023
bf33752
Merge remote-tracking branch 'upstream/master' into setuppage
r41d May 22, 2023
c70ffbd
Remove trailing whitespace
r41d May 22, 2023
a13842d
fix Readme
r41d May 22, 2023
4be674f
Add missing config fields
sachaw May 23, 2023
c895164
Format & update deps
sachaw May 23, 2023
e651070
use publish meshtastic.js package version & bump maplibre
sachaw May 23, 2023
3dbce3f
Add new config options
sachaw May 23, 2023
982a748
Remove binaries
sachaw May 23, 2023
54d8537
Merge branch 'master' into setuppage
sachaw Jul 9, 2023
81889eb
Fix default value
r41d Feb 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@buf:registry=https://buf.build/gen/npm/v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Install the dependencies.
pnpm i
```

Start the developtment server:
Start the development server:

```bash
pnpm dev
Expand Down
101 changes: 52 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,77 +21,80 @@
"dependencies": {
"@emeraldpay/hashicon-react": "^0.5.2",
"@hookform/error-message": "^2.0.1",
"@hookform/resolvers": "^2.9.11",
"@meshtastic/meshtasticjs": "2.0.20-5",
"@preact/signals-react": "^1.2.2",
"@radix-ui/react-accordion": "^1.1.0",
"@radix-ui/react-checkbox": "^1.0.2",
"@radix-ui/react-dialog": "^1.0.2",
"@radix-ui/react-dropdown-menu": "^2.0.3",
"@radix-ui/react-label": "^2.0.0",
"@radix-ui/react-menubar": "^1.0.1",
"@radix-ui/react-popover": "^1.0.4",
"@radix-ui/react-scroll-area": "^1.0.2",
"@radix-ui/react-select": "^1.2.0",
"@radix-ui/react-separator": "^1.0.1",
"@radix-ui/react-switch": "^1.0.1",
"@radix-ui/react-tabs": "^1.0.2",
"@radix-ui/react-toast": "^1.1.2",
"@radix-ui/react-tooltip": "^1.0.4",
"@hookform/resolvers": "^3.1.0",
"@meshtastic/meshtasticjs": "2.1.12-0",
"@preact/signals-react": "^1.3.2",
"@radix-ui/react-accordion": "^1.1.1",
"@radix-ui/react-checkbox": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.3",
"@radix-ui/react-dropdown-menu": "^2.0.4",
"@radix-ui/react-label": "^2.0.1",
"@radix-ui/react-menubar": "^1.0.2",
"@radix-ui/react-popover": "^1.0.5",
"@radix-ui/react-scroll-area": "^1.0.3",
"@radix-ui/react-select": "^1.2.1",
"@radix-ui/react-separator": "^1.0.2",
"@radix-ui/react-switch": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.3",
"@radix-ui/react-toast": "^1.1.3",
"@radix-ui/react-tooltip": "^1.0.5",
"@tailwindcss/typography": "^0.5.9",
"@toit/esptool.js": "^0.12.3",
"@turf/turf": "^6.5.0",
"base64-js": "^1.5.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-variance-authority": "^0.4.0",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"cmdk": "^0.1.22",
"cmdk": "^0.2.0",
"esptool-js": "^0.2.1",
"geodesy": "^2.4.0",
"immer": "^9.0.19",
"lucide-react": "^0.115.0",
"immer": "^10.0.2",
"jszip": "^3.10.1",
"lucide-react": "^0.220.0",
"mapbox-gl": "npm:empty-npm-package@^1.0.0",
"maplibre-gl": "2.4.0",
"maplibre-gl": "3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.2",
"react-map-gl": "^7.0.21",
"react-qrcode-logo": "^2.8.0",
"react-hook-form": "^7.43.9",
"react-map-gl": "^7.0.23",
"react-qrcode-logo": "^2.9.0",
"rfc4648": "^1.5.2",
"tailwind-merge": "^1.10.0",
"tailwind-merge": "^1.12.0",
"tailwindcss-animate": "^1.0.5",
"timeago-react": "^3.0.5",
"zustand": "4.3.3"
"timeago-react": "^3.0.6",
"zustand": "4.3.8"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@types/chrome": "^0.0.217",
"@types/chrome": "^0.0.236",
"@types/geodesy": "^2.2.3",
"@types/node": "^18.14.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/node": "^20.2.3",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@types/w3c-web-serial": "^1.0.3",
"@types/web-bluetooth": "^0.0.16",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@vitejs/plugin-react": "^3.1.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.3",
"@types/web-bluetooth": "^0.0.17",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"@vitejs/plugin-react": "^4.0.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"gzipper": "^7.2.0",
"postcss": "^8.4.21",
"prettier": "^2.8.4",
"prettier-plugin-tailwindcss": "^0.2.3",
"postcss": "^8.4.23",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.3.0",
"rollup-plugin-visualizer": "^5.9.0",
"tailwindcss": "^3.2.7",
"tar": "^6.1.13",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"vite": "^4.1.4",
"tailwindcss": "^3.3.2",
"tar": "^6.1.15",
"tslib": "^2.5.2",
"typescript": "^5.0.4",
"vite": "^4.3.8",
"vite-plugin-environment": "^1.1.3",
"vite-plugin-pwa": "^0.14.4"
"vite-plugin-pwa": "^0.15.0"
}
}
74 changes: 66 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,81 @@
import { useState } from "react";

import { MapProvider } from "react-map-gl";
import { useAppStore } from "@core/stores/appStore.js";

import { DeviceWrapper } from "@app/DeviceWrapper.js";
import { PageRouter } from "@app/PageRouter.js";
import { CommandPalette } from "@components/CommandPalette.js";
import { Dashboard } from "@components/Dashboard.js";
import { DeviceSelector } from "@components/DeviceSelector.js";
import { DialogManager } from "@components/Dialog/DialogManager.js";
import { Dashboard } from "@components/Dashboard.js";
import { useDeviceStore } from "@core/stores/deviceStore.js";
import { ThemeController } from "@components/generic/ThemeController.js";
import { NewDeviceDialog } from "@components/Dialog/NewDeviceDialog.js";
import { ThemeController } from "@components/generic/ThemeController.js";
import { Toaster } from "@components/Toaster.js";
import { useAppStore } from "@core/stores/appStore.js";
import { useDeviceStore } from "@core/stores/deviceStore.js";
import { ISerialConnection } from "@meshtastic/meshtasticjs";

import { subscribeAll } from "./core/subscriptions";
import { randId } from "./core/utils/randId";

let ensureOnce = false;

export const App = (): JSX.Element => {
const { getDevice } = useDeviceStore();
const { selectedDevice, setConnectDialogOpen, connectDialogOpen } =
useAppStore();
const { getDevice, getDevices, removeDevice } = useDeviceStore();
const { addDevice } = useDeviceStore();
const {
selectedDevice,
setConnectDialogOpen,
connectDialogOpen,
setSelectedDevice
} = useAppStore();
const [initialized, setInitialized] = useState(false);

const device = getDevice(selectedDevice);

const onConnect = async (port: SerialPort) => {
const id = randId();
const device = addDevice(id);
const connection = new ISerialConnection(id);
console.log("conn");
await connection
.connect({
port,
baudRate: undefined,
concurrentLogOutput: true
})
.catch((e: Error) => console.log(`Unable to Connect: ${e.message}`));
device.addConnection(connection);
subscribeAll(device, connection);
};
const connectToAll = async () => {
const dev = await navigator.serial.getPorts();

navigator.serial.onconnect = (ev) => {
const port = ev.target as SerialPort;
if (port.readable === null) onConnect(port);
};
navigator.serial.ondisconnect = (ev) => {
const port = ev.target as SerialPort;
const device = getDevices().filter(
(d) => d.connection?.connType == "serial"
);
const d = device.find(
(d) => (d.connection! as ISerialConnection).getCurrentPort() == port
);
if (!d) return;
d.connection!.disconnect();
removeDevice(d.id ?? 0);
if (selectedDevice == d.id) setSelectedDevice(0);
};
dev.filter((d) => d.readable === null).forEach((d) => onConnect(d));
};
if (!initialized && !ensureOnce) {
connectToAll();
setInitialized(true);
ensureOnce = true;
}

return (
<ThemeController>
<NewDeviceDialog
Expand All @@ -32,7 +90,7 @@ export const App = (): JSX.Element => {
<div className="flex h-screen flex-col overflow-hidden bg-backgroundPrimary text-textPrimary">
<div className="flex flex-grow">
<DeviceSelector />
<div className="flex flex-grow flex-col">
<div className="flex h-screen w-full flex-col">
{device ? (
<div className="flex h-screen">
<DialogManager />
Expand Down
34 changes: 18 additions & 16 deletions src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
import { useEffect } from "react";
import { useAppStore } from "@core/stores/appStore.js";
import { useDevice, useDeviceStore } from "@core/stores/deviceStore.js";

import { useCommandState } from "cmdk";
import { Hashicon } from "@emeraldpay/hashicon-react";
import {
LucideIcon,
ArrowLeftRightIcon,
BoxSelectIcon,
BugIcon,
EraserIcon,
FactoryIcon,
LayersIcon,
LayoutIcon,
LinkIcon,
TrashIcon,
LucideIcon,
MapIcon,
MessageSquareIcon,
MoonIcon,
PaletteIcon,
PlusIcon,
PowerIcon,
EraserIcon,
QrCodeIcon,
RefreshCwIcon,
FactoryIcon,
ArrowLeftRightIcon,
BugIcon,
SettingsIcon,
SmartphoneIcon,
MessageSquareIcon,
QrCodeIcon,
LayersIcon,
PaletteIcon,
TrashIcon,
UsersIcon,
LayoutIcon,
XCircleIcon,
BoxSelectIcon
XCircleIcon
} from "lucide-react";

import {
CommandDialog,
CommandEmpty,
Expand All @@ -35,6 +34,9 @@ import {
CommandItem,
CommandList
} from "@components/UI/Command.js";
import { useAppStore } from "@core/stores/appStore.js";
import { useDevice, useDeviceStore } from "@core/stores/deviceStore.js";
import { Hashicon } from "@emeraldpay/hashicon-react";

export interface Group {
label: string;
Expand Down
Loading