From b58bf716b35e99a721daf2035952b3f238ff6a8c Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Fri, 13 Jan 2023 21:45:20 +0100 Subject: [PATCH] android - More compact serial method wrapping --- apps/android/boot.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 2b430b9dc..1dd92bcc0 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -221,15 +221,14 @@ NRF.on('disconnect', ()=>{handleConnection(0);}); // Work around Serial1 for GPS not working when connected to something - // - Serial1.println = (o => s => { - origSetGPSPower(1,"android_gpsserial"); - o(s); - })(Serial1.println); - Serial1.write = (o => s => { - origSetGPSPower(1,"android_gpsserial"); - o(s); - })(Serial1.write); + let wrap = function(f){ + return (s)=>{ + origSetGPSPower(1,"android_gpsserial"); + f(s); + }; + } + Serial.println = wrap(Serial1.println); + Serial.write = wrap(Serial1.write); // Replace set GPS power logic to suppress activation of gps (and instead request it from the phone) Bangle.setGPSPower = (isOn, appID) => {