Initial commit

This commit is contained in:
kawakode committed 2026-11-11 04:08:00 +01:00
commit 64a227437d
1920 files changed
+3428556

No files matched your search

+341
View File
@@ -0,0 +1,341 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>PocketTrainer Flasher</title>
<meta name="description" content="Install the PocketTrainer firmware on your ESP32-C3 board, straight from the browser.">
<script type="module" src="vendor/esp-web-tools/install-button.js"></script>
<style>
:root {
--bg: #eef2f7;
--stripe: rgba(40, 60, 110, 0.035);
--card: #ffffff;
--card-2: #f5f8fb;
--ink: #323746;
--muted: #6b7489;
--line: #d5dce6;
--cyan: #28b4eb;
--cyan-dk: #146eaa;
--navy: #283c6e;
--orange: #f5961e;
--red: #d9443f;
--green: #3fa84b;
--warn-bg: #fff6e5;
--warn-line: #f2c46b;
--shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 6px 20px rgba(40, 60, 110, 0.10);
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #141a24; --stripe: rgba(255,255,255,0.025); --card: #1d2532; --card-2: #232d3c;
--ink: #e4e9f2; --muted: #9aa5b8; --line: #2f3a4b; --cyan-dk: #7cd0f5; --navy: #9fb6ec;
--warn-bg: #2d2617; --warn-line: #7a5d22;
--shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 20px rgba(0,0,0,0.35);
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--bg: #141a24; --stripe: rgba(255,255,255,0.025); --card: #1d2532; --card-2: #232d3c;
--ink: #e4e9f2; --muted: #9aa5b8; --line: #2f3a4b; --cyan-dk: #7cd0f5; --navy: #9fb6ec;
--warn-bg: #2d2617; --warn-line: #7a5d22;
--shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 20px rgba(0,0,0,0.35);
color-scheme: dark;
}
* { box-sizing: border-box; }
body {
margin: 0;
font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
color: var(--ink);
background:
repeating-linear-gradient(180deg, var(--stripe) 0 1px, transparent 1px 4px),
var(--bg);
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 20px 56px; }
a { color: var(--cyan-dk); }
code, kbd {
font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace;
background: var(--card-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
/* Header */
header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.logo {
display: inline-block; padding: 10px 26px; border-radius: 999px; color: #fff;
font-weight: 800; font-size: 26px; letter-spacing: .2px;
background: linear-gradient(180deg, #8fd8f7 0%, #28b4eb 48%, #1f9fd6 52%, #1b8cc2 100%);
box-shadow: 0 2px 0 #12608f, 0 6px 16px rgba(20,110,170,.35), inset 0 1px 0 rgba(255,255,255,.7);
text-shadow: 0 1px 0 #12608f;
}
.tagline { color: var(--muted); margin: 0; flex: 1 1 260px; }
.version { font-size: 13px; color: var(--muted); }
.banner {
margin: 22px 0 0; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--warn-line);
background: var(--warn-bg);
}
.banner strong { color: var(--ink); }
h2 { font-size: 20px; margin: 40px 0 6px; display: flex; align-items: center; gap: 10px; }
h2 .num {
width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
color: #fff; font-size: 15px; background: linear-gradient(180deg, #ffb25a, var(--orange) 55%, #dc7d0c);
box-shadow: 0 2px 0 #b5620a;
}
.lead { margin: 0 0 16px; color: var(--muted); }
/* Board cards */
.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.board {
background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
display: flex; flex-direction: column; overflow: hidden;
}
.photo {
background: #fff; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden;
border-bottom: 1px solid var(--line); position: relative;
}
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo .chip {
position: absolute; left: 12px; top: 12px; font-size: 12px; font-weight: 700; color: #fff;
padding: 3px 10px; border-radius: 999px; background: var(--navy);
}
.board-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.board h3 { margin: 0; font-size: 18px; }
.board .sub { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }
.recog { font-size: 14px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--card-2); }
.install { margin-top: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill-btn {
appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 16px; color: #fff;
padding: 11px 26px; border-radius: 999px;
background: linear-gradient(180deg, #8de29a 0%, #46be55 48%, #3aa948 52%, #2f9a3d 100%);
box-shadow: 0 2px 0 #23762e, 0 5px 14px rgba(47,154,61,.35), inset 0 1px 0 rgba(255,255,255,.6);
text-shadow: 0 1px 0 #23762e;
transition: transform .08s, filter .15s;
}
.pill-btn:hover { filter: brightness(1.06); }
.pill-btn:active { transform: translateY(2px); box-shadow: 0 0 0 #23762e, inset 0 1px 0 rgba(255,255,255,.6); }
.pill-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.unsupported { font-size: 14px; color: var(--red); }
.env { font-size: 12px; color: var(--muted); }
/* Steps */
.steps { display: grid; gap: 14px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps > li {
background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 14px 58px;
position: relative; box-shadow: var(--shadow);
}
.steps > li::before {
counter-increment: s; content: counter(s);
position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; border-radius: 50%;
display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px;
background: linear-gradient(180deg, #8fd8f7, var(--cyan) 55%, #1b8cc2); box-shadow: 0 2px 0 #12608f;
}
.steps strong { display: block; margin-bottom: 2px; }
.steps p { margin: 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.panel {
background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 8px; font-size: 16px; }
.panel ul, .panel ol { margin: 0; padding-left: 20px; }
.panel li + li { margin-top: 4px; }
.figure { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: start; }
.figure img { width: 132px; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.warn {
border-left: 4px solid var(--red); background: var(--card); border-radius: 12px; padding: 12px 16px;
box-shadow: var(--shadow); margin-top: 20px;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-wrap { overflow-x: auto; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
footer { margin-top: 48px; font-size: 13px; color: var(--muted); }
footer p { margin: 4px 0; }
@media (max-width: 520px) {
.logo { font-size: 22px; }
.figure { grid-template-columns: 1fr; }
.figure img { width: 160px; }
}
</style>
</head>
<body>
<div class="wrap">
<header>
<span class="logo">PocketTrainer</span>
<p class="tagline">Install the pocket companion on your ESP32-C3 board, straight from the browser.<br>
<span class="version" id="version">Firmware version: loading…</span></p>
</header>
<div class="banner" id="serial-banner" hidden>
<strong>This browser cannot talk to USB devices.</strong>
Open this page in <strong>Chrome</strong>, <strong>Edge</strong> or <strong>Opera</strong> on a computer
(Windows, macOS, Linux or ChromeOS). Firefox, Safari and phones do not support Web Serial.
</div>
<div class="banner" id="https-banner" hidden>
<strong>This page must be served over HTTPS</strong> (or opened on <code>localhost</code>) for the browser to
allow USB access. Put the container behind your HTTPS reverse proxy.
</div>
<h2><span class="num">1</span>Pick your board</h2>
<p class="lead">Two boards are supported. Both are ESP32-C3 boards with a USB-C port; the firmware is different, so check the photo before you install.</p>
<div class="boards">
<article class="board">
<div class="photo">
<span class="chip">Rectangular screen</span>
<img src="img/lcd147-front.jpg" alt="Waveshare ESP32-C3-LCD-1.47: small black board with a rectangular 1.47-inch screen, a USB-C port at one end and two rows of pin headers" loading="lazy">
</div>
<div class="board-body">
<h3>Waveshare ESP32-C3-LCD-1.47</h3>
<p class="sub">Portrait screen, one button, motion sensor</p>
<dl class="specs">
<dt>Screen</dt><dd>1.47" ST7789, 180 × 320</dd>
<dt>Controls</dt><dd>BOOT button: short press = next, hold = confirm</dd>
<dt>Sensors</dt><dd>QMI8658 accelerometer + gyroscope (real steps, tilt and shake games)</dd>
</dl>
<p class="recog"><strong>How to recognise it:</strong> rectangular screen, black PCB with
<em>ESP32-C3-LCD-1.47</em> printed on the back, microSD slot, pin headers on both long sides.</p>
<div class="install">
<esp-web-install-button manifest="firmware/lcd147.json">
<button slot="activate" class="pill-btn">Install on this board</button>
<span slot="unsupported" class="unsupported">Browser not supported (use Chrome or Edge on a computer).</span>
<span slot="not-allowed" class="unsupported">Needs HTTPS or localhost.</span>
</esp-web-install-button>
<span class="env">firmware <code>lcd147</code></span>
</div>
</div>
</article>
<article class="board">
<div class="photo">
<span class="chip">Round screen</span>
<img src="img/round-front.jpg" alt="Round ESP32-C3 board with a 1.28-inch circular screen, seen at an angle, USB-C port on the edge" loading="lazy">
</div>
<div class="board-body">
<h3>ESP32-C3 1.28" round (GC9A01)</h3>
<p class="sub">Round touch screen</p>
<dl class="specs">
<dt>Screen</dt><dd>1.28" GC9A01, 240 × 240 round</dd>
<dt>Controls</dt><dd>CST816 touch screen</dd>
<dt>Sensors</dt><dd>None built in: optional MPU6050 / QMI8658 on the I2C pins, or simulated steps</dd>
</dl>
<p class="recog"><strong>How to recognise it:</strong> circular screen, yellow PCB with an
<em>ESP32-C3-MINI-1U</em> module, BOOT and RESET buttons on the back, sold with or without a black case.
Pick the <strong>touch</strong> version.</p>
<div class="install">
<esp-web-install-button manifest="firmware/pockettrainer.json">
<button slot="activate" class="pill-btn">Install on this board</button>
<span slot="unsupported" class="unsupported">Browser not supported (use Chrome or Edge on a computer).</span>
<span slot="not-allowed" class="unsupported">Needs HTTPS or localhost.</span>
</esp-web-install-button>
<span class="env">firmware <code>pockettrainer</code></span>
</div>
</div>
</article>
</div>
<div class="warn">
<strong>Already playing?</strong> Updating keeps your Pokémon and progress. The installer may offer to
<strong>erase the device</strong>: only tick it for a fresh start, because it deletes the save. If a Pokémon from
Crystal is on the device, send it back to Crystal first.
</div>
<h2><span class="num">2</span>Flash it</h2>
<ol class="steps">
<li><strong>Plug the board into your computer</strong>
<p>Use a USB-C cable that carries data (some charging-only cables do not). No driver is needed: the ESP32-C3 has USB built in.</p></li>
<li><strong>Click “Install on this board”</strong>
<p>Under the photo of <em>your</em> board. The browser lists the serial ports.</p></li>
<li><strong>Choose the port</strong>
<p>It is called <em>USB JTAG/serial debug unit</em> (on macOS <code>cu.usbmodem…</code>, on Windows <code>COM…</code>,
on Linux <code>ttyACM…</code>). Click <em>Connect</em>.</p></li>
<li><strong>Install and wait</strong>
<p>Confirm, then wait about 30 seconds without unplugging. The board restarts on its own when it is done.</p></li>
</ol>
<h2><span class="num">3</span>If the port does not show up</h2>
<p class="lead">Put the board in download mode by hand, then click Install again.</p>
<div class="two">
<div class="panel figure">
<img src="img/lcd147-back.jpg" alt="Back of the Waveshare ESP32-C3-LCD-1.47 showing the USB-C port and the two small buttons near the edge" loading="lazy">
<div>
<h3>ESP32-C3-LCD-1.47</h3>
<ol>
<li>Unplug the board.</li>
<li>Hold the <strong>BOOT</strong> button.</li>
<li>Plug the cable back in, then release BOOT.</li>
<li>After flashing, unplug and replug to start the firmware.</li>
</ol>
</div>
</div>
<div class="panel figure">
<img src="img/round-back.jpg" alt="Back of the round board with labels: ESP32-C3-MINI-1U module, REST and BOOT buttons at the top, USB Type-C at the bottom" loading="lazy">
<div>
<h3>Round 1.28"</h3>
<ol>
<li>Keep it plugged in.</li>
<li>Hold <strong>BOOT</strong>, press and release <strong>REST</strong> (reset).</li>
<li>Release BOOT.</li>
<li>After flashing, press REST once to start the firmware.</li>
</ol>
</div>
</div>
</div>
<p class="lead" style="margin-top:14px">Still nothing? Try another cable or USB port, close any other program using the
port (Arduino IDE, PlatformIO monitor, Cura…), and on Linux add yourself to the <code>dialout</code> group.</p>
<h2><span class="num">4</span>First start</h2>
<div class="two">
<div class="panel">
<h3>Get a companion</h3>
<ul>
<li><strong>From Crystal:</strong> deposit a Pokémon in the Link tab, using the device number shown on screen.</li>
<li><strong>Demo:</strong> choose <em>Demo</em> to play with an original creature without Crystal.</li>
<li><strong>WiFi:</strong> choose <em>WiFi</em>, scan the QR code with your phone (or join
<code>PocketTrainer-XXXX</code>) and open <code>192.168.4.1</code>.</li>
</ul>
</div>
<div class="panel">
<h3>Controls</h3>
<div class="table-wrap">
<table>
<thead><tr><th></th><th>LCD 1.47</th><th>Round 1.28"</th></tr></thead>
<tbody>
<tr><td>Move</td><td>Short press</td><td>Tap the item</td></tr>
<tr><td>Confirm</td><td>Hold ~½ s</td><td>Tap the item</td></tr>
<tr><td>Pet</td><td>Tap the button or rock the board</td><td>Rub the Pokémon</td></tr>
<tr><td>Flip screen</td><td>Hold it upside down</td><td>—</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<p>The installer runs entirely in your browser (Web Serial) with
<a href="https://esphome.github.io/esp-web-tools/">ESP Web Tools</a>. Nothing is uploaded anywhere.</p>
<p>Board photos: product listings from the boards' sellers, used to identify the hardware.</p>
</footer>
</div>
<script>
if (!("serial" in navigator)) document.getElementById("serial-banner").hidden = false;
else if (!window.isSecureContext) document.getElementById("https-banner").hidden = false;
fetch("firmware/version.json", { cache: "no-cache" })
.then((r) => (r.ok ? r.json() : Promise.reject()))
.then((v) => (document.getElementById("version").textContent = "Firmware version: " + v.version))
.catch(() => (document.getElementById("version").textContent = "Firmware not built yet"));
</script>
</body>
</html>