diff --git a/flight/Modules/Attitude/attitude.c b/flight/Modules/Attitude/attitude.c index 986fc74f3..4aeea69a7 100644 --- a/flight/Modules/Attitude/attitude.c +++ b/flight/Modules/Attitude/attitude.c @@ -141,20 +141,19 @@ static void AttitudeTask(void *parameters) FlightStatusData flightStatus; FlightStatusGet(&flightStatus); - - if(xTaskGetTickCount() < 10000) { + + if(xTaskGetTickCount() < 7000) { // Force settings update to make sure rotation loaded settingsUpdatedCb(AttitudeSettingsHandle()); - // For first 5 seconds use accels to get gyro bias + // For first 7 seconds use accels to get gyro bias accelKp = 1; - // Decrease the rate of gyro learning during init - accelKi = .5 / (1 + xTaskGetTickCount() / 5000); - yawBiasRate = 0.01 / (1 + xTaskGetTickCount() / 5000); + accelKi = 0.9; + yawBiasRate = 0.23; init = 0; } else if (zero_during_arming && (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMING)) { accelKi = .01; - yawBiasRate = 0.1; + yawBiasRate = 0.23; init = 0; } else if (init == 0) { settingsUpdatedCb(AttitudeSettingsHandle()); diff --git a/flight/Modules/FirmwareIAP/firmwareiap.c b/flight/Modules/FirmwareIAP/firmwareiap.c index 71de8c390..11e8721fd 100644 --- a/flight/Modules/FirmwareIAP/firmwareiap.c +++ b/flight/Modules/FirmwareIAP/firmwareiap.c @@ -30,6 +30,7 @@ #include "openpilot.h" #include "firmwareiap.h" #include "firmwareiapobj.h" +#include "flightstatus.h" // Private constants #define IAP_CMD_STEP_1 1122 @@ -156,6 +157,16 @@ static void FirmwareIAPCallback(UAVObjEvent* ev) case IAP_STATE_STEP_2: if( data.Command == IAP_CMD_STEP_3 ) { if( delta > iap_time_3_low_end && delta < iap_time_3_high_end ) { + + FlightStatusData flightStatus; + FlightStatusGet(&flightStatus); + + if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) { + // Abort any attempts if not disarmed + iap_state = IAP_STATE_READY; + break; + } + // we've met the three sequence of command numbers // we've met the time requirements. PIOS_IAP_SetRequest1(); diff --git a/shared/uavobjectdefinition/attitudesettings.xml b/shared/uavobjectdefinition/attitudesettings.xml index 085c1a123..808bbe80f 100644 --- a/shared/uavobjectdefinition/attitudesettings.xml +++ b/shared/uavobjectdefinition/attitudesettings.xml @@ -4,7 +4,7 @@ - + diff --git a/shared/uavobjectdefinition/stabilizationsettings.xml b/shared/uavobjectdefinition/stabilizationsettings.xml index bc339fdcd..b11c0f1dc 100644 --- a/shared/uavobjectdefinition/stabilizationsettings.xml +++ b/shared/uavobjectdefinition/stabilizationsettings.xml @@ -7,9 +7,9 @@ - - - + + +