only load widgets if fastload is installed

pull/2334/head
thyttan 2022-11-30 21:10:06 +01:00
parent f21a0c6a52
commit 95c5fd8bcf
2 changed files with 7 additions and 4 deletions

View File

@ -8,4 +8,5 @@
0.08: Force background of widget field to the torch colour
0.09: Change code taking FW tweaks into account
0.10: Introduce fast switching.
0.11: Make compatible with Fastload Utils by loading widgets.
0.11: Make compatible with Fastload Utils by loading widgets. No change if
Fastload Utils is not installed.

View File

@ -1,14 +1,15 @@
{
const SETTINGS_FILE = "torch.json";
let settings;
let s = require("Storage");
let loadSettings = function() {
settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#FFFFFF', 'color': 'White'};
settings = s.readJSON(SETTINGS_FILE,1)|| {'bg': '#FFFFFF', 'color': 'White'};
};
loadSettings();
let brightnessBackup = require("Storage").readJSON('setting.json').brightness;
let brightnessBackup = s.readJSON('setting.json').brightness;
let optionsBackup = Bangle.getOptions();
Bangle.setLCDBrightness(1);
Bangle.setLCDPower(1);
@ -18,7 +19,8 @@
g.setTheme({bg:settings.bg,fg:"#000"});
g.setColor(settings.bg);
g.fillRect(0,0,g.getWidth(),g.getHeight());
Bangle.loadWidgets();
// if Fastload Utils is installed, make Torch compatible with it.
if (s.readJSON('fastload.info') != undefined) Bangle.loadWidgets();
Bangle.setUI({
mode : 'custom',
back : Bangle.showClock, // B2: SW back button to exit