Fixes consumer indicators and adds home button
parent
f88f875694
commit
9daf178fc1
|
|
@ -142,7 +142,7 @@ function renderData(dataArray) {
|
|||
g.setPixel(GraphXZero + i, GraphYZero - scaledTemp);
|
||||
|
||||
// LCD state
|
||||
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.lcd == switchableConsumers.lcd) {
|
||||
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.lcd) {
|
||||
g.setColor(1, 1, 1);
|
||||
g.setFontAlign(1, -1, 0);
|
||||
g.drawString("LCD", GraphXZero - GraphMarkerOffset, GraphLcdY - 2, true);
|
||||
|
|
@ -150,7 +150,7 @@ function renderData(dataArray) {
|
|||
}
|
||||
|
||||
// Compass state
|
||||
if (switchables & switchableConsumers.lcd == switchableConsumers.lcd) {
|
||||
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.compass) {
|
||||
g.setColor(0, 1, 0);
|
||||
g.setFontAlign(-1, -1, 0);
|
||||
g.drawString("Compass", GraphXMax + GraphMarkerOffset, GraphCompassY - 2, true);
|
||||
|
|
@ -166,7 +166,7 @@ function renderData(dataArray) {
|
|||
// }
|
||||
|
||||
// Gps state
|
||||
if (switchables & switchableConsumers.lcd == switchableConsumers.lcd) {
|
||||
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.gps) {
|
||||
g.setColor(0.8, 0.5, 0.24);
|
||||
g.setFontAlign(-1, -1, 0);
|
||||
g.drawString("GPS", GraphXMax + GraphMarkerOffset, GraphGpsY - 2, true);
|
||||
|
|
@ -174,7 +174,7 @@ function renderData(dataArray) {
|
|||
}
|
||||
|
||||
// Hrm state
|
||||
if (switchables & switchableConsumers.lcd == switchableConsumers.lcd) {
|
||||
if (parseInt(dataInfo[switchabelsIndex]) & switchableConsumers.hrm) {
|
||||
g.setColor(1, 0, 0);
|
||||
g.setFontAlign(1, -1, 0);
|
||||
g.drawString("HRM", GraphXZero - GraphMarkerOffset, GraphHrmY - 2, true);
|
||||
|
|
@ -185,6 +185,16 @@ function renderData(dataArray) {
|
|||
dataArray = null;
|
||||
}
|
||||
|
||||
function renderHomeIcon() {
|
||||
//Home for Btn2
|
||||
g.setColor(1, 1, 1);
|
||||
g.drawLine(220, 118, 227, 110);
|
||||
g.drawLine(227, 110, 234, 118);
|
||||
|
||||
g.drawPoly([222,117,222,125,232,125,232,117], false);
|
||||
g.drawRect(226,120,229,125);
|
||||
}
|
||||
|
||||
function renderBatteryChart() {
|
||||
renderCoordinateSystem();
|
||||
let data = loadData();
|
||||
|
|
@ -192,21 +202,30 @@ function renderBatteryChart() {
|
|||
data = null;
|
||||
}
|
||||
|
||||
// Show launcher when middle button pressed
|
||||
function switchOffApp(){
|
||||
Bangle.showLauncher();
|
||||
}
|
||||
|
||||
// special function to handle display switch on
|
||||
Bangle.on('lcdPower', (on) => {
|
||||
if (on) {
|
||||
// call your app function here
|
||||
// If you clear the screen, do Bangle.drawWidgets();
|
||||
g.clear()
|
||||
g.clear();
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
renderBatteryChart();
|
||||
}
|
||||
});
|
||||
|
||||
setWatch(switchOffApp, BTN2, {edge:"rising", debounce:50, repeat:true});
|
||||
|
||||
g.clear();
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
// call your app function here
|
||||
|
||||
renderHomeIcon();
|
||||
|
||||
renderBatteryChart();
|
||||
|
|
|
|||
Loading…
Reference in New Issue