1
0
Fork 0

Cards App added brightness option

Added an option to use full brightness when showing code
master
Phil Roggenbuck 2024-03-03 14:05:09 +01:00 committed by GitHub
parent 4b38e2af42
commit a15e8b665d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 1 deletions

View File

@ -1,2 +1,3 @@
0.01: Simple app to display loyalty cards
0.02: Hiding widgets while showing the code
0.03: Added option to use max brightness when showing code

View File

@ -14,6 +14,22 @@
Bangle.loadWidgets();
Bangle.drawWidgets();
// get brightness
let brightness;
function loadBrightness() {
try {
const d = require('Storage').readJSON("setting.json", 1) || {};
brightness = Object.assign({
'brightness': 0.1
}, d || {});
return d;
} catch(e){
console.log(e.toString());
return;
}
}
//may make it configurable in the future
const WHITE=-1
const BLACK=0
@ -89,6 +105,9 @@ function printLinearCode(binary) {
}
function showCode(card) {
if(settings.fullBrightness) {
Bangle.setLCDBrightness(1);
}
widget_utils.hide();
E.showScroller();
// keeping it on rising edge would come back twice..
@ -129,6 +148,9 @@ function showCode(card) {
}
function showCard(card) {
if(settings.fullBrightness) {
Bangle.setLCDBrightness(brightness.brightness);
}
var lines = [];
var bodyFont = fontBig;
if(!card) return;
@ -208,4 +230,7 @@ function showList() {
back : () => load()
});
}
if(settings.fullBrightness) {
loadBrightness();
}
showList();

View File

@ -1,7 +1,7 @@
{
"id": "cards",
"name": "Cards",
"version": "0.02",
"version": "0.03",
"description": "Display loyalty cards",
"icon": "app.png",
"screenshots": [{"url":"screenshot_cards_overview.png"}, {"url":"screenshot_cards_card1.png"}, {"url":"screenshot_cards_card2.png"}, {"url":"screenshot_cards_barcode.png"}, {"url":"screenshot_cards_qrcode.png"}],

View File

@ -14,6 +14,13 @@
updateSettings();
}
},
/*LANG*/"Full Brightness" : {
value : !!settings.fullBrightness,
onchange: v => {
settings.fullBrightness = v;
updateSettings();
}
}
};
E.showMenu(mainmenu);
})