Upgrade separation servo

Separation altitude is now also relative to ground

+ New option to test the sep servo "TEST_SEP_SERVO"
main
YohanHadji 2022-04-10 11:14:37 +02:00
rodzic 483e3593e7
commit 9c78698d46
3 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -2,6 +2,7 @@
#define I_WANT_TO_FLY false // Simulated servo movement to test the servo movement :))
#define TEST_DIR_RC false // Use channels 0 on the radio to test the direction of the autopilot and the servos, I_WANT_TO_FLY should be set true too.
#define TEST_SEP_SERVO false // Will simulate a separation 10 seconds after start up
#define BUZZER_TURN false // Buzzer sounds as function of the turn command
#define BUZZER_SWEEP false // Buzzer turn on steroïds, should be easier to understand his tricky language ^^
#define NO_INIT false // Skip init, for testing only purposes
@ -35,7 +36,7 @@
#define OPENING_TIMER 3000
#define SPIRAL_RECOVER 5000
#define DEP_ALT 300 // m above ground
#define SEP_ALT 10000 // m above sea level
#define SEP_ALT 10 // m above sea level
#define VUP 1 // m/s
#define VDOWN -1 // m/s

Wyświetl plik

@ -3,6 +3,7 @@
int flight_mode = 0;
int dep_altitude = 0;
int sep_altitude = 0;
int prev_flight_mode = 0;
bool initialised = false;
bool flight_started = false;
@ -50,7 +51,10 @@ void flight_init() {
cmpt_string_data(flight_mode, initialised, deployed, wing_opened, spiral);
ground_altitude = gps.altitude.meters();
ground_altitude = constrain(ground_altitude, 0, 2000);
dep_altitude = (DEP_ALT+ground_altitude);
sep_altitude = (SEP_ALT+ground_altitude);
setcam(1, 60, 60);
newfile();
@ -107,7 +111,7 @@ void flight_ascent() {
if ((gps.altitude.meters()-ground_altitude)>10) {
flight_started = true;
}
if (gps.altitude.meters()>SEP_ALT and gps_ok) {
if (gps.altitude.meters()>sep_altitude and gps_ok) {
separation = true;
}
}

Wyświetl plik

@ -59,6 +59,10 @@ void loop() {
if (DEBUG) {
delay(10);
}
if (TEST_SEP_SERVO and millis()>10000) {
deployed = true;
}
}