2024-12-22 23:37:43 +01:00
|
|
|
require("FontTeletext5x9Ascii").add(Graphics);
|
|
|
|
require("FontHaxorNarrow7x17").add(Graphics);
|
|
|
|
|
|
|
|
function scanForDevices() {
|
|
|
|
NRF.findDevices(function(devs) {
|
|
|
|
g.clear();
|
|
|
|
var idx = 0;
|
|
|
|
devs.forEach(function(dev) {
|
|
|
|
if ("services" in dev && dev.services.includes("feaa")) {
|
|
|
|
g.setFont("Teletext5x9Ascii");
|
|
|
|
g.drawString(`${dev.id.substring(12,14).toUpperCase()}${dev.id.substring(15,17).toUpperCase()}`,2,idx*20+10);
|
|
|
|
g.setFont("Teletext5x9Ascii");
|
|
|
|
g.drawString(`FEAA`,2,idx*20+2);
|
|
|
|
g.setFont("HaxorNarrow7x17");
|
|
|
|
var arr = dev.serviceData.feaa;
|
|
|
|
var str = String.fromCharCode(arr[2],arr[3],arr[4],arr[5],arr[6],arr[7],arr[8],arr[9],arr[10],arr[11],arr[12],arr[13],arr[14],arr[15],arr[16],arr[17]);
|
2024-12-25 16:30:56 +01:00
|
|
|
g.drawString(str,30,idx*20+1);
|
2024-12-22 23:37:43 +01:00
|
|
|
idx++;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (!idx) {
|
|
|
|
g.clear();
|
|
|
|
g.flip();
|
|
|
|
Pixl.setLCDPower(false);
|
|
|
|
LED1.reset();
|
|
|
|
} else {
|
|
|
|
Pixl.setLCDPower(true);
|
|
|
|
LED1.set();
|
|
|
|
g.flip();
|
|
|
|
}
|
2024-12-25 16:30:56 +01:00
|
|
|
}, 1400); // scan for 1 sec
|
2024-12-22 23:37:43 +01:00
|
|
|
}
|
|
|
|
|
2024-12-25 16:30:56 +01:00
|
|
|
setInterval(scanForDevices, 1500);
|
2024-12-22 23:37:43 +01:00
|
|
|
scanForDevices();
|