mirror of
https://github.com/jjshoots/RemoteIDSpoofer.git
synced 2026-04-10 07:25:43 +00:00
fix movement logic and eeprom
This commit is contained in:
@@ -58,7 +58,7 @@ void Frontend::handleSetCoords() {
|
||||
latitude = server.arg("latitude").toFloat();
|
||||
longitude = server.arg("longitude").toFloat();
|
||||
EEPROM.put(latitude_addr, latitude);
|
||||
EEPROM.put(longitude_addr, latitude);
|
||||
EEPROM.put(longitude_addr, longitude);
|
||||
server.send(200, "text/html", HTML());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,16 +51,12 @@ void Spoofer::update() {
|
||||
utm_data.satellites = rand() % 8 + 8;
|
||||
|
||||
// random acceleration to change speed
|
||||
speed_m_x += float(rand() % int(2 * max_accel) - max_accel) / 1000.0;
|
||||
speed_m_y += float(rand() % int(2 * max_accel) - max_accel) / 1000.0;
|
||||
// bias towards flying near the center
|
||||
speed_m_x += float(rand() % int(2 * max_accel) - max_accel) / 1000.0 - 0.05 * x;
|
||||
speed_m_y += float(rand() % int(2 * max_accel) - max_accel) / 1000.0 - 0.05 * y;
|
||||
speed_m_x = constrain(speed_m_x, -max_speed, max_speed);
|
||||
speed_m_y = constrain(speed_m_y, -max_speed, max_speed);
|
||||
|
||||
// make the drone favour being around the start point, basically try to keep x, y = 0
|
||||
// the radius that the drone is allowed to be in is basically 20 * max_speed
|
||||
speed_m_x = 0.95 * speed_m_x - 0.05 * x;
|
||||
speed_m_y = 0.95 * speed_m_y - 0.05 * y;
|
||||
|
||||
// update the actual speed in knots
|
||||
// double absolute_speed = sqrt(pow(speed_m_x, 2) + pow(speed_m_y, 2));
|
||||
double absolute_speed = std::abs((speed_m_x, speed_m_y));
|
||||
|
||||
Reference in New Issue
Block a user