mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 07:28:29 -04:00
AP_IOMCU: support IMU heater
This commit is contained in:
parent
1568f578d7
commit
d1fd843539
@ -71,6 +71,7 @@ enum ioevents {
|
|||||||
IOEVENT_SET_RATES,
|
IOEVENT_SET_RATES,
|
||||||
IOEVENT_GET_RCIN,
|
IOEVENT_GET_RCIN,
|
||||||
IOEVENT_ENABLE_SBUS,
|
IOEVENT_ENABLE_SBUS,
|
||||||
|
IOEVENT_SET_HEATER_TARGET,
|
||||||
};
|
};
|
||||||
|
|
||||||
// setup page registers
|
// setup page registers
|
||||||
@ -90,6 +91,7 @@ enum ioevents {
|
|||||||
#define PAGE_REG_SETUP_DEFAULTRATE 3
|
#define PAGE_REG_SETUP_DEFAULTRATE 3
|
||||||
#define PAGE_REG_SETUP_ALTRATE 4
|
#define PAGE_REG_SETUP_ALTRATE 4
|
||||||
#define PAGE_REG_SETUP_SBUS_RATE 19
|
#define PAGE_REG_SETUP_SBUS_RATE 19
|
||||||
|
#define PAGE_REG_SETUP_HEATER_DUTY_CYCLE 21
|
||||||
|
|
||||||
#define PAGE_REG_SETUP_FORCE_SAFETY_OFF 12
|
#define PAGE_REG_SETUP_FORCE_SAFETY_OFF 12
|
||||||
#define PAGE_REG_SETUP_FORCE_SAFETY_ON 14
|
#define PAGE_REG_SETUP_FORCE_SAFETY_ON 14
|
||||||
@ -199,6 +201,13 @@ void AP_IOMCU::thread_main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mask & EVENT_MASK(IOEVENT_SET_HEATER_TARGET)) {
|
||||||
|
if (!write_register(PAGE_SETUP, PAGE_REG_SETUP_HEATER_DUTY_CYCLE, heater_duty_cycle)) {
|
||||||
|
event_failed(IOEVENT_SET_HEATER_TARGET);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check for regular timed events
|
// check for regular timed events
|
||||||
uint32_t now = AP_HAL::millis();
|
uint32_t now = AP_HAL::millis();
|
||||||
if (now - last_rc_read_ms > 20) {
|
if (now - last_rc_read_ms > 20) {
|
||||||
@ -513,4 +522,11 @@ bool AP_IOMCU::check_rcinput(uint32_t &last_frame_us, uint8_t &num_channels, uin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set IMU heater target
|
||||||
|
void AP_IOMCU::set_heater_duty_cycle(uint8_t duty_cycle)
|
||||||
|
{
|
||||||
|
heater_duty_cycle = duty_cycle;
|
||||||
|
trigger_event(IOEVENT_SET_HEATER_TARGET);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // HAL_WITH_IO_MCU
|
#endif // HAL_WITH_IO_MCU
|
||||||
|
@ -64,6 +64,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
float get_vrssi(void) const { return reg_status.vrssi * 0.001; }
|
float get_vrssi(void) const { return reg_status.vrssi * 0.001; }
|
||||||
|
|
||||||
|
// set target for IMU heater
|
||||||
|
void set_heater_duty_cycle(uint8_t duty_cycle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AP_HAL::UARTDriver &uart;
|
AP_HAL::UARTDriver &uart;
|
||||||
|
|
||||||
@ -174,6 +177,9 @@ private:
|
|||||||
uint16_t sbus_rate_hz;
|
uint16_t sbus_rate_hz;
|
||||||
} rate;
|
} rate;
|
||||||
|
|
||||||
|
// IMU heater duty cycle
|
||||||
|
uint8_t heater_duty_cycle;
|
||||||
|
|
||||||
bool corked;
|
bool corked;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user