Cards App added brightness option
Added an option to use full brightness when showing codemaster
parent
4b38e2af42
commit
a15e8b665d
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: Simple app to display loyalty cards
|
0.01: Simple app to display loyalty cards
|
||||||
0.02: Hiding widgets while showing the code
|
0.02: Hiding widgets while showing the code
|
||||||
|
0.03: Added option to use max brightness when showing code
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,22 @@
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
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
|
//may make it configurable in the future
|
||||||
const WHITE=-1
|
const WHITE=-1
|
||||||
const BLACK=0
|
const BLACK=0
|
||||||
|
|
@ -89,6 +105,9 @@ function printLinearCode(binary) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCode(card) {
|
function showCode(card) {
|
||||||
|
if(settings.fullBrightness) {
|
||||||
|
Bangle.setLCDBrightness(1);
|
||||||
|
}
|
||||||
widget_utils.hide();
|
widget_utils.hide();
|
||||||
E.showScroller();
|
E.showScroller();
|
||||||
// keeping it on rising edge would come back twice..
|
// keeping it on rising edge would come back twice..
|
||||||
|
|
@ -129,6 +148,9 @@ function showCode(card) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCard(card) {
|
function showCard(card) {
|
||||||
|
if(settings.fullBrightness) {
|
||||||
|
Bangle.setLCDBrightness(brightness.brightness);
|
||||||
|
}
|
||||||
var lines = [];
|
var lines = [];
|
||||||
var bodyFont = fontBig;
|
var bodyFont = fontBig;
|
||||||
if(!card) return;
|
if(!card) return;
|
||||||
|
|
@ -208,4 +230,7 @@ function showList() {
|
||||||
back : () => load()
|
back : () => load()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(settings.fullBrightness) {
|
||||||
|
loadBrightness();
|
||||||
|
}
|
||||||
showList();
|
showList();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "cards",
|
"id": "cards",
|
||||||
"name": "Cards",
|
"name": "Cards",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "Display loyalty cards",
|
"description": "Display loyalty cards",
|
||||||
"icon": "app.png",
|
"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"}],
|
"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"}],
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@
|
||||||
updateSettings();
|
updateSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/*LANG*/"Full Brightness" : {
|
||||||
|
value : !!settings.fullBrightness,
|
||||||
|
onchange: v => {
|
||||||
|
settings.fullBrightness = v;
|
||||||
|
updateSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
E.showMenu(mainmenu);
|
E.showMenu(mainmenu);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue