mirror of https://github.com/ArduPilot/ardupilot
AP_EFI: convert to using ap_object approach
This commit is contained in:
parent
6e308814ad
commit
fed4909dd1
|
@ -277,18 +277,6 @@ void AP_EFI::get_state(EFI_State &_state)
|
|||
_state = state;
|
||||
}
|
||||
|
||||
#if AP_EFI_SCRIPTING_ENABLED && AP_SCRIPTING_ENABLED
|
||||
|
||||
void AP_EFI::handle_scripting(const EFI_State &efi_state)
|
||||
{
|
||||
if (!backend || (Type(type.get()) != Type::SCRIPTING)) {
|
||||
return;
|
||||
}
|
||||
backend->handle_scripting(efi_state);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace AP {
|
||||
AP_EFI *EFI()
|
||||
{
|
||||
|
|
|
@ -94,8 +94,7 @@ public:
|
|||
void send_mavlink_status(mavlink_channel_t chan);
|
||||
|
||||
#if AP_SCRIPTING_ENABLED
|
||||
// Ingest EFI_State from scripting driver
|
||||
void handle_scripting(const EFI_State &efi_state);
|
||||
AP_EFI_Backend* get_backend(uint8_t idx) { return idx==0?backend:nullptr; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
virtual void update() = 0;
|
||||
|
||||
#if AP_SCRIPTING_ENABLED
|
||||
virtual void handle_scripting(const EFI_State &efi_state) { return; }
|
||||
virtual bool handle_scripting(const EFI_State &efi_state) { return false; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
|
@ -9,10 +9,11 @@ void AP_EFI_Scripting::update()
|
|||
}
|
||||
|
||||
// handle EFI message from scripting
|
||||
void AP_EFI_Scripting::handle_scripting(const EFI_State &efi_state)
|
||||
bool AP_EFI_Scripting::handle_scripting(const EFI_State &efi_state)
|
||||
{
|
||||
internal_state = efi_state;
|
||||
copy_to_frontend();
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // AP_EFI_SCRIPTING_ENABLED
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
#include "AP_EFI.h"
|
||||
#include "AP_EFI_Backend.h"
|
||||
|
||||
#ifndef AP_EFI_SCRIPTING_ENABLED
|
||||
#define AP_EFI_SCRIPTING_ENABLED (HAL_EFI_ENABLED && AP_SCRIPTING_ENABLED)
|
||||
#endif
|
||||
|
||||
#if AP_EFI_SCRIPTING_ENABLED
|
||||
|
||||
class AP_EFI_Scripting : public AP_EFI_Backend {
|
||||
|
@ -15,6 +11,6 @@ public:
|
|||
|
||||
void update() override;
|
||||
|
||||
void handle_scripting(const EFI_State &efi_state) override;
|
||||
bool handle_scripting(const EFI_State &efi_state) override;
|
||||
};
|
||||
#endif // AP_EFI_SCRIPTING_ENABLED
|
||||
|
|
|
@ -5,3 +5,7 @@
|
|||
#ifndef HAL_EFI_ENABLED
|
||||
#define HAL_EFI_ENABLED !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
|
||||
#endif
|
||||
|
||||
#ifndef AP_EFI_SCRIPTING_ENABLED
|
||||
#define AP_EFI_SCRIPTING_ENABLED (HAL_EFI_ENABLED && AP_SCRIPTING_ENABLED)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue