mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-30 09:37:53 -04:00
BLE Comm WIP (#1578)
* Initial BLE Comm commit. * SCAN_RSP MAC was reversed. * Added Auto Channel Hop. * Improvements to Tx to better handle timers. * Auto channel and more work on timers. * more advertisement numbers.
This commit is contained in:
parent
d2e9a8dc06
commit
8479d2edf0
11 changed files with 697 additions and 82 deletions
|
@ -337,6 +337,17 @@ std::string to_string_formatted_mac_address(const char* macAddress) {
|
|||
return formattedAddress;
|
||||
}
|
||||
|
||||
void generateRandomMacAddress(char* macAddress) {
|
||||
const char hexDigits[] = "0123456789ABCDEF";
|
||||
|
||||
// Generate 12 random hexadecimal characters
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int randomIndex = rand() % 16;
|
||||
macAddress[i] = hexDigits[randomIndex];
|
||||
}
|
||||
macAddress[12] = '\0'; // Null-terminate the string
|
||||
}
|
||||
|
||||
std::string unit_auto_scale(double n, const uint32_t base_unit, uint32_t precision) {
|
||||
const uint32_t powers_of_ten[5] = {1, 10, 100, 1000, 10000};
|
||||
std::string string{""};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue