From 53af9d67c04be9ae1afd198f965e5efe207fc2e9 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Thu, 4 Jan 2024 23:33:25 +0100 Subject: [PATCH] Allow erase_chip to be disabled during session --- src/js/main.js | 3 +++ src/js/tabs/firmware_flasher.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index 067150b633..a9eb7302f5 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -74,6 +74,7 @@ function cleanupLocalStorage() { 'selected_board', 'unifiedConfigLast', 'unifiedSourceCache', + 'erase_chip', ]; for (const key in localStorage) { @@ -83,6 +84,8 @@ function cleanupLocalStorage() { } } } + + setConfig({'erase_chip': true}); // force erase chip on first run } function appReady() { diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js index c930868c5d..1e2b13a5d9 100644 --- a/src/js/tabs/firmware_flasher.js +++ b/src/js/tabs/firmware_flasher.js @@ -574,13 +574,14 @@ firmware_flasher.initialize = function (callback) { self.isFlashing = false; } - $('input.erase_chip').prop('checked', true); // force true because people flashing without regard for new configs + let result = getConfig('erase_chip'); + $('input.erase_chip').prop('checked', result.erase_chip); // users can override this during the session $('input.erase_chip').change(function () { setConfig({'erase_chip': $(this).is(':checked')}); }).change(); - let result = getConfig('show_development_releases'); + result = getConfig('show_development_releases'); $('input.show_development_releases') .prop('checked', result.show_development_releases) .change(function () {