Skip to content

Commit

Permalink
Merge pull request #213 from sebastienvermeille/feat/setup-webflashin…
Browse files Browse the repository at this point in the history
…gtool

Add an online flashing tool for NSPanel
  • Loading branch information
tpanajott authored Dec 1, 2024
2 parents 31b47ee + 2aa99ee commit 996513d
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ const config: Config = {
label: 'Demo',
to: '/demo',
},
{
position: 'right',
label: 'Flash Firmware',
href: 'https://nspanelmanager.com/flashing-tool.html', // `flashing-tool.html` returns a page not found
},
{
href: 'https://github.com/NSPManager/NSPanelManager',
label: 'GitHub',
Expand Down
Binary file added docs/static/firmwares/1.0/merged_flash.bin
Binary file not shown.
Binary file added docs/static/firmwares/beta/merged_flash.bin
Binary file not shown.
115 changes: 115 additions & 0 deletions docs/static/flashing-tool.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>NSPanelManager - Flashing tool</title>
<meta
name="description"
content="Easily allow users to install custom firmware on NSPanel."
/>
<meta name="viewport" content="width=device-width" />
<meta name="color-scheme" content="dark light" />
<style>
body {
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
Roboto, Ubuntu, sans-serif;
padding: 0;
margin: 0;
line-height: 1.4;
}
.content {
max-width: 600px;
margin: 0 auto;
padding: 12px;
}
h2 {
margin-top: 2em;
}
h3 {
margin-top: 1.5em;
}
a {
color: #03a9f4;
}
.invisible {
visibility: hidden;
}
.hidden {
display: none;
}
esp-web-install-button[install-unsupported] {
visibility: inherit;
}
.content pre {
max-width: 100%;
overflow-y: scroll;
}
.footer {
margin-top: 24px;
border-top: 1px solid #ccc;
padding-top: 24px;
text-align: center;
}
.footer .initiative {
font-style: italic;
margin-top: 16px;
}
table {
border-spacing: 0;
}
td {
padding: 8px;
border-bottom: 1px solid #ccc;
}
.radios li {
list-style: none;
line-height: 2em;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #333;
color: #fff;
}
a {
color: #58a6ff;
}
}
</style>
<script type="module" src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"></script>
</head>
<body>
<div class="content">
<h1>Flash your NSPanel</h1>
<p>
Use this tool to flash firmware onto your NSPanel device. Please ensure
you are using a supported browser (e.g., Chrome or Edge) that
supports the Web Serial API.
</p>
<p>Select the version you want to install</p>
<ul class="radios">
<li>
<label><input type="radio" name="type" value="1.0" /> 1.0</label>
</li>
<li>
<label><input type="radio" name="type" value="beta" /> beta</label>
</li>
</ul>
<p class="button-row" align="center">
<esp-web-install-button class="invisible"></esp-web-install-button>
</p>

<div class="footer">
<a href="https://nspanelmanager.com">NSPanelManager</a> &mdash;
Installer powered by <a href="https://esphome.github.io/esp-web-tools/">ESP Web Tools</a>.
</div>
<script>
document.querySelectorAll('input[name="type"]').forEach(radio =>
radio.addEventListener("change", () => {
const button = document.querySelector('esp-web-install-button');
button.manifest = `./manifests/manifest_${radio.value}.json`;
button.classList.remove('invisible');
}
));
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions docs/static/manifests/manifest_1.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "NSPanelManager NSPanel Firmware",
"version": "1.0",
"builds": [
{
"chipFamily": "ESP32",
"parts": [{ "path": "../firmwares/1.0/merged_flash.bin", "offset": 0 }]
}
]
}
10 changes: 10 additions & 0 deletions docs/static/manifests/manifest_beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "NSPanelManager NSPanel Firmware",
"version": "beta",
"builds": [
{
"chipFamily": "ESP32",
"parts": [{ "path": "../firmwares/beta/merged_flash.bin", "offset": 0 }]
}
]
}

0 comments on commit 996513d

Please sign in to comment.