general widget fixes and tweaks

pull/873/head
Gordon Williams 2021-10-29 20:21:12 +01:00
parent b878a9bb37
commit aeaf508897
7 changed files with 34 additions and 43 deletions

View File

@ -1628,7 +1628,7 @@
{
"id": "widver",
"name": "Firmware Version Widget",
"version": "0.02",
"version": "0.03",
"description": "Display the version of the installed firmware in the top widget section.",
"icon": "widget.png",
"type": "widget",
@ -1783,7 +1783,7 @@
{
"id": "widmp",
"name": "Moon Phase Widget",
"version": "0.01",
"version": "0.02",
"description": "Display the current moon phase in blueish for the northern hemisphere in eight phases",
"icon": "widget.png",
"type": "widget",
@ -3434,7 +3434,7 @@
{
"id": "widgps",
"name": "GPS Widget",
"version": "0.02",
"version": "0.03",
"description": "Tiny widget to show the power on/off status of the GPS. Require firmware v2.08.167 or later",
"icon": "widget.png",
"type": "widget",

View File

@ -1,2 +1,3 @@
0.01: First version
0.02: Don't break if running on 2v08 firmware (just don't display anything)
0.03: Fix positioning

View File

@ -4,11 +4,11 @@
function draw() {
g.reset();
if (Bangle.isGPSOn()) {
g.setColor(1,0.8,0); // on = amber
g.setColor("#FD0"); // on = amber
} else {
g.setColor(0.3,0.3,0.3); // off = grey
g.setColor("#888"); // off = grey
}
g.drawImage(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="), 10+this.x, 2+this.y);
g.drawImage(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="), this.x, 2+this.y);
}
var timerInterval;

View File

@ -1 +1,3 @@
0.01: New App!
0.02: Fix position and overdraw bugs
Better memory usage, theme support

View File

@ -1,20 +1,6 @@
/* jshint esversion: 6 */
(() => {
const BLACK = 0, MOON = 0x41f, MC = 29.5305882, NM = 694039.09;
var r = 12, mx = 0, my = 0;
var moon = {
0: () => { g.reset().setColor(BLACK).fillRect(mx - r, my - r, mx + r, my + r);},
1: () => { moon[0](); g.setColor(MOON).drawCircle(mx, my, r);},
2: () => { moon[3](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
3: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx - r, my - r, mx, my + r);},
4: () => { moon[3](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
5: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r);},
6: () => { moon[7](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
7: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx, my - r, mx + r + r, my + r);},
8: () => { moon[7](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);}
};
WIDGETS["widmoon"] = { area: "tr", width: 24, draw: function() {
const MC = 29.5305882, NM = 694039.09;
var r = 11, mx = this.x + 12; my = this.y + 12;
function moonPhase(d) {
var tmp, month = d.getMonth(), year = d.getFullYear(), day = d.getDate();
@ -23,11 +9,18 @@
return Math.round(((tmp - (tmp | 0)) * 7)+1);
}
function draw() {
mx = this.x; my = this.y + 12;
const BLACK = g.theme.bg, MOON = 0x41f;
var moon = {
0: () => { g.reset().setColor(BLACK).fillRect(mx - r, my - r, mx + r, my + r);},
1: () => { moon[0](); g.setColor(MOON).drawCircle(mx, my, r);},
2: () => { moon[3](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
3: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx - r, my - r, mx, my + r);},
4: () => { moon[3](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
5: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r);},
6: () => { moon[7](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);},
7: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx, my - r, mx + r, my + r);},
8: () => { moon[7](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);}
};
moon[moonPhase(Date())]();
}
} };
WIDGETS["widmoon"] = { area: "tr", width: 24, draw: draw };
})();

View File

@ -1,2 +1,3 @@
0.01: New Widget
0.02: Display "Rel" (Release) instead of 'undefined' when there is no Build number.
0.03: Add theme support, lower memory usage

View File

@ -1,15 +1,9 @@
/* jshint esversion: 6 */
(() => {
var width = 28,
ver = process.env.VERSION.split('.');
WIDGETS["version"] = { area: "tr", width: 28, draw: function() {
var ver = process.env.VERSION.split('.');
// Example: if ver is 2v11 instead of 2v10.142 write "Rel" (Release) instead of Build number
if(typeof ver[1] === 'undefined'){ver[1] = "Rel";}
if(typeof ver[1] === 'undefined') ver[1] = "Rel";
function draw() {
g.reset().setColor(0, 0.5, 1).setFont("6x8", 1);
g.reset().setColor((g.getBPP()<8)?(g.theme.dark?"#0ff":"#00f"):"#08f").setFont("6x8");
g.drawString(ver[0], this.x + 2, this.y + 4, true);
g.setFontAlign(0, -1, 0).drawString(ver[1], this.x + width / 2, this.y + 14, true);
}
WIDGETS["version"] = { area: "tr", width: width, draw: draw };
})();
g.setFontAlign(0, -1, 0).drawString(ver[1], this.x + this.width / 2, this.y + 14, true);
} };