1
0
Fork 0

android - More compact serial method wrapping

master
Martin Boonk 2023-01-13 21:45:20 +01:00
parent 966a867d60
commit b58bf716b3
1 changed files with 8 additions and 9 deletions

View File

@ -221,15 +221,14 @@
NRF.on('disconnect', ()=>{handleConnection(0);}); NRF.on('disconnect', ()=>{handleConnection(0);});
// Work around Serial1 for GPS not working when connected to something // Work around Serial1 for GPS not working when connected to something
// let wrap = function(f){
Serial1.println = (o => s => { return (s)=>{
origSetGPSPower(1,"android_gpsserial"); origSetGPSPower(1,"android_gpsserial");
o(s); f(s);
})(Serial1.println); };
Serial1.write = (o => s => { }
origSetGPSPower(1,"android_gpsserial"); Serial.println = wrap(Serial1.println);
o(s); Serial.write = wrap(Serial1.write);
})(Serial1.write);
// Replace set GPS power logic to suppress activation of gps (and instead request it from the phone) // Replace set GPS power logic to suppress activation of gps (and instead request it from the phone)
Bangle.setGPSPower = (isOn, appID) => { Bangle.setGPSPower = (isOn, appID) => {