mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
Update blebeacon.js
This commit is contained in:
@@ -18,6 +18,22 @@ function byteToHex(byte) {
|
||||
return hex;
|
||||
}
|
||||
|
||||
function getNextByteValue() {
|
||||
let value = currentByteValue;
|
||||
currentByteValue = (currentByteValue + 1) % 256;
|
||||
return value;
|
||||
}
|
||||
|
||||
function generateRandomMac() {
|
||||
let mac = '';
|
||||
for (let i = 0; i < 6; i++) {
|
||||
if (mac.length) mac += ':';
|
||||
let byte = getNextByteValue();
|
||||
mac += byteToHex(byte);
|
||||
}
|
||||
return mac;
|
||||
}
|
||||
|
||||
function bytesToHexString(bytes) {
|
||||
if (!bytes) {
|
||||
print("Invalid input for bytesToHexString");
|
||||
@@ -50,9 +66,7 @@ function sendRandomModelAdvertisement() {
|
||||
return;
|
||||
}
|
||||
|
||||
let Mac = bleBeacon.genMac();
|
||||
|
||||
bleBeacon.setMac(Mac);
|
||||
bleBeacon.setMac(generateRandomMac());
|
||||
bleBeacon.setData(packetString);
|
||||
bleBeacon.send();
|
||||
|
||||
@@ -60,8 +74,7 @@ function sendRandomModelAdvertisement() {
|
||||
|
||||
currentIndex = (currentIndex + 1) % watchValues.length;
|
||||
|
||||
delay(500); // 500 Ms is the fatest we can manage to recieve
|
||||
// in C Flipper is way faster at spamming this
|
||||
delay(500);
|
||||
|
||||
bleBeacon.stop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user