enable independent mac address

This commit is contained in:
Jet 2023-06-22 21:29:25 +01:00
parent 8f5a093317
commit 540fed72e5
6 changed files with 12 additions and 17 deletions

View File

@ -5,6 +5,7 @@
#include <ESP8266WiFi.h>
#include "spoofer.h"
// we are limited by how fast we can broadcast things
const int num_spoofers = 16;
static Spoofer spoofers[num_spoofers];
@ -13,8 +14,8 @@ void setup() {
}
void loop() {
delay(50);
for (int i = 0; i < num_spoofers; i++) {
spoofers[i].update();
delay(10);
}
}

View File

@ -68,12 +68,16 @@ ID_OpenDrone::ID_OpenDrone() {
#if ID_OD_WIFI
memset(WiFi_mac_addr,0,6);
// scrambled, not poached
for (int i = 0; i < 6; i++) {
WiFi_mac_addr[i] = (uint8_t) (rand() % 16);
}
memset(ssid,0,sizeof(ssid));
strcpy(ssid,"UAS_ID_OPEN");
beacon_interval = (BEACON_INTERVAL) ? BEACON_INTERVAL: 500;
beacon_interval = 10;
#if ID_OD_WIFI_BEACON
@ -409,10 +413,8 @@ int ID_OpenDrone::transmit(struct UTM_data *utm_data) {
int i, status;
char text[128];
uint32_t msecs;
time_t secs = 0;
static int phase = 0;
static uint32_t last_msecs = 2000;
//
@ -574,7 +576,6 @@ int ID_OpenDrone::transmit(struct UTM_data *utm_data) {
// Pack and transmit the WiFi data.
static uint8_t wifi_toggle = 1;
static uint32_t last_wifi = 0;
if ((msecs - last_wifi) >= beacon_interval) {
@ -653,9 +654,7 @@ int ID_OpenDrone::transmit_wifi(struct UTM_data *utm_data,int prepacked) {
#if ID_OD_WIFI
int length = 0, wifi_status = 0;
uint32_t msecs;
uint64_t usecs = 0;
static uint32_t last_wifi = 0;
char text[128];
text[0] = 0;
@ -833,9 +832,6 @@ int ID_OpenDrone::transmit_wifi(struct UTM_data *utm_data,int prepacked) {
*/
int ID_OpenDrone::transmit_ble(uint8_t *odid_msg,int length) {
uint32_t msecs;
static uint32_t last_ble;
msecs = millis();
ble_interval = msecs - last_ble;

View File

@ -138,6 +138,7 @@ private:
char *UAS_operator;
uint8_t msg_counter[16];
uint16_t wifi_interval = 0, ble_interval = 0;
uint32_t last_ble = 0, last_wifi = 0, msecs = 0, last_msecs = 2000;
Stream *Debug_Serial = NULL;
char ssid[32];

View File

@ -189,7 +189,8 @@ void init2(char *ssid,int ssid_length,uint8_t *WiFi_mac_addr,uint8_t wifi_channe
// esp_wifi_set_max_tx_power(78);
esp_wifi_get_max_tx_power(&wifi_power);
status = esp_read_mac(WiFi_mac_addr,ESP_MAC_WIFI_STA);
// no default mac addresses
// status = esp_read_mac(WiFi_mac_addr,ESP_MAC_WIFI_STA);
if (Debug_Serial) {

View File

@ -66,8 +66,7 @@ void init2(char *ssid,int ssid_length,uint8_t *WiFi_mac_addr,uint8_t wifi_channe
softap_config wifi_config;
WiFi.mode(WIFI_OFF);
WiFi.macAddress(WiFi_mac_addr);
// WiFi.macAddress(WiFi_mac_addr);
WiFi.softAP(ssid,NULL,wifi_channel,false,0);
WiFi.setOutputPower(20.0);

View File

@ -40,8 +40,6 @@ Spoofer::Spoofer() {
speed_m_x = ((float) speed_kn) * 0.514444 * 0.2; // Because we update every 200 ms.
utm_utils.calc_m_per_deg(lat_d,&m_deg_lat,&m_deg_long);
srand(micros());
}
void Spoofer::update() {
@ -69,7 +67,6 @@ void Spoofer::update() {
}
String Spoofer::getID() {
srand(micros())
String characters = String("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
String ID = "";
for (int i = 0; i < 16; i++)