diff --git a/libraries/AP_HAL_ESP32/HAL_ESP32_Class.cpp b/libraries/AP_HAL_ESP32/HAL_ESP32_Class.cpp index d4057a9af3..b00af1bc54 100644 --- a/libraries/AP_HAL_ESP32/HAL_ESP32_Class.cpp +++ b/libraries/AP_HAL_ESP32/HAL_ESP32_Class.cpp @@ -28,6 +28,9 @@ #include "Storage.h" #include "AnalogIn.h" #include "Util.h" +#if AP_SIM_ENABLED +#include +#endif static ESP32::UARTDriver cons(0); @@ -60,15 +63,27 @@ static ESP32::AnalogIn analogIn; #else static Empty::AnalogIn analogIn; #endif +#ifdef HAL_USE_EMPTY_STORAGE +static Empty::Storage storageDriver; +#else static ESP32::Storage storageDriver; +#endif static Empty::GPIO gpioDriver; +#if AP_SIM_ENABLED +static Empty::RCOutput rcoutDriver; +#else static ESP32::RCOutput rcoutDriver; +#endif static ESP32::RCInput rcinDriver; static ESP32::Scheduler schedulerInstance; static ESP32::Util utilInstance; static Empty::OpticalFlow opticalFlowDriver; static Empty::Flash flashDriver; +#if AP_SIM_ENABLED +static AP_HAL::SIMState xsimstate; +#endif + extern const AP_HAL::HAL& hal; HAL_ESP32::HAL_ESP32() : @@ -96,6 +111,9 @@ HAL_ESP32::HAL_ESP32() : &utilInstance, &opticalFlowDriver, &flashDriver, +#if AP_SIM_ENABLED + &xsimstate, +#endif #if HAL_WITH_DSP &dspDriver, #endif diff --git a/libraries/AP_HAL_ESP32/RCInput.cpp b/libraries/AP_HAL_ESP32/RCInput.cpp index 2923872dbd..704877962d 100644 --- a/libraries/AP_HAL_ESP32/RCInput.cpp +++ b/libraries/AP_HAL_ESP32/RCInput.cpp @@ -89,10 +89,10 @@ uint8_t RCInput::read(uint16_t* periods, uint8_t len) void RCInput::_timer_tick(void) { +#if AP_RCPROTOCOL_ENABLED if (!_init) { return; } - AP_RCProtocol &rcprot = AP::RC(); #ifdef HAL_ESP32_RCIN @@ -126,4 +126,5 @@ void RCInput::_timer_tick(void) #endif #endif +#endif // AP_RCPROTOCOL_ENABLED } diff --git a/libraries/AP_HAL_ESP32/boards/esp32empty.h b/libraries/AP_HAL_ESP32/boards/esp32empty.h index 33f5d7c219..d95e30f9b2 100644 --- a/libraries/AP_HAL_ESP32/boards/esp32empty.h +++ b/libraries/AP_HAL_ESP32/boards/esp32empty.h @@ -148,3 +148,4 @@ #define HAL_LOGGING_BACKENDS_DEFAULT 1 +#define AP_RCPROTOCOL_ENABLED 0 diff --git a/libraries/AP_HAL_ESP32/boards/esp32s3empty.h b/libraries/AP_HAL_ESP32/boards/esp32s3empty.h index d8f2af7f76..37c40f9a64 100644 --- a/libraries/AP_HAL_ESP32/boards/esp32s3empty.h +++ b/libraries/AP_HAL_ESP32/boards/esp32s3empty.h @@ -44,7 +44,7 @@ #define HAL_USE_ADC 0 // 2 use udp, 1 use tcp... for udp,client needs to connect as UDPCL in missionplanner etc to 192.168.4.1 port 14550 -#define HAL_ESP32_WIFI 1 +#define HAL_ESP32_WIFI 2 // see boards.py #ifndef ENABLE_HEAP @@ -87,3 +87,9 @@ #define HAL_LOGGING_BACKENDS_DEFAULT 1 +#define AP_RCPROTOCOL_ENABLED 0 + +#define AP_FILESYSTEM_ESP32_ENABLED 0 +#define AP_SCRIPTING_ENABLED 0 +#define HAL_USE_EMPTY_STORAGE 1 +