forked from FOSS/BangleApps
Tidy tooltip, display invalid core as n/a
parent
73f2225354
commit
19126205b9
|
@ -28,8 +28,16 @@ class CoreSensor {
|
|||
this.unit = "C";
|
||||
}
|
||||
|
||||
if (flags & 1) this.skin = (dv.buffer[4] * 256 + dv.buffer[3]) / 100;
|
||||
if (flags & 2) this.core = (dv.buffer[2] * 256 + dv.buffer[1]) / 100;
|
||||
if (flags & 1) {
|
||||
this.skin = (dv.buffer[4] * 256 + dv.buffer[3]) / 100;
|
||||
} else {
|
||||
this.skin = 0;
|
||||
}
|
||||
if (flags & 2) {
|
||||
this.core = (dv.buffer[2] * 256 + dv.buffer[1]) / 100;
|
||||
} else {
|
||||
this.core = 0;
|
||||
}
|
||||
|
||||
Bangle.emit('CoreTemp',
|
||||
{core : this.core, skin : this.skin, unit : this.unit});
|
||||
|
@ -79,8 +87,8 @@ function connection_setup() {
|
|||
})
|
||||
.then(function() {
|
||||
console.log("Done!");
|
||||
// getSensorBatteryLevel(gatt);
|
||||
// g.reset().clearRect(Bangle.appRect).flip();
|
||||
// getSensorBatteryLevel(gatt);
|
||||
// g.reset().clearRect(Bangle.appRect).flip();
|
||||
})
|
||||
.catch(function(e) {
|
||||
console.log(e.toString(), "ERROR");
|
||||
|
@ -89,16 +97,17 @@ function connection_setup() {
|
|||
}
|
||||
|
||||
function connection_end() {
|
||||
if (gatt != undefined) gatt.disconnect();
|
||||
if (gatt != undefined)
|
||||
gatt.disconnect();
|
||||
}
|
||||
|
||||
settings = require("Storage").readJSON("coretemp.json",1)||{};
|
||||
settings = require("Storage").readJSON("coretemp.json", 1) || {};
|
||||
console.log("Settings:");
|
||||
console.log(settings);
|
||||
|
||||
if (settings.enabled) {
|
||||
connection_setup();
|
||||
NRF.on('disconnect', connection_setup);
|
||||
connection_setup();
|
||||
NRF.on('disconnect', connection_setup);
|
||||
}
|
||||
|
||||
E.on('kill', () => { connection_end(); });
|
||||
|
|
|
@ -20,9 +20,9 @@ var corelogo = {
|
|||
|
||||
function onCore(c) {
|
||||
g.setFontAlign(0, 0);
|
||||
g.clearRect(0, 48 + 48, g.getWidth(), 48 + 48 + 24 * 2);
|
||||
g.clearRect(0, 32 + 48, g.getWidth(), 32 + 48 + 24 * 3);
|
||||
g.setColor(0xC618); // Light gray
|
||||
g.setFont("6x8", 3).drawString("Core: " + c.core + c.unit, px, 48 + 48);
|
||||
g.setFont("6x8", 3).drawString("Core: " + ((c.core<327)?(c.core + c.unit):'n/a'), px, 48 + 48);
|
||||
g.setFont("6x8", 3).drawString("Skin: " + c.skin + c.unit, px, 48 + 48 + 24);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
}
|
||||
|
||||
g.drawImage(
|
||||
atob(
|
||||
"GBgBAAHwAHP4A+f8B+4cH+4MH84cPwYcfAf4eAP4+AHi+AAO8AAe8AAe8AAe+AAG+AA4eAA8fAB8PgD4P8b4H/7wB/9gA/8AAP4A"),
|
||||
this.x, this.y);
|
||||
atob("DAyBAAHh0js3EuDMA8A8AWBnDj9A8A=="),
|
||||
this.x+(24-12)/2,this.y+1);
|
||||
|
||||
g.setColor(g.theme.fg);
|
||||
g.drawString(core, this.x + 24 / 2, this.y + 19);
|
||||
g.drawString(parseInt(core)+"\n."+parseInt((core*100)%100), this.x + 24 / 2, this.y + 18);
|
||||
|
||||
g.setColor(-1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue