Plane: removed the old crash_timer code
This code is less relevent with the new L1 navigation, and could cause issues with the pilot not having control after a long dive. Thanks to Soren for pointing out the issues See issue #305
This commit is contained in:
parent
1d9c1628fa
commit
eba7d6da9a
@ -323,9 +323,6 @@ static int16_t failsafe;
|
|||||||
// Used to track if the value on channel 3 (throtttle) has fallen below the failsafe threshold
|
// Used to track if the value on channel 3 (throtttle) has fallen below the failsafe threshold
|
||||||
// RC receiver should be set up to output a low throttle value when signal is lost
|
// RC receiver should be set up to output a low throttle value when signal is lost
|
||||||
static bool ch3_failsafe;
|
static bool ch3_failsafe;
|
||||||
// A timer used to help recovery from unusual attitudes. If we enter an unusual attitude
|
|
||||||
// while in autonomous flight this variable is used to hold roll at 0 for a recovery period
|
|
||||||
static uint8_t crash_timer;
|
|
||||||
|
|
||||||
// the time when the last HEARTBEAT message arrived from a GCS
|
// the time when the last HEARTBEAT message arrived from a GCS
|
||||||
static uint32_t last_heartbeat_ms;
|
static uint32_t last_heartbeat_ms;
|
||||||
@ -1025,7 +1022,6 @@ static void update_GPS(void)
|
|||||||
static void update_current_flight_mode(void)
|
static void update_current_flight_mode(void)
|
||||||
{
|
{
|
||||||
if(control_mode == AUTO) {
|
if(control_mode == AUTO) {
|
||||||
crash_checker();
|
|
||||||
|
|
||||||
switch(nav_command_ID) {
|
switch(nav_command_ID) {
|
||||||
case MAV_CMD_NAV_TAKEOFF:
|
case MAV_CMD_NAV_TAKEOFF:
|
||||||
@ -1111,7 +1107,6 @@ static void update_current_flight_mode(void)
|
|||||||
case RTL:
|
case RTL:
|
||||||
case LOITER:
|
case LOITER:
|
||||||
case GUIDED:
|
case GUIDED:
|
||||||
crash_checker();
|
|
||||||
calc_nav_roll();
|
calc_nav_roll();
|
||||||
calc_nav_pitch();
|
calc_nav_pitch();
|
||||||
calc_throttle();
|
calc_throttle();
|
||||||
|
@ -63,10 +63,6 @@ static bool stick_mixing_enabled(void)
|
|||||||
*/
|
*/
|
||||||
static void stabilize_roll(float speed_scaler)
|
static void stabilize_roll(float speed_scaler)
|
||||||
{
|
{
|
||||||
if (crash_timer > 0) {
|
|
||||||
nav_roll_cd = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inverted_flight) {
|
if (inverted_flight) {
|
||||||
// we want to fly upside down. We need to cope with wrap of
|
// we want to fly upside down. We need to cope with wrap of
|
||||||
// the roll_sensor interfering with wrap of nav_roll, which
|
// the roll_sensor interfering with wrap of nav_roll, which
|
||||||
@ -279,16 +275,6 @@ static void stabilize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void crash_checker()
|
|
||||||
{
|
|
||||||
if(ahrs.pitch_sensor < -4500) {
|
|
||||||
crash_timer = 255;
|
|
||||||
}
|
|
||||||
if(crash_timer > 0)
|
|
||||||
crash_timer--;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void calc_throttle()
|
static void calc_throttle()
|
||||||
{
|
{
|
||||||
if (g.throttle_cruise <= 1) {
|
if (g.throttle_cruise <= 1) {
|
||||||
|
@ -232,7 +232,6 @@ static bool verify_condition_command() // Returns true if command compl
|
|||||||
static void do_RTL(void)
|
static void do_RTL(void)
|
||||||
{
|
{
|
||||||
control_mode = RTL;
|
control_mode = RTL;
|
||||||
crash_timer = 0;
|
|
||||||
next_WP = home;
|
next_WP = home;
|
||||||
|
|
||||||
if (g.loiter_radius < 0) {
|
if (g.loiter_radius < 0) {
|
||||||
|
@ -324,7 +324,6 @@ static void set_mode(enum FlightMode mode)
|
|||||||
trim_control_surfaces();
|
trim_control_surfaces();
|
||||||
|
|
||||||
control_mode = mode;
|
control_mode = mode;
|
||||||
crash_timer = 0;
|
|
||||||
|
|
||||||
switch(control_mode)
|
switch(control_mode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user