mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_HAL_SITL: support for virtual hardware safety switch
This commit is contained in:
parent
a798c87d91
commit
907977b2f2
@ -126,3 +126,21 @@ void RCOutput::neopixel_send(void)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void RCOutput::force_safety_off(void)
|
||||
{
|
||||
SITL::SITL *sitl = AP::sitl();
|
||||
if (sitl == nullptr) {
|
||||
return;
|
||||
}
|
||||
sitl->force_safety_off();
|
||||
}
|
||||
|
||||
bool RCOutput::force_safety_on(void)
|
||||
{
|
||||
SITL::SITL *sitl = AP::sitl();
|
||||
if (sitl == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return sitl->force_safety_on();
|
||||
}
|
||||
|
@ -18,6 +18,15 @@ public:
|
||||
void cork(void) override;
|
||||
void push(void) override;
|
||||
|
||||
/*
|
||||
force the safety switch on, disabling PWM output from the IO board
|
||||
*/
|
||||
bool force_safety_on(void) override;
|
||||
/*
|
||||
force the safety switch off, enabling PWM output from the IO board
|
||||
*/
|
||||
void force_safety_off(void) override;
|
||||
|
||||
/*
|
||||
Serial LED emulation
|
||||
*/
|
||||
|
@ -124,3 +124,12 @@ void *HALSITL::Util::heap_realloc(void *heap_ptr, void *ptr, size_t new_size)
|
||||
}
|
||||
|
||||
#endif // ENABLE_HEAP
|
||||
|
||||
enum AP_HAL::Util::safety_state HALSITL::Util::safety_switch_state(void)
|
||||
{
|
||||
const SITL::SITL *sitl = AP::sitl();
|
||||
if (sitl == nullptr) {
|
||||
return AP_HAL::Util::SAFETY_NONE;
|
||||
}
|
||||
return sitl->safety_switch_state();
|
||||
}
|
||||
|
@ -49,7 +49,9 @@ public:
|
||||
|
||||
// return true if the reason for the reboot was a watchdog reset
|
||||
bool was_watchdog_reset() const override { return getenv("SITL_WATCHDOG_RESET") != nullptr; }
|
||||
|
||||
|
||||
enum safety_state safety_switch_state(void) override;
|
||||
|
||||
private:
|
||||
SITL_State *sitlState;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user