mirror of
https://github.com/jjshoots/RemoteIDSpoofer.git
synced 2026-01-14 15:54:58 +00:00
randomize speed
This commit is contained in:
parent
a80d820e7d
commit
de391c8df9
@ -1,11 +1,8 @@
|
||||
// ESP8266 RemoteID spoofer
|
||||
// Heavily adapted from https://github.com/sxjack/uav_electronic_ids
|
||||
|
||||
#include <Arduino.h>
|
||||
#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];
|
||||
|
||||
|
||||
@ -33,12 +33,10 @@ Spoofer::Spoofer() {
|
||||
|
||||
utm_data.alt_msl_m = utm_data.base_alt_m + z;
|
||||
utm_data.alt_agl_m = z;
|
||||
utm_data.speed_kn = speed_kn;
|
||||
utm_data.speed_kn = 1;
|
||||
utm_data.satellites = 8;
|
||||
utm_data.base_valid = 1;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -48,6 +46,10 @@ void Spoofer::update() {
|
||||
return;
|
||||
}
|
||||
|
||||
// randomly update the velocity
|
||||
utm_data.speed_kn = constrain(utm_data.speed_kn + (rand() % 5) - 2, 1, 20);
|
||||
speed_m_x = ((float) utm_data.speed_kn) * 0.514444 * 0.2; // Because we update every 200 ms.
|
||||
|
||||
// randomly pick a direction to head and update the heading
|
||||
float ranf = 0.001 * (float) (((int) rand() % 1000) - 500);
|
||||
int dir_change = (int) (max_dir_change * ranf);
|
||||
|
||||
@ -17,7 +17,6 @@ class Spoofer {
|
||||
struct UTM_parameters utm_parameters;
|
||||
struct UTM_data utm_data;
|
||||
|
||||
int speed_kn = (int) (rand() % 10);
|
||||
float x = 0.0, y = 0.0, z = 0.0;
|
||||
float speed_m_x, max_dir_change = 75.0;
|
||||
double deg2rad = (4.0 * atan(1.0)) / 180.0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user