Allow changing qr code brightness on touch

pull/1185/head
Martin Boonk 2021-12-28 12:37:21 +01:00
parent 29b231bf65
commit e4eea377d7
3 changed files with 13 additions and 2 deletions

View File

@ -1148,7 +1148,7 @@
{
"id": "qrcode",
"name": "Custom QR Code",
"version": "0.04",
"version": "0.05",
"description": "Use this to upload a customised QR code to Bangle.js",
"icon": "app.png",
"tags": "qrcode",

View File

@ -2,3 +2,4 @@
0.02: Add posibillity to generate Wifi code.
0.03: Forces integer scaling and adds more configuration (error correction, description, display)
0.04: Allow scanning of QR codes from camera or file
0.05: Change brightness on touch

View File

@ -72,8 +72,10 @@
<p>Additional options:</p>
<input type="checkbox" id="preventIntegerScaling" name="preventIntegerScaling"/>
<label for="preventIntegerScaling">Prevent integer scaling</label></br>
<input type="checkbox" id="preventBrightnessChangeOnTouch" name="preventBrightnessChangeOnTouch"/>
<label for="preventBrightnessChangeOnTouch">Prevent brightness change on touch</label></br>
<input type="checkbox" id="boostBacklight" name="boostBacklight"/>
<label for="boostBacklight">Set backlight to max. while QR is shown</label></br>
<label for="boostBacklight">Set initial backlight to max. while QR is shown</label></br>
<input type="checkbox" id="stayOn" name="stayOn"/>
<label for="stayOn">Do not lock or dim while showing QR</label></br>
<input type="checkbox" id="hideDescription" name="hideDescription"/>
@ -287,6 +289,14 @@
}
var img = imageconverter.canvastoString(document.getElementsByTagName("canvas")[0],{mode:"1bit",output:"string",compression:true});
var app = `var img = ${img};
${ document.getElementById("preventBrightnessChangeOnTouch").checked ? '' : `var backlight = 0;
Bangle.on('touch', function(button, xy) {
backlight += 0.3;
if (backlight > 1) backlight = 0;
Bangle.setLCDBrightness(backlight);
});
`}
${document.getElementById("boostBacklight").checked ? 'Bangle.setLCDBrightness(1);' : ''}
${document.getElementById("stayOn").checked ? 'Bangle.setLCDTimeout(0);' : ''}
${document.getElementById("hideDescription").checked ? '' : `var content = ${JSON.stringify(content)};`}