diff --git a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/config.h b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/config.h index 9deb74e..da3548b 100644 --- a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/config.h +++ b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/config.h @@ -16,7 +16,7 @@ #define COG_BRAKE false // Will reduce command if CoG is turning faster than a threshold #define GPS_FREQ 5 // Hz #define SERVO_RATE 50 // Hz -#define TLM_MONITOR false // Show telemetry on serial monitor +#define TLM_MONITOR true // Show telemetry on serial monitor #define DEBUG false // Will show all the steps on the screen #define GPS_PORT Serial7 #define TLM_PORT Serial5 @@ -30,9 +30,9 @@ #define LINEAR_MODE 0 // command is linear (0), or linear but with a large deadband set using servo_start etc (1) #define DROP true // R2Home's version, drop or motorised -#define DEP_MODE 0 // If 0, the timer will be used if 1, the altitude will be used, to trigger deployment once in descent mode -#define DESCENT_TIMER 15000 -#define OPENING_TIMER 6000 +#define DEP_MODE 1 // If 0, the ALTITUDE will be used if 1, the TIMER will be used, to trigger deployment once in descent mode +#define DESCENT_TIMER 4000 +#define OPENING_TIMER 3000 #define SPIRAL_RECOVER 5000 #define DEP_ALT 300 // m above ground #define VUP 1 // m/s @@ -54,8 +54,8 @@ #define PAYLOAD_WEIGHT 500 // Payload weight in gram // If you choose to not use any of the two auto_gain functions, you can set the max commands with these two lines: -#define SERVO_MAX_M_DEF 1600 // m for map -#define SERVO_MAX_C_DEF 1375 // c for constrain +#define SERVO_MAX_M_DEF 2000 // m for map +#define SERVO_MAX_C_DEF 2000 // c for constrain #define TRIG 20 #define LEFT_OFFSET 100 @@ -72,6 +72,6 @@ #define GPS_VS_AVG 1 #define GPS_SAFE_AVG 50 -#define BARO_SAFE_AVG 10 +#define BARO_SAFE_AVG 5 #define PRE_PE_AVG 50 diff --git a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/control.hpp b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/control.hpp index ea01c28..b68c1bf 100644 --- a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/control.hpp +++ b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/control.hpp @@ -45,8 +45,6 @@ void cmpt_pressure_gain(float pressure_ratio) { if (AUTO_GAIN_PRESSURE) { SERVO_MAX_M = map((SERVO_MAX_M_W-1000)/pressure_ratio, 0, 1000, 1000, 2000); SERVO_MAX_C = map((SERVO_MAX_M_W-1000)/pressure_ratio, 0, 1000, 1000, 2000); - Serial.print(SERVO_MAX_M_W); Serial.print(","); Serial.print(SERVO_MAX_M); Serial.print(","); - Serial.print(SERVO_MAX_C_W); Serial.print(","); Serial.println(SERVO_MAX_C); } else { SERVO_MAX_M = SERVO_MAX_M_W; diff --git a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/flight_state.hpp b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/flight_state.hpp index 659b174..18f0b5f 100644 --- a/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/flight_state.hpp +++ b/RLS_V1.0/R2Home_SOFTWARE_V1.01/R2Home_OBC_V1.04/main/flight_state.hpp @@ -3,6 +3,7 @@ int flight_mode = 0; int dep_altitude = 0; +int prev_flight_mode = 0; bool initialised = false; bool flight_started = false; bool deployed = false; @@ -238,6 +239,14 @@ void flight_gliding_no_gps() { //------------------- STATE MACHINE -------------------// void cmpt_flight_state() { + + if (flight_mode!=prev_flight_mode) { + cmpt_string_data(flight_mode, initialised, deployed, wing_opened, spiral); + save_data(initialised); + send_data(); + prev_flight_mode = flight_mode; + } + switch(flight_mode) { case 0: flight_init();