1
0
Fork 0

tweaks for low BPP screens

master
Gordon Williams 2021-06-22 09:36:57 +01:00
parent cd329f5f20
commit 50c7c15a50
9 changed files with 26 additions and 22 deletions

View File

@ -576,7 +576,7 @@
{ "id": "widbat",
"name": "Battery Level Widget",
"icon": "widget.png",
"version":"0.06",
"version":"0.07",
"description": "Show the current battery level and charging status in the top right of the clock",
"tags": "widget,battery",
"type":"widget",
@ -587,7 +587,7 @@
{ "id": "widlock",
"name": "Lock Widget",
"icon": "widget.png",
"version":"0.02",
"version":"0.03",
"description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked",
"tags": "widget,lock",
"type":"widget",
@ -632,7 +632,7 @@
{ "id": "widbt",
"name": "Bluetooth Widget",
"icon": "widget.png",
"version":"0.04",
"version":"0.05",
"description": "Show the current Bluetooth connection status in the top right of the clock",
"tags": "widget,bluetooth",
"type":"widget",
@ -1143,7 +1143,7 @@
{ "id": "widpedom",
"name": "Pedometer widget",
"icon": "widget.png",
"version":"0.13",
"version":"0.14",
"description": "Daily pedometer widget",
"tags": "widget",
"type":"widget",

View File

@ -3,3 +3,4 @@
0.04: Ensure redrawing works with variable size widget system
0.05: Fix regression stopping correct widget updates
0.06: Use 'g.theme' (requires bootloader 0.23)
0.07: Move CHARGING variable to more readable string

View File

@ -1,5 +1,4 @@
(function(){
var CHARGING = 0x07E0;
function setWidth() {
WIDGETS["bat"].width = 40 + (Bangle.isCharging()?16:0);
@ -9,14 +8,14 @@
var x = this.x, y = this.y;
g.reset();
if (Bangle.isCharging()) {
g.setColor(CHARGING).drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
g.setColor("#0f0").drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
x+=16;
}
g.setColor(g.theme.fg);
g.fillRect(x,y+2,x+s-4,y+21);
g.clearRect(x+2,y+4,x+s-6,y+19);
g.fillRect(x+s-3,y+10,x+s,y+14);
g.setColor(CHARGING).fillRect(x+4,y+6,x+4+E.getBattery()*(s-12)/100,y+17);
g.setColor("#0f0").fillRect(x+4,y+6,x+4+E.getBattery()*(s-12)/100,y+17);
}
Bangle.on('charging',function(charging) {
if(charging) Bangle.buzz();

View File

@ -1,3 +1,4 @@
0.02: Tweaks for variable size widget system
0.03: Ensure redrawing works with variable size widget system
0.04: Fix automatic update of Bluetooth connection status
0.05: Make Bluetooth widget thinner, and when on a bright theme use light grey for disabled color

View File

@ -2,10 +2,10 @@
function draw() {
g.reset();
if (NRF.getSecurityStatus().connected)
g.setColor(0,0.5,1);
g.setColor("#07f");
else
g.setColor(0.3,0.3,0.3);
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),10+this.x,2+this.y);
g.setColor(g.theme.bg ? "#AAA" : "#555");
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y);
}
function changed() {
WIDGETS["bluetooth"].draw();
@ -13,5 +13,5 @@
}
NRF.on('connect',changed);
NRF.on('disconnect',changed);
WIDGETS["bluetooth"]={area:"tr",width:24,draw:draw};
WIDGETS["bluetooth"]={area:"tr",width:15,draw:draw};
})()

View File

@ -1,2 +1,3 @@
0.01: First commit
0.02: Handle new firmwares with 'lock' event
0.03: Don't try to be fancy - just bail out on firmwares without a lock event

View File

@ -1,12 +1,11 @@
(function(){
Bangle.on(Bangle.isLocked?'lock':'lcdPower', function(on) {
WIDGETS["lock"].width = Bangle.isLocked()?0:16;
if (!Bangle.isLocked) return; // bail out on old firmware
Bangle.on("lock", function(on) {
WIDGETS["lock"].width = Bangle.isLocked()?16:0;
Bangle.drawWidgets();
});
if (Bangle.isLocked===undefined)
Bangle.isLocked = Bangle.isLCDOn;
WIDGETS["lock"]={area:"tl",width:Bangle.isLocked()?0:16,draw:function(w) {
if (!Bangle.isLocked())
WIDGETS["lock"]={area:"tl",width:Bangle.isLocked()?16:0,draw:function(w) {
if (Bangle.isLocked())
g.reset().drawImage(atob("DhABH+D/wwMMDDAwwMf/v//4f+H/h/8//P/z///f/g=="), w.x+1, w.y+4);
}};
})()

View File

@ -10,3 +10,4 @@
0.11: added getSteps() method for apps to retrieve step count
0.12: Respect Quiet Mode
0.13: Now use system color theme
0.14: Improve memory usage

View File

@ -1,10 +1,5 @@
(() => {
const PEDOMFILE = "wpedom.json"
const DEFAULTS = {
'goal': 10000,
'progress': false,
}
const TAU = Math.PI*2;
let lastUpdate = new Date();
let stp_today = 0;
let settings;
@ -16,6 +11,10 @@
function setting(key) {
if (!settings) { loadSettings() }
const DEFAULTS = {
'goal': 10000,
'progress': false,
}
return (key in settings) ? settings[key] : DEFAULTS[key];
}
@ -24,6 +23,7 @@
const goal = setting('goal'), left = Math.max(goal-stps,0);
const c = left ? "#00f" : "#090"; // blue or dark green
g.setColor(c).fillCircle(this.x + half, this.y + half, half);
const TAU = Math.PI*2;
if (left) {
const f = left/goal; // fraction to blank out
let p = [];
@ -64,6 +64,7 @@
}
g.setFontAlign(0, 0); // align to x: center, y: center
g.drawString(stps, this.x+width/2, this.y+19);
// on low bpp screens, draw 1 bit. Currently there is no getBPP so we just do it based on resolution
g.drawImage(atob("CgoCLguH9f2/7+v6/79f56CtAAAD9fw/n8Hx9A=="),this.x+(width-10)/2,this.y+2);
}
@ -118,5 +119,6 @@
if (pedomData.lastUpdate)
lastUpdate = new Date(pedomData.lastUpdate);
stp_today = pedomData.stepsToday|0;
delete pedomData;
}
})()