fixed issue on tempmonitor and minor fiixes

fixed issue on tempmonitor and minor fiixes
pull/2755/head
dapgo 2023-05-14 15:36:07 +02:00
parent 01d4cea940
commit ceec7612eb
5 changed files with 19 additions and 7 deletions

View File

@ -7,7 +7,7 @@
"type": "clock",
"tags": "clock",
"screenshots": [{"url":"ss_mixdigan_ems.png"}],
"supports": ["BANGLEJS","BANGLEJS"],
"supports": ["BANGLEJS","BANGLEJS2"],
"readme": "README.md",
"allow_emulator": true,
"storage": [

View File

@ -2,3 +2,4 @@
0.02: added HTML interface
0.03: Added Stop/start recording, change BG color, filesize info
0.04: Support for negative degree, Min/Max, random for emulator, clean of code
0.05: Fix issue on BJS2 caused by Bangle.getPressure promise

View File

@ -1,7 +1,7 @@
{
"id": "tempmonitor",
"name": "Temperature monitor",
"version": "0.04",
"version": "0.05",
"description": "Another thermometer, besides displaying current temperature, stores it in a CSV file",
"icon": "app.png",
"tags": "tool",

View File

@ -5,7 +5,7 @@
SetUI, Layout, and setWatch( function(b) { }, BTN1, { repeat: true, edge:'falling' })
*/
{
var v_mode_debug=0; //, 0=no, 1 min, 2 prone detail
var v_mode_debug=2; //, 0=no, 1 min, 2 prone detail
//var required for drawing with dynamic screen
var rect = Bangle.appRect;
var history = [];
@ -106,9 +106,20 @@ g.flip();
// from: BJS2 pressure sensor, BJS1 inbuilt thermistor
function getTemperature() {
if(v_model.substr(0,10)!='EMSCRIPTEN'){
/*//supposed more aqcurate and it works but sometimes promise fails
//Uncaught Error: Unhandled promise rejection: undefined
if (Bangle.getPressure) {
Bangle.getPressure().then(p =>{if (p) printTemperature(p);});
if (v_mode_debug>1) console.log("getpressure supported but..");
//v_pressure=Bangle.getPressure().then(print);
//wait for premise
Bangle.getPressure().then(p =>{if (p) v_pressureTemp=p.temperature; v_pressurePress=p.pressure;
if (v_mode_debug>1) console.log("getpressure t, p: "+v_pressureTemp+" , "+v_pressurePress);
if ((v_pressureTemp) && (v_pressureTemp!="")) printTemperature(v_pressureTemp)
else printTemperature(E.getTemperature());
});
} else printTemperature(E.getTemperature());
}*/
printTemperature(E.getTemperature());
}
else printTemperature(-11.2+Math.random());//fake temperature medition for emulators
}

View File

@ -1 +1 @@
{"id":"tempmonitor","name":"tempmonitor","src":"tempmonitor.app.js","icon":"tempmonitor.img","version":"0.04","files":"tempmonitor.info,tempmonitor.app.js,tempmonitor.img"}
{"id":"tempmonitor","name":"tempmonitor","src":"tempmonitor.app.js","icon":"tempmonitor.img","version":"0.05","files":"tempmonitor.info,tempmonitor.app.js,tempmonitor.img"}