From 0d2ca998b5a549de4f6f32b525db769619471afa Mon Sep 17 00:00:00 2001 From: Graham Fenner Date: Sat, 13 Jan 2024 21:21:37 +0000 Subject: [PATCH] barometer remove if already on code, dont know duration --- libs/banglejs/jswrap_bangle.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/libs/banglejs/jswrap_bangle.c b/libs/banglejs/jswrap_bangle.c index 1e7da116db..1b714982f1 100644 --- a/libs/banglejs/jswrap_bangle.c +++ b/libs/banglejs/jswrap_bangle.c @@ -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"); @@ -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);