From 7f4bc432225af6d30bd8e2a09dc7e4e25246fd0a Mon Sep 17 00:00:00 2001 From: shufps Date: Sun, 26 Jan 2025 07:44:22 +0100 Subject: [PATCH 1/5] keep config checkbox to skip nvs partition --- src/components/LandingHero.tsx | 43 ++++++++++++++++++++++++++++++++++ src/i18n/locales/de.json | 3 ++- src/i18n/locales/en.json | 3 ++- src/i18n/locales/it.json | 3 ++- src/i18n/locales/pt.json | 3 ++- src/i18n/locales/ro.json | 3 ++- src/i18n/locales/ru.json | 3 ++- src/i18n/locales/sk.json | 3 ++- src/i18n/locales/tlh.json | 3 ++- src/i18n/locales/tr.json | 3 ++- 10 files changed, 61 insertions(+), 9 deletions(-) diff --git a/src/components/LandingHero.tsx b/src/components/LandingHero.tsx index 1ea8139..2e204af 100644 --- a/src/components/LandingHero.tsx +++ b/src/components/LandingHero.tsx @@ -32,6 +32,7 @@ export default function LandingHero() { const textDecoderRef = useRef(null) const readableStreamClosedRef = useRef | null>(null) const logsRef = useRef('') + const [keepConfig, setKeepConfig] = useState(false); useEffect(() => { const userAgent = navigator.userAgent.toLowerCase(); @@ -116,6 +117,10 @@ export default function LandingHero() { } } + const handleKeepConfigToggle = (event) => { + setKeepConfig(event.target.checked); + }; + const startSerialLogging = async () => { if (!serialPortRef.current) { setStatus(t('status.connectFirst')); @@ -256,6 +261,32 @@ export default function LandingHero() { setStatus(t('status.flashing', { percent: 0 })) + // On all Bitaxe derivatives the same + const nvsStart = 0x9000; + const nvsSize = 0x6000; + + let parts; + + if (keepConfig) { + parts = [ + { + data: firmwareBinaryString.slice(0, nvsStart), // Data before NVS + address: 0, + }, + { + data: firmwareBinaryString.slice(nvsStart + nvsSize), // Data after NVS + address: nvsStart + nvsSize, + }, + ]; + } else { + parts = [ + { + data: firmwareBinaryString, // Entire firmware binary + address: 0, + }, + ]; + } + await loader.writeFlash({ fileArray: [{ data: firmwareBinaryString, @@ -354,6 +385,18 @@ export default function LandingHero() { disabled={isConnecting || isFlashing} /> )} +
+ + +