ethernet console as engine module (#453)

* infrastructure for engine modules in the build

* fully move fuel pump

* fan

* gear detector

* gear detect

* fan control cleanup

* trip odometer

* shuffle makefiles around a little

* move ethernet console to engine module

* oops

* s

* final

* dead line
This commit is contained in:
Matthew Kennedy 2024-07-23 20:52:37 -07:00 committed by GitHub
parent ff5e47c95d
commit 4b4d2ac4d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 23 additions and 17 deletions

View File

@ -4,7 +4,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14
# Enable ethernet # Enable ethernet
LWIP = yes LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk
# This is an F429! # This is an F429!
IS_STM32F429 = yes IS_STM32F429 = yes

View File

@ -10,7 +10,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14
# Enable ethernet # Enable ethernet
LWIP = yes LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk
DDEFS += -DFIRMWARE_ID=\"nucleo_f767\" DDEFS += -DFIRMWARE_ID=\"nucleo_f767\"
DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS

View File

@ -6,7 +6,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14
# Enable ethernet # Enable ethernet
LWIP = yes LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk
DDEFS += -DFIRMWARE_ID=\"nucleo_h743\" DDEFS += -DFIRMWARE_ID=\"nucleo_h743\"
DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS

View File

@ -266,10 +266,10 @@
#define EFI_USE_COMPRESSED_INI_MSD #define EFI_USE_COMPRESSED_INI_MSD
#define ENABLE_PERF_TRACE TRUE #define ENABLE_PERF_TRACE TRUE
#if EFI_ETHERNET #if MODULE_ETHERNET_CONSOLE
// F4 ethernet needs some extra space // F4 ethernet needs some extra space
#define LUA_USER_HEAP 40000 #define LUA_USER_HEAP 40000
#else // EFI_ETHERNET #else // MODULE_ETHERNET_CONSOLE
#define LUA_USER_HEAP 50000 #define LUA_USER_HEAP 50000
#endif #endif
#else #else

View File

@ -9,7 +9,6 @@ CONSOLE_SRC_CPP = $(CONSOLE_COMMON_SRC_CPP) \
$(PROJECT_DIR)/console/connector_uart_dma.cpp \ $(PROJECT_DIR)/console/connector_uart_dma.cpp \
$(PROJECT_DIR)/console/binary_log/binary_logging.cpp \ $(PROJECT_DIR)/console/binary_log/binary_logging.cpp \
$(PROJECT_DIR)/console/binary_log/usb_console.cpp \ $(PROJECT_DIR)/console/binary_log/usb_console.cpp \
$(PROJECT_DIR)/console/binary_log/ethernet_console.cpp \
$(PROJECT_DIR)/console/wifi_console.cpp \ $(PROJECT_DIR)/console/wifi_console.cpp \

View File

@ -8,7 +8,12 @@
#pragma once #pragma once
#include "engine_module.h"
void initializeConsole(); void initializeConsole();
void startUsbConsole(); void startUsbConsole();
void startEthernetConsole();
void startWifiConsole(); void startWifiConsole();
struct EthernetConsoleModule final : public EngineModule {
void initNoConfiguration() override;
};

View File

@ -8,6 +8,9 @@
class EngineModule { class EngineModule {
public: public:
// Called exactly once during boot, before configuration is loaded
virtual void initNoConfiguration() { }
// Called when 'Burn' is invoked // Called when 'Burn' is invoked
virtual void onConfigurationChange(engine_configuration_s const * /*previousConfig*/) { } virtual void onConfigurationChange(engine_configuration_s const * /*previousConfig*/) { }

View File

@ -1,7 +1,5 @@
#include "pch.h" #include "pch.h"
#if EFI_ETHERNET
#include "lwipthread.h" #include "lwipthread.h"
#include "lwip/sockets.h" #include "lwip/sockets.h"
@ -80,8 +78,6 @@ struct EthernetThread : public TunerstudioThread {
static EthernetThread ethernetConsole; static EthernetThread ethernetConsole;
void startEthernetConsole() { void EthernetConsoleModule::initNoConfiguration() {
ethernetConsole.start(); ethernetConsole.start();
} }
#endif // EFI_ETHERNET

View File

@ -0,0 +1,4 @@
MODULES_CPPSRC += $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.cpp
MODULES_LIST += EthernetConsoleModule,
DDEFS += -DMODULE_ETHERNET_CONSOLE=1

View File

@ -41,7 +41,7 @@
#define USB_USE_WAIT (EFI_FILE_LOGGING && EFI_USB_SERIAL) #define USB_USE_WAIT (EFI_FILE_LOGGING && EFI_USB_SERIAL)
// Ethernet // Ethernet
#define HAL_USE_MAC EFI_ETHERNET #define HAL_USE_MAC MODULE_ETHERNET_CONSOLE
/*===========================================================================*/ /*===========================================================================*/
/* Required rusEFI settings */ /* Required rusEFI settings */

View File

@ -205,9 +205,9 @@ void runRusEfi() {
detectBoardType(); detectBoardType();
#if EFI_ETHERNET engine->engineModules.apply_all([](auto & m) {
startEthernetConsole(); m.initNoConfiguration();
#endif });
#if EFI_USB_SERIAL #if EFI_USB_SERIAL
startUsbConsole(); startUsbConsole();

View File

@ -151,4 +151,3 @@
#define EFI_USE_OPENBLT FALSE #define EFI_USE_OPENBLT FALSE
#define EFI_SOFTWARE_KNOCK FALSE #define EFI_SOFTWARE_KNOCK FALSE
#define ENABLE_AUTO_DETECT_HSE FALSE #define ENABLE_AUTO_DETECT_HSE FALSE
#define EFI_ETHERNET FALSE