APM_Control: use millis/micros/panic functions

This commit is contained in:
Caio Marcelo de Oliveira Filho 2015-11-20 12:05:52 +09:00 committed by Randy Mackay
parent e867a06383
commit fe718a6ce8
5 changed files with 9 additions and 9 deletions

View File

@ -118,7 +118,7 @@ void AP_AutoTune::start(void)
{
running = true;
state = DEMAND_UNSATURATED;
uint32_t now = hal.scheduler->millis();
uint32_t now = AP_HAL::millis();
state_enter_ms = now;
last_save_ms = now;
@ -174,7 +174,7 @@ void AP_AutoTune::update(float desired_rate, float achieved_rate, float servo_ou
// see what state we are in
ATState new_state;
float abs_desired_rate = fabsf(desired_rate);
uint32_t now = hal.scheduler->millis();
uint32_t now = AP_HAL::millis();
if (fabsf(servo_out) >= 45) {
// we have saturated the servo demand (not including
@ -242,7 +242,7 @@ void AP_AutoTune::check_state_exit(uint32_t state_time_ms)
*/
void AP_AutoTune::check_save(void)
{
if (hal.scheduler->millis() - last_save_ms < AUTOTUNE_SAVE_PERIOD) {
if (AP_HAL::millis() - last_save_ms < AUTOTUNE_SAVE_PERIOD) {
return;
}
@ -263,7 +263,7 @@ void AP_AutoTune::check_save(void)
// the next values to save will be the ones we are flying now
next_save = current;
last_save_ms = hal.scheduler->millis();
last_save_ms = AP_HAL::millis();
}
/*
@ -337,7 +337,7 @@ void AP_AutoTune::write_log(float servo, float demanded, float achieved)
struct log_ATRP pkt = {
LOG_PACKET_HEADER_INIT(LOG_ATRP_MSG),
time_us : hal.scheduler->micros64(),
time_us : AP_HAL::micros64(),
type : type,
state : (uint8_t)state,
servo : (int16_t)(servo*100),

View File

@ -114,7 +114,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
*/
int32_t AP_PitchController::_get_rate_out(float desired_rate, float scaler, bool disable_integrator, float aspeed)
{
uint32_t tnow = hal.scheduler->millis();
uint32_t tnow = AP_HAL::millis();
uint32_t dt = tnow - _last_t;
if (_last_t == 0 || dt > 1000) {

View File

@ -92,7 +92,7 @@ const AP_Param::GroupInfo AP_RollController::var_info[] = {
*/
int32_t AP_RollController::_get_rate_out(float desired_rate, float scaler, bool disable_integrator)
{
uint32_t tnow = hal.scheduler->millis();
uint32_t tnow = AP_HAL::millis();
uint32_t dt = tnow - _last_t;
if (_last_t == 0 || dt > 1000) {
dt = 0;

View File

@ -94,7 +94,7 @@ const AP_Param::GroupInfo AP_SteerController::var_info[] = {
*/
int32_t AP_SteerController::get_steering_out_rate(float desired_rate)
{
uint32_t tnow = hal.scheduler->millis();
uint32_t tnow = AP_HAL::millis();
uint32_t dt = tnow - _last_t;
if (_last_t == 0 || dt > 1000) {
dt = 0;

View File

@ -72,7 +72,7 @@ const AP_Param::GroupInfo AP_YawController::var_info[] = {
int32_t AP_YawController::get_servo_out(float scaler, bool disable_integrator)
{
uint32_t tnow = hal.scheduler->millis();
uint32_t tnow = AP_HAL::millis();
uint32_t dt = tnow - _last_t;
if (_last_t == 0 || dt > 1000) {
dt = 0;