add repo defaults, add more chips

This commit is contained in:
wellenvogel 2023-09-22 21:14:01 +02:00
parent f800893ac8
commit bb9e7b4de2
2 changed files with 11 additions and 6 deletions

View File

@ -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); let value = RegExp("" + key + "[^&]+").exec(window.location.search);
// Return the unescaped value minus everything starting from the equals sign or an empty string // 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 * add an HTML element

View File

@ -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 * 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 * 0 - esp32 - starts at 0x1000
* 9 - esp32s3 - starts at 0 * 9 - esp32s3 - starts at 0
*/ */
const FLASHSTART={ const FLASHSTART={
0:0x1000, 0:0x1000, //ESP32
9:0 9:0, //ESP32S3
2:0x1000, //ESP32S2
5:0 //ESP32C3
}; };
const decodeFromBuffer=(buffer, start, length)=>{ const decodeFromBuffer=(buffer, start, length)=>{
while (length > 0 && buffer.charCodeAt(start + length - 1) == 0) { 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 repo;
let errorText=`unable to query release info for user ${user}, repo ${repo}: `; let errorText=`unable to query release info for user ${user}, repo ${repo}: `;
if (! custom){ if (! custom){
user = window.gitHubUser||getParam('user'); user = window.gitHubUser||getParam('user','wellenvogel');
repo = window.gitHubRepo || getParam('repo'); repo = window.gitHubRepo || getParam('repo','esp32-nmea2000');
if (!user || !repo) { if (!user || !repo) {
alert("missing parameter user or repo"); alert("missing parameter user or repo");
} }