AP_IOMCU: fixed oneshot support in IO firmware

This commit is contained in:
Andrew Tridgell 2018-05-11 18:11:24 +10:00
parent 2c7e27374f
commit cfb10fbb2f
2 changed files with 7 additions and 3 deletions

View File

@ -141,15 +141,18 @@ void AP_IOMCU_FW::init()
void AP_IOMCU_FW::update() void AP_IOMCU_FW::update()
{ {
chEvtWaitAnyTimeout(~0, MS2ST(1)); eventmask_t mask = chEvtWaitAnyTimeout(~0, MS2ST(1));
if (do_reboot && (AP_HAL::millis() > reboot_time)) { if (do_reboot && (AP_HAL::millis() > reboot_time)) {
hal.scheduler->reboot(true); hal.scheduler->reboot(true);
while(true){} while(true){}
} }
// always do pwm update if ((mask & EVENT_MASK(IOEVENT_PWM)) ||
pwm_out_update(); (last_safety_off != reg_status.flag_safety_off)) {
last_safety_off = reg_status.flag_safety_off;
pwm_out_update();
}
// run remaining functions at 1kHz // run remaining functions at 1kHz
uint32_t now = AP_HAL::millis(); uint32_t now = AP_HAL::millis();

View File

@ -95,5 +95,6 @@ private:
uint32_t last_loop_ms; uint32_t last_loop_ms;
bool oneshot_enabled; bool oneshot_enabled;
thread_t *thread_ctx; thread_t *thread_ctx;
bool last_safety_off;
}; };