Merge branch 'Next-Flip:dev' into dev

This commit is contained in:
Spooks
2024-03-07 16:38:35 -07:00
committed by GitHub
9 changed files with 558 additions and 7 deletions

View File

@@ -1,4 +1,15 @@
let blebeacon = require("blebeacon");
// Stop if previous background beacon is active
if (blebeacon.isActive()) {
blebeacon.stop();
}
// Make sure it resets at script exit, true will keep advertising in background
// This is false by default, can be omitted
blebeacon.keepAlive(false);
let math = require("math");
let currentIndex = 0;
@@ -43,9 +54,6 @@ function sendRandomModelAdvertisement() {
blebeacon.stop();
}
// Make sure it resets at script exit, true will keep advertising in background
blebeacon.keepAlive(true);
while (true) {
sendRandomModelAdvertisement();
}

View File

@@ -0,0 +1,37 @@
let subghz = require("subghz");
subghz.setup();
function printRXline() {
if (subghz.getState() !== "RX") {
subghz.setRx(); // to RX
}
let rssi = subghz.getRssi();
let freq = subghz.getFrequency();
let ext = subghz.isExternal();
print("rssi: ", rssi, "dBm", "@", freq, "MHz", "ext: ", ext);
}
function changeFrequency(freq) {
if (subghz.getState() !== "IDLE") {
subghz.setIdle(); // need to be idle to change frequency
}
subghz.setFrequency(freq);
}
subghz.setIdle();
print(subghz.getState()); // "IDLE"
subghz.setRx();
print(subghz.getState()); // "RX"
changeFrequency(433920000);
printRXline();
delay(1000);
let result = subghz.transmitFile("/ext/subghz/0.sub");
print(result ? "Send success" : "Send failed");
delay(1000);
changeFrequency(315000000);
printRXline();