android - Use handler method to switch to internal GPS when Serial is accessed
parent
d85e884e2a
commit
e5f6ea674f
|
|
@ -225,12 +225,12 @@
|
||||||
let wrap = function(f){
|
let wrap = function(f){
|
||||||
return (s)=>{
|
return (s)=>{
|
||||||
if (serialTimeout) clearTimeout(serialTimeout);
|
if (serialTimeout) clearTimeout(serialTimeout);
|
||||||
origSetGPSPower(1,"android_gpsserial");
|
handleConnection(1);
|
||||||
f(s);
|
f(s);
|
||||||
serialTimeout = setTimeout(()=>{
|
serialTimeout = setTimeout(()=>{
|
||||||
serialTimeout = undefined;
|
serialTimeout = undefined;
|
||||||
origSetGPSPower(0,"android_gpsserial");
|
if (NRF.getSecurityStatus().connected) handleConnection(0);
|
||||||
},5000);
|
}, 10000);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Serial1.println = wrap(Serial1.println);
|
Serial1.println = wrap(Serial1.println);
|
||||||
|
|
@ -238,7 +238,6 @@
|
||||||
|
|
||||||
// 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) => {
|
||||||
// disable our own request for GPS power first and always
|
|
||||||
// if not connected use internal GPS power function
|
// if not connected use internal GPS power function
|
||||||
if (!NRF.getSecurityStatus().connected) return origSetGPSPower(isOn, appID);
|
if (!NRF.getSecurityStatus().connected) return origSetGPSPower(isOn, appID);
|
||||||
if (!Bangle._PWR) Bangle._PWR={};
|
if (!Bangle._PWR) Bangle._PWR={};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue