Skip to content

Commit

Permalink
barometer remove if already on code, dont know duration
Browse files Browse the repository at this point in the history
  • Loading branch information
d3nd3 committed Jan 13, 2024
1 parent fad5a2e commit 0d2ca99
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions libs/banglejs/jswrap_bangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -4243,7 +4243,7 @@ bool jswrap_banglejs_idle() {
JsVar *o = jswrap_banglejs_getBarometerObject();
if (o) {
jsiQueueObjectCallbacks(bangle, JS_EVENT_PREFIX"pressure", &o, 1);
if ( getPressureReady ) {
if (getPressureReady) {
getPressureReady = false;
// disable sensor now we have a result
JsVar *id = jsvNewFromString("getPressure");
Expand Down Expand Up @@ -5059,16 +5059,6 @@ JsVar *jswrap_banglejs_getPressure() {
promisePressure = jspromise_create();
if (!promisePressure) return 0;

// If barometer is already on, just resolve promise with the current result
if (bangleFlags & JSBF_BAROMETER_ON) {
JsVar *o = jswrap_banglejs_getBarometerObject();
jspromise_resolve(promisePressure, o);
jsvUnLock(o);
JsVar *r = promisePressure;
promisePressure = 0;
return r;
}

JsVar *id = jsvNewFromString("getPressure");
jswrap_banglejs_setBarometerPower(1, id);
jsvUnLock(id);
Expand Down

0 comments on commit 0d2ca99

Please sign in to comment.