Skip to content

Commit 5113361

Browse files
Add an online flashing tool for NSPanel
That way we can flash the NSPanel without being required to install anything on our system
1 parent bd7816e commit 5113361

6 files changed

Lines changed: 140 additions & 0 deletions

File tree

docusaurus.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const config: Config = {
8181
label: 'Demo',
8282
to: '/demo',
8383
},
84+
{
85+
position: 'right',
86+
label: 'Flash Firmware',
87+
href: 'https://nspanelmanager.com/flashing-tool.html', // `flashing-tool.html` returns a page not found
88+
},
8489
{
8590
href: 'https://github.com/NSPManager/NSPanelManager',
8691
label: 'GitHub',
4 MB
Binary file not shown.
4 MB
Binary file not shown.

static/flashing-tool.html

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>NSPanelManager - Flashing tool</title>
6+
<meta
7+
name="description"
8+
content="Easily allow users to install custom firmware on NSPanel."
9+
/>
10+
<meta name="viewport" content="width=device-width" />
11+
<meta name="color-scheme" content="dark light" />
12+
<style>
13+
body {
14+
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
15+
Roboto, Ubuntu, sans-serif;
16+
padding: 0;
17+
margin: 0;
18+
line-height: 1.4;
19+
}
20+
.content {
21+
max-width: 600px;
22+
margin: 0 auto;
23+
padding: 12px;
24+
}
25+
h2 {
26+
margin-top: 2em;
27+
}
28+
h3 {
29+
margin-top: 1.5em;
30+
}
31+
a {
32+
color: #03a9f4;
33+
}
34+
.invisible {
35+
visibility: hidden;
36+
}
37+
.hidden {
38+
display: none;
39+
}
40+
esp-web-install-button[install-unsupported] {
41+
visibility: inherit;
42+
}
43+
.content pre {
44+
max-width: 100%;
45+
overflow-y: scroll;
46+
}
47+
.footer {
48+
margin-top: 24px;
49+
border-top: 1px solid #ccc;
50+
padding-top: 24px;
51+
text-align: center;
52+
}
53+
.footer .initiative {
54+
font-style: italic;
55+
margin-top: 16px;
56+
}
57+
table {
58+
border-spacing: 0;
59+
}
60+
td {
61+
padding: 8px;
62+
border-bottom: 1px solid #ccc;
63+
}
64+
.radios li {
65+
list-style: none;
66+
line-height: 2em;
67+
}
68+
@media (prefers-color-scheme: dark) {
69+
body {
70+
background-color: #333;
71+
color: #fff;
72+
}
73+
a {
74+
color: #58a6ff;
75+
}
76+
}
77+
</style>
78+
<script type="module" src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"></script>
79+
</head>
80+
<body>
81+
<div class="content">
82+
<h1>Flash your NSPanel</h1>
83+
<p>
84+
Use this tool to flash firmware onto your NSPanel device. Please ensure
85+
you are using a supported browser (e.g., Chrome or Edge) that
86+
supports the Web Serial API.
87+
</p>
88+
<p>Select the version you want to install</p>
89+
<ul class="radios">
90+
<li>
91+
<label><input type="radio" name="type" value="1.0" /> 1.0</label>
92+
</li>
93+
<li>
94+
<label><input type="radio" name="type" value="beta" /> beta</label>
95+
</li>
96+
</ul>
97+
<p class="button-row" align="center">
98+
<esp-web-install-button class="invisible"></esp-web-install-button>
99+
</p>
100+
101+
<div class="footer">
102+
<a href="https://nspanelmanager.com">NSPanelManager</a> &mdash;
103+
Installer powered by <a href="https://esphome.github.io/esp-web-tools/">ESP Web Tools</a>.
104+
</div>
105+
<script>
106+
document.querySelectorAll('input[name="type"]').forEach(radio =>
107+
radio.addEventListener("change", () => {
108+
const button = document.querySelector('esp-web-install-button');
109+
button.manifest = `./manifests/manifest_${radio.value}.json`;
110+
button.classList.remove('invisible');
111+
}
112+
));
113+
</script>
114+
</body>
115+
</html>

static/manifests/manifest_1.0.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "NSPanelManager NSPanel Firmware",
3+
"version": "1.0",
4+
"builds": [
5+
{
6+
"chipFamily": "ESP32",
7+
"parts": [{ "path": "../firmwares/1.0/merged_flash.bin", "offset": 0 }]
8+
}
9+
]
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "NSPanelManager NSPanel Firmware",
3+
"version": "beta",
4+
"builds": [
5+
{
6+
"chipFamily": "ESP32",
7+
"parts": [{ "path": "../firmwares/beta/merged_flash.bin", "offset": 0 }]
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)