From 0b2184b8189a2703683c8c93ce8c439dfc988ee5 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 20 Nov 2015 12:12:50 +0900 Subject: [PATCH] AP_Mount: use millis/micros/panic functions --- libraries/AP_Mount/AP_Mount_SToRM32.cpp | 6 +++--- libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp | 6 +++--- libraries/AP_Mount/AP_Mount_Servo.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_SToRM32.cpp b/libraries/AP_Mount/AP_Mount_SToRM32.cpp index 784c7fc72d..04a1dc2acd 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32.cpp +++ b/libraries/AP_Mount/AP_Mount_SToRM32.cpp @@ -75,7 +75,7 @@ void AP_Mount_SToRM32::update() } // resend target angles at least once per second - if (resend_now || ((hal.scheduler->millis() - _last_send) > AP_MOUNT_STORM32_RESEND_MS)) { + if (resend_now || ((AP_HAL::millis() - _last_send) > AP_MOUNT_STORM32_RESEND_MS)) { send_do_mount_control(ToDeg(_angle_ef_target_rad.y), ToDeg(_angle_ef_target_rad.x), ToDeg(_angle_ef_target_rad.z), MAV_MOUNT_MODE_MAVLINK_TARGETING); } } @@ -115,7 +115,7 @@ void AP_Mount_SToRM32::find_gimbal() } // return if search time has has passed - if (hal.scheduler->millis() > AP_MOUNT_STORM32_SEARCH_MS) { + if (AP_HAL::millis() > AP_MOUNT_STORM32_SEARCH_MS) { return; } @@ -154,5 +154,5 @@ void AP_Mount_SToRM32::send_do_mount_control(float pitch_deg, float roll_deg, fl mount_mode); // store time of send - _last_send = hal.scheduler->millis(); + _last_send = AP_HAL::millis(); } diff --git a/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp b/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp index a39d36387c..a97a12ec80 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp +++ b/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp @@ -90,9 +90,9 @@ void AP_Mount_SToRM32_serial::update() } // resend target angles at least once per second - resend_now = resend_now || ((hal.scheduler->millis() - _last_send) > AP_MOUNT_STORM32_SERIAL_RESEND_MS); + resend_now = resend_now || ((AP_HAL::millis() - _last_send) > AP_MOUNT_STORM32_SERIAL_RESEND_MS); - if ((hal.scheduler->millis() - _last_send) > AP_MOUNT_STORM32_SERIAL_RESEND_MS*2) { + if ((AP_HAL::millis() - _last_send) > AP_MOUNT_STORM32_SERIAL_RESEND_MS*2) { _reply_type = ReplyType_UNKNOWN; } if (can_send(resend_now)) { @@ -189,7 +189,7 @@ void AP_Mount_SToRM32_serial::send_target_angles(float pitch_deg, float roll_deg } // store time of send - _last_send = hal.scheduler->millis(); + _last_send = AP_HAL::millis(); } void AP_Mount_SToRM32_serial::get_angles() { diff --git a/libraries/AP_Mount/AP_Mount_Servo.cpp b/libraries/AP_Mount/AP_Mount_Servo.cpp index aa1107a21c..28fa70a039 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.cpp +++ b/libraries/AP_Mount/AP_Mount_Servo.cpp @@ -30,7 +30,7 @@ void AP_Mount_Servo::update() static bool mount_open = 0; // 0 is closed // check servo map every three seconds to allow users to modify parameters - uint32_t now = hal.scheduler->millis(); + uint32_t now = AP_HAL::millis(); if (now - _last_check_servo_map_ms > 3000) { check_servo_map(); _last_check_servo_map_ms = now;