mirror of https://github.com/espruino/BangleApps
Use NRF.getSecurityStatus().advertising for initial state
parent
d9dc729abd
commit
832ec7a7a5
|
@ -2,9 +2,14 @@
|
|||
(function () {
|
||||
"ram";
|
||||
var _a;
|
||||
var state = NRF.getSecurityStatus().connected
|
||||
? 2
|
||||
: 0;
|
||||
var state = (function () {
|
||||
var status = NRF.getSecurityStatus();
|
||||
if (status.connected)
|
||||
return 2;
|
||||
if (status.advertising)
|
||||
return 1;
|
||||
return 0;
|
||||
})();
|
||||
var width = function () { return state > 0 ? 15 : 0; };
|
||||
var update = function (newState) {
|
||||
state = newState;
|
||||
|
|
|
@ -7,9 +7,13 @@
|
|||
Connected
|
||||
}
|
||||
|
||||
let state: State = NRF.getSecurityStatus().connected
|
||||
? State.Connected
|
||||
: State.Asleep; // could be active, assuming not here
|
||||
let state: State = (() => {
|
||||
const status = NRF.getSecurityStatus();
|
||||
|
||||
if (status.connected) return State.Connected;
|
||||
if (status.advertising) return State.Active;
|
||||
return State.Asleep;
|
||||
})();
|
||||
|
||||
const width = () => state > State.Asleep ? 15 : 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue