Ring will only be redrawn of it needs changing since its last update
parent
109c10f960
commit
78e7df2256
|
|
@ -23,7 +23,7 @@ See [#1248](https://github.com/espruino/BangleApps/issues/1248)
|
||||||
* In the settings, the ring can be set to:
|
* In the settings, the ring can be set to:
|
||||||
* Hours - Displays the ring as though it's the hour hand on an analog clock.
|
* Hours - Displays the ring as though it's the hour hand on an analog clock.
|
||||||
* Minutes - Displays the ring as though it's the minute hand on an analog clock.
|
* Minutes - Displays the ring as though it's the minute hand on an analog clock.
|
||||||
* Seconds - Displays the ring as though it's the seconds hand on an analog clock.
|
* Seconds - Displays the ring as though it's the seconds hand on an analog clock. This option uses far more battery than any other option as it updates the screen 60 times more often.
|
||||||
* Day - Displays the ring as how much of the day is left. Functionally, it fills the ring half as quickly as the Hours option.
|
* Day - Displays the ring as how much of the day is left. Functionally, it fills the ring half as quickly as the Hours option.
|
||||||
* Steps - Displays the ring as the amount of steps taken that day out of Step Target setting.
|
* Steps - Displays the ring as the amount of steps taken that day out of Step Target setting.
|
||||||
* Battery - Displays the ring as the amount of battery percentage left.
|
* Battery - Displays the ring as the amount of battery percentage left.
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,11 @@ let pal2; // palette for 50-100%
|
||||||
const infoLine = (3*h/4) - 6;
|
const infoLine = (3*h/4) - 6;
|
||||||
const infoWidth = 56;
|
const infoWidth = 56;
|
||||||
const infoHeight = 11;
|
const infoHeight = 11;
|
||||||
|
const textStartWidth = 28;
|
||||||
|
const textStartHeight = 44;
|
||||||
const sec_update = 1000; // This ms between updates when the ring is in Seconds mode
|
const sec_update = 1000; // This ms between updates when the ring is in Seconds mode
|
||||||
var drawingSteps = false;
|
var drawingSteps = false;
|
||||||
|
var prevRing = {start: null, end: null, max: null};
|
||||||
|
|
||||||
function log_debug(o) {
|
function log_debug(o) {
|
||||||
//print(o);
|
//print(o);
|
||||||
|
|
@ -322,7 +325,10 @@ function drawGaugeImage(date) {
|
||||||
start = max - end;
|
start = max - end;
|
||||||
end = max;
|
end = max;
|
||||||
}
|
}
|
||||||
|
if (end !== prevRing.end || start !== prevRing.start || ring_max !== prevRing.max) {
|
||||||
drawRing(start, end, ring_max);
|
drawRing(start, end, ring_max);
|
||||||
|
prevRing = {start: start, end: end, max: ring_max};
|
||||||
|
}
|
||||||
log_debug("Start: "+ start + " end: " +end);
|
log_debug("Start: "+ start + " end: " +end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,7 +346,7 @@ function drawClock() {
|
||||||
|
|
||||||
g.reset();
|
g.reset();
|
||||||
g.setColor(g.theme.bg);
|
g.setColor(g.theme.bg);
|
||||||
g.fillRect(0, 0, w, h);
|
g.fillRect(textStartWidth, textStartHeight, w-textStartWidth, h-textStartHeight); // Clears the text within the circle
|
||||||
drawGaugeImage(date);
|
drawGaugeImage(date);
|
||||||
setLargeFont();
|
setLargeFont();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue