Add test mode checking
This commit is contained in:
parent
704502ca64
commit
2e48bdc929
5 changed files with 33 additions and 16 deletions
|
|
@ -20,7 +20,7 @@ features:
|
|||
- Breadboard-Friendly
|
||||
---
|
||||
|
||||
- We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want your very own soft serve ice cream machine? OK well, that's not something we can provide. But we can provide your *second*-deepest desire: an **ESP32-S\*3\* Feather board with a built in IPS TFT color display**. It's got all the delicious creamy goodness features of a Feather main board, the comforting warmth of an ESP32-S3 WiFi+BLE microcontroller, and the crispness of a 240x135 pixel color TFT display. All that and it will even plug in nicely into a breadboard, [terminal block wing](https://www.adafruit.com/product/2926), or [Feather Doubler](https://www.adafruit.com/product/2890) or even just stack on top of another wing.
|
||||
- We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want your very own soft serve ice cream machine? OK well, that's not something we can provide. But we can provide your *second*-deepest desire: an **ESP32-S*3* Feather board with a built in IPS TFT color display**. It's got all the delicious creamy goodness features of a Feather main board, the comforting warmth of an ESP32-S3 WiFi+BLE microcontroller, and the crispness of a 240x135 pixel color TFT display. All that and it will even plug in nicely into a breadboard, [terminal block wing](https://www.adafruit.com/product/2926), or [Feather Doubler](https://www.adafruit.com/product/2890) or even just stack on top of another wing.
|
||||
|
||||
This Feather comes with native USB and **4 MB Flash + 2 MB of PSRAM**, so it is perfect for use with CircuitPython or Arduino with low-cost WiFi. Native USB means it can act like a keyboard or a disk drive. WiFi means it's awesome for IoT projects. And Feather means it works with the large community of Feather Wings for expandability.
|
||||
|
||||
|
|
|
|||
|
|
@ -117,9 +117,7 @@
|
|||
{% if page.family == 'esp32s2' or page.family == 'esp32c3' or page.family == 'esp32s3' or page.family == 'esp32' %}
|
||||
<button is="cp-install-button" class="installer-button" boardname="{{ page.name }}" boardid="{{ board_id }}"
|
||||
{% for extension in version.extensions %}
|
||||
{% comment %}
|
||||
{{ extension }}file="{{ board_url }}/en_US/adafruit-circuitpython-{{ board_id }}-en_US-{{ version.version }}.{{ extension }}"
|
||||
{% endcomment %}
|
||||
{% endfor %}
|
||||
{% if bootloader_version and bootloader_id %}
|
||||
bootloader="https://github.com/adafruit/tinyuf2/releases/download/{{ bootloader_version }}/tinyuf2-{{ bootloader_id }}-{{ bootloader_version }}.zip"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,6 +2,7 @@
|
|||
import { html } from 'https://unpkg.com/lit-html?module';
|
||||
import * as zip from "https://deno.land/x/zipjs/index.js";
|
||||
import * as esptoolPackage from "https://unpkg.com/esp-web-flasher@5.1.2/dist/web/index.js?module"
|
||||
import {REPL} from 'https://cdn.jsdelivr.net/gh/adafruit/circuitpython-repl-js@1.0.0/repl.js';
|
||||
import { InstallButton } from "./installer.js";
|
||||
|
||||
// TODO: Figure out how to make the Web Serial from ESPTool and Web Serial to communicate with CircuitPython not conflict
|
||||
|
|
@ -25,11 +26,6 @@ import { InstallButton } from "./installer.js";
|
|||
// 4. Write the settings.toml to the board via the REPL
|
||||
// 5. Reset the board again
|
||||
//
|
||||
// To run REPL code, I may need to modularize the work I did for code.circuitpython.org
|
||||
// That allows you to run code in the REPL and get the output back. I may end up creating a
|
||||
// library that uses Web Serial and allows you to run code in the REPL and get the output back
|
||||
// because it's very integrated into the serial recieve and send code.
|
||||
//
|
||||
|
||||
const PREFERRED_BAUDRATE = 921600;
|
||||
|
||||
|
|
@ -67,9 +63,6 @@ export class CPInstallButton extends InstallButton {
|
|||
|
||||
// We need either the bootloader and uf2 or bin file to continue
|
||||
this.bootloaderUrl = this.getAttribute("bootloader");
|
||||
if (this.bootloaderUrl) {
|
||||
this.bootloaderUrl = `/bin/${this.bootloaderUrl.split("/").pop()}`;
|
||||
}
|
||||
this.uf2FileUrl = this.getAttribute("uf2file");
|
||||
this.binFileUrl = this.getAttribute("binfile");
|
||||
|
||||
|
|
@ -86,22 +79,22 @@ export class CPInstallButton extends InstallButton {
|
|||
binProgram: {
|
||||
label: `Install CircuitPython [version] Bin`,
|
||||
steps: [this.stepSerialConnect, this.stepConfirm, this.stepEraseAll, this.stepFlashBin, this.stepSuccess],
|
||||
isEnabled: () => { return !!this.binFileUrl },
|
||||
isEnabled: () => { return this.mode=="test" && !!this.binFileUrl },
|
||||
},
|
||||
uf2Program: {
|
||||
label: `Install CircuitPython [version] UF2 and Bootloader`,
|
||||
steps: [this.stepSerialConnect, this.stepConfirm, this.stepEraseAll, this.stepBootloader, this.stepCopyUf2, this.stepSettings, this.stepSuccess],
|
||||
isEnabled: () => { return !!this.bootloaderUrl && !!this.uf2FileUrl },
|
||||
isEnabled: () => { return this.mode=="test" && !!this.bootloaderUrl && !!this.uf2FileUrl },
|
||||
},
|
||||
bootloaderOnly: {
|
||||
label: "Install Bootloader Only",
|
||||
steps: [this.stepSerialConnect, this.stepConfirm, this.stepEraseAll, this.stepBootloader, this.stepSuccess],
|
||||
isEnabled: () => { return !!this.bootloaderUrl },
|
||||
isEnabled: () => { return this.mode=="test" && !!this.bootloaderUrl },
|
||||
},
|
||||
settingsOnly: {
|
||||
label: "Update WiFi credentials",
|
||||
steps: [this.stepSerialConnect, this.stepCredentials, this.stepSettings, this.stepSuccess],
|
||||
isEnabled: () => { return this.cpDetected() },
|
||||
isEnabled: () => { return this.mode=="test" && this.cpDetected() },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,6 +178,7 @@ export class CPInstallButton extends InstallButton {
|
|||
<input id="circuitpy_web_api_password" class="setting-data" type="text" placeholder="Web Workflow API Password" value="" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<!-- Alternatively "Disable USB Mass Storage" -->
|
||||
<input id="circuitpy_drive" class="setting" type="checkbox" value="disabled" checked />
|
||||
<label for="circuitpy_drive">Disable CIRCUITPY Drive (Required for write access)</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export class InstallButton extends HTMLButtonElement {
|
|||
this.currentDialogElement = null;
|
||||
this.serial = null;
|
||||
this.espStub = null;
|
||||
this.mode = "";
|
||||
this.dialogCssClass = "install-dialog";
|
||||
this.connected = this.connectionStates.DISCONNECTED;
|
||||
}
|
||||
|
|
@ -127,6 +128,8 @@ export class InstallButton extends HTMLButtonElement {
|
|||
this.toggleAttribute("install-unsupported", true);
|
||||
}
|
||||
|
||||
this.mode = this.getUrlParam("mode");
|
||||
|
||||
this.addEventListener("click", async (e) => {
|
||||
e.preventDefault();
|
||||
// WebSerial feature detection
|
||||
|
|
@ -138,6 +141,27 @@ export class InstallButton extends HTMLButtonElement {
|
|||
});
|
||||
}
|
||||
|
||||
// Parse out the url parameters from the current url
|
||||
getUrlParams() {
|
||||
// This should look for and validate very specific values
|
||||
var hashParams = {};
|
||||
if (location.hash) {
|
||||
location.hash.substr(1).split("&").forEach(function(item) {hashParams[item.split("=")[0]] = item.split("=")[1];});
|
||||
}
|
||||
return hashParams;
|
||||
}
|
||||
|
||||
// Get a url parameter by name and optionally remove it from the current url in the process
|
||||
getUrlParam(name) {
|
||||
let urlParams = this.getUrlParams();
|
||||
let paramValue = null;
|
||||
if (name in urlParams) {
|
||||
paramValue = urlParams[name];
|
||||
}
|
||||
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
enabledFlowCount() {
|
||||
let enabledFlowCount = 0;
|
||||
for (const [flowId, flow] of Object.entries(this.flows)) {
|
||||
|
|
@ -150,7 +174,8 @@ export class InstallButton extends HTMLButtonElement {
|
|||
|
||||
* generateMenu(templateFunc) {
|
||||
if (this.enabledFlowCount() == 0) {
|
||||
yield html`<li>No installable options for this board.</li>`;
|
||||
console.log(this.mode);
|
||||
yield html`<li>No installable options available for this board.</li>`;
|
||||
}
|
||||
for (const [flowId, flow] of Object.entries(this.flows)) {
|
||||
if (flow.isEnabled()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue