kopia lustrzana https://github.com/YohanHadji/R2Home
Upgrade separation servo
Separation altitude is now also relative to ground + New option to test the sep servo "TEST_SEP_SERVO"main
rodzic
483e3593e7
commit
9c78698d46
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#define I_WANT_TO_FLY false // Simulated servo movement to test the servo movement :))
|
#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_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_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 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
|
#define NO_INIT false // Skip init, for testing only purposes
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
#define OPENING_TIMER 3000
|
#define OPENING_TIMER 3000
|
||||||
#define SPIRAL_RECOVER 5000
|
#define SPIRAL_RECOVER 5000
|
||||||
#define DEP_ALT 300 // m above ground
|
#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 VUP 1 // m/s
|
||||||
#define VDOWN -1 // m/s
|
#define VDOWN -1 // m/s
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
int flight_mode = 0;
|
int flight_mode = 0;
|
||||||
int dep_altitude = 0;
|
int dep_altitude = 0;
|
||||||
|
int sep_altitude = 0;
|
||||||
int prev_flight_mode = 0;
|
int prev_flight_mode = 0;
|
||||||
bool initialised = false;
|
bool initialised = false;
|
||||||
bool flight_started = false;
|
bool flight_started = false;
|
||||||
|
@ -50,7 +51,10 @@ void flight_init() {
|
||||||
cmpt_string_data(flight_mode, initialised, deployed, wing_opened, spiral);
|
cmpt_string_data(flight_mode, initialised, deployed, wing_opened, spiral);
|
||||||
|
|
||||||
ground_altitude = gps.altitude.meters();
|
ground_altitude = gps.altitude.meters();
|
||||||
|
ground_altitude = constrain(ground_altitude, 0, 2000);
|
||||||
|
|
||||||
dep_altitude = (DEP_ALT+ground_altitude);
|
dep_altitude = (DEP_ALT+ground_altitude);
|
||||||
|
sep_altitude = (SEP_ALT+ground_altitude);
|
||||||
|
|
||||||
setcam(1, 60, 60);
|
setcam(1, 60, 60);
|
||||||
newfile();
|
newfile();
|
||||||
|
@ -107,7 +111,7 @@ void flight_ascent() {
|
||||||
if ((gps.altitude.meters()-ground_altitude)>10) {
|
if ((gps.altitude.meters()-ground_altitude)>10) {
|
||||||
flight_started = true;
|
flight_started = true;
|
||||||
}
|
}
|
||||||
if (gps.altitude.meters()>SEP_ALT and gps_ok) {
|
if (gps.altitude.meters()>sep_altitude and gps_ok) {
|
||||||
separation = true;
|
separation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,10 @@ void loop() {
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TEST_SEP_SERVO and millis()>10000) {
|
||||||
|
deployed = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getdata() {
|
void getdata() {
|
||||||
|
|
Ładowanie…
Reference in New Issue