From bb9e7b4de262a67377cf100d45f9bb2e541e42fe Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Fri, 22 Sep 2023 21:14:01 +0200 Subject: [PATCH] add repo defaults, add more chips --- webinstall/helper.js | 5 +++-- webinstall/install.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/webinstall/helper.js b/webinstall/helper.js index 3e51220..b2427b2 100644 --- a/webinstall/helper.js +++ b/webinstall/helper.js @@ -1,7 +1,8 @@ -const getParam = (key) => { +const getParam = (key,opt_default) => { + if (opt_default === undefined) opt_default=""; let value = RegExp("" + key + "[^&]+").exec(window.location.search); // Return the unescaped value minus everything starting from the equals sign or an empty string - return decodeURIComponent(!!value ? value.toString().replace(/^[^=]+./, "") : ""); + return decodeURIComponent(!!value ? value.toString().replace(/^[^=]+./, "") : opt_default); }; /** * add an HTML element diff --git a/webinstall/install.js b/webinstall/install.js index fb84eeb..10053ed 100644 --- a/webinstall/install.js +++ b/webinstall/install.js @@ -21,12 +21,16 @@ import * as zip from "https://cdn.jsdelivr.net/npm/@zip.js/zip.js@2.7.29/+esm"; }; /** * map of our known chip ids to flash starts for full images + * see https://github.com/espressif/esptool-js/tree/main/src/targets + * IMAGE_CHIP_ID, BOOTLOADER_FLASH_OFFSET * 0 - esp32 - starts at 0x1000 * 9 - esp32s3 - starts at 0 */ const FLASHSTART={ - 0:0x1000, - 9:0 + 0:0x1000, //ESP32 + 9:0, //ESP32S3 + 2:0x1000, //ESP32S2 + 5:0 //ESP32C3 }; const decodeFromBuffer=(buffer, start, length)=>{ while (length > 0 && buffer.charCodeAt(start + length - 1) == 0) { @@ -427,8 +431,8 @@ import * as zip from "https://cdn.jsdelivr.net/npm/@zip.js/zip.js@2.7.29/+esm"; let repo; let errorText=`unable to query release info for user ${user}, repo ${repo}: `; if (! custom){ - user = window.gitHubUser||getParam('user'); - repo = window.gitHubRepo || getParam('repo'); + user = window.gitHubUser||getParam('user','wellenvogel'); + repo = window.gitHubRepo || getParam('repo','esp32-nmea2000'); if (!user || !repo) { alert("missing parameter user or repo"); }