added suggestions from pr

master
Phil Roggenbuck 2024-03-04 01:10:30 +01:00 committed by GitHub
parent a15e8b665d
commit e0a2081fc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 11 deletions

View File

@ -18,16 +18,8 @@ Bangle.drawWidgets();
let brightness; let brightness;
function loadBrightness() { function loadBrightness() {
try { const getBrightness = require('Storage').readJSON("setting.json", 1) || {};
const d = require('Storage').readJSON("setting.json", 1) || {}; brightness = getBrightness.brightness || 0.1;
brightness = Object.assign({
'brightness': 0.1
}, d || {});
return d;
} catch(e){
console.log(e.toString());
return;
}
} }
//may make it configurable in the future //may make it configurable in the future
@ -105,6 +97,7 @@ function printLinearCode(binary) {
} }
function showCode(card) { function showCode(card) {
// set to full bright when the setting is true
if(settings.fullBrightness) { if(settings.fullBrightness) {
Bangle.setLCDBrightness(1); Bangle.setLCDBrightness(1);
} }
@ -148,8 +141,9 @@ function showCode(card) {
} }
function showCard(card) { function showCard(card) {
// reset brightness to old value after maxing it out
if(settings.fullBrightness) { if(settings.fullBrightness) {
Bangle.setLCDBrightness(brightness.brightness); Bangle.setLCDBrightness(brightness);
} }
var lines = []; var lines = [];
var bodyFont = fontBig; var bodyFont = fontBig;