joystick, lcd
This commit is contained in:
parent
9d101331a3
commit
61c17791b8
|
@ -298,7 +298,6 @@ INCDIR = \
|
|||
ext/FatFS \
|
||||
$(PROJECT_DIR)/hw_layer/mass_storage \
|
||||
$(PROJECT_DIR)/hw_layer/serial_over_usb \
|
||||
$(PROJECT_DIR)/hw_layer/lcd \
|
||||
$(PROJECT_DIR)/hw_layer/mass_storage \
|
||||
$(HW_INC) \
|
||||
development/hw_layer \
|
||||
|
|
|
@ -245,7 +245,6 @@ INCDIR = $(ALLINC) \
|
|||
$(PROJECT_DIR)/hw_layer/mass_storage \
|
||||
$(PROJECT_DIR)/hw_layer/serial_over_usb \
|
||||
$(PROJECT_DIR)/hw_layer/algo \
|
||||
$(PROJECT_DIR)/hw_layer/lcd \
|
||||
$(PROJECT_DIR)/hw_layer/sensors \
|
||||
$(PROJECT_DIR)/hw_layer/mass_storage \
|
||||
$(PROJECT_DIR)/hw_layer/ports \
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_software_knock true
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_software_knock true
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_software_knock true
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_software_knock true
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_software_knock true
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins false
|
||||
|
|
|
@ -22,7 +22,7 @@ DDEFS += -DEFI_USE_UART_DMA=FALSE
|
|||
# maybe a way to disable SPI2 privately
|
||||
#DDEFS += -DSTM32_SPI_USE_SPI2=FALSE
|
||||
|
||||
DDEFS += -DEFI_CJ125=FALSE -DBOARD_L9779_COUNT=0 -DEFI_HD44780_LCD=FALSE -DEFI_LCD=FALSE
|
||||
DDEFS += -DEFI_CJ125=FALSE -DBOARD_L9779_COUNT=0
|
||||
|
||||
DDEFS += -DFIRMWARE_ID=\"microRusEFI\"
|
||||
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE -DSTM32_ADC_USE_ADC3=TRUE
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
#define ts_show_cj125 false
|
||||
|
||||
|
||||
|
||||
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
|
||||
! https://rusefi.com/forum/viewtopic.php?p=43270#p43270
|
||||
#define ts_show_egt true
|
||||
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
#undef EFI_AUX_SERIAL
|
||||
#define EFI_AUX_SERIAL FALSE
|
||||
|
||||
#undef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
|
||||
#undef EFI_LCD
|
||||
#define EFI_LCD FALSE
|
||||
|
||||
#undef EFI_USB_SERIAL
|
||||
#define EFI_USB_SERIAL FALSE
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ DDEFS += $(VAR_DEF_ENGINE_TYPE)
|
|||
DDEFS += -DEFI_MAIN_RELAY_CONTROL=TRUE
|
||||
|
||||
# Turn off stuff proteus doesn't have/need
|
||||
DDEFS += -DEFI_CJ125=FALSE -DEFI_MAX_31855=FALSE -DBOARD_L9779_COUNT=0 -DBOARD_TLE8888_COUNT=0 -DEFI_HD44780_LCD=FALSE -DEFI_LCD=FALSE
|
||||
DDEFS += -DEFI_CJ125=FALSE -DEFI_MAX_31855=FALSE -DBOARD_L9779_COUNT=0 -DBOARD_TLE8888_COUNT=0
|
||||
|
||||
# Any Proteus-based adapter boards with discrete-VR decoder are controlled via a 5v ignition output
|
||||
DDEFS += -DVR_SUPPLY_VOLTAGE=5
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#define ts_show_hip9011 false
|
||||
#define ts_show_cj125 false
|
||||
#define ts_show_full_pinout false
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_analog_divider false
|
||||
|
|
|
@ -66,9 +66,6 @@
|
|||
#undef EFI_MAX_31855
|
||||
#define EFI_MAX_31855 FALSE
|
||||
|
||||
#undef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
|
||||
#undef EFI_IDLE_CONTROL
|
||||
#define EFI_IDLE_CONTROL TRUE
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#define ts_show_hip9011 true
|
||||
#define ts_show_cj125 false
|
||||
#define ts_show_lcd false
|
||||
#define ts_show_joystick false
|
||||
#define ts_show_egt false
|
||||
#define ts_show_gps false
|
||||
#define ts_show_etb_pins true
|
||||
|
|
|
@ -78,8 +78,6 @@ void setCitroenBerlingoTU3JPConfiguration() {
|
|||
engineConfiguration->fuelPumpPin = Gpio::B9;
|
||||
engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
|
||||
|
||||
setFrankenso_01_LCD();
|
||||
|
||||
|
||||
// engineConfiguration->o2heaterPin = Gpio::C13;
|
||||
// engineConfiguration->logicAnalyzerPins[1] = Gpio::Unassigned;
|
||||
|
|
|
@ -62,24 +62,6 @@ void runSchedulingPrecisionTestIfNeeded(void) {
|
|||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
void setFrankenso_01_LCD() {
|
||||
engineConfiguration->HD44780_rs = Gpio::E7;
|
||||
engineConfiguration->HD44780_e = Gpio::E9;
|
||||
engineConfiguration->HD44780_db4 = Gpio::E11;
|
||||
engineConfiguration->HD44780_db5 = Gpio::E13;
|
||||
engineConfiguration->HD44780_db6 = Gpio::E15;
|
||||
engineConfiguration->HD44780_db7 = Gpio::B10;
|
||||
}
|
||||
|
||||
void disableLCD() {
|
||||
engineConfiguration->HD44780_rs = Gpio::Unassigned;
|
||||
engineConfiguration->HD44780_e = Gpio::Unassigned;
|
||||
engineConfiguration->HD44780_db4 = Gpio::Unassigned;
|
||||
engineConfiguration->HD44780_db5 = Gpio::Unassigned;
|
||||
engineConfiguration->HD44780_db6 = Gpio::Unassigned;
|
||||
engineConfiguration->HD44780_db7 = Gpio::Unassigned;
|
||||
}
|
||||
|
||||
void setDiscoveryPdm() {
|
||||
}
|
||||
|
||||
|
@ -87,10 +69,8 @@ void setDiscoveryPdm() {
|
|||
void setFrankensoConfiguration() {
|
||||
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
|
||||
|
||||
setFrankenso_01_LCD();
|
||||
engineConfiguration->displayMode = DM_HD44780;
|
||||
commonFrankensoAnalogInputs();
|
||||
setFrankenso0_1_joystick();
|
||||
|
||||
/**
|
||||
* Frankenso analog #1 PC2 ADC12 CLT
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
#include "engine_configuration.h"
|
||||
void setFrankensoConfiguration();
|
||||
void setFrankenso_01_LCD();
|
||||
void disableLCD();
|
||||
void runSchedulingPrecisionTestIfNeeded(void);
|
||||
void setDiscoveryPdm();
|
||||
void setFrankensoBoardTestConfiguration();
|
||||
|
|
|
@ -109,8 +109,6 @@ void setDodgeNeon1995EngineConfiguration() {
|
|||
|
||||
void setDodgeNeonNGCEngineConfiguration() {
|
||||
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM;
|
||||
setFrankenso_01_LCD();
|
||||
setFrankenso0_1_joystick();
|
||||
|
||||
// set global_trigger_offset_angle 38
|
||||
engineConfiguration->globalTriggerAngleOffset = 38;
|
||||
|
|
|
@ -68,9 +68,6 @@ void setFordEscortGt() {
|
|||
|
||||
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
|
||||
|
||||
setFrankenso_01_LCD();
|
||||
setFrankenso0_1_joystick();
|
||||
|
||||
setDensoTODO(config);
|
||||
|
||||
engineConfiguration->globalFuelCorrection = 0.75;
|
||||
|
|
|
@ -48,9 +48,7 @@ void setHonda600() {
|
|||
|
||||
//setIndividualCoilsIgnition();
|
||||
|
||||
setFrankenso_01_LCD();
|
||||
commonFrankensoAnalogInputs();
|
||||
setFrankenso0_1_joystick();
|
||||
setTable(config->injectionPhase, 320.0f);
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
#include "defaults.h"
|
||||
|
||||
void setSubaru2003Wrx() {
|
||||
setFrankenso_01_LCD();
|
||||
setFrankenso0_1_joystick();
|
||||
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
||||
engineConfiguration->trigger.customTotalToothCount = 5;
|
||||
engineConfiguration->trigger.customSkippedToothCount = 1;
|
||||
|
|
|
@ -232,14 +232,6 @@
|
|||
#define EFI_AUX_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_LCD
|
||||
#define EFI_LCD TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_IDLE_CONTROL
|
||||
#define EFI_IDLE_CONTROL TRUE
|
||||
#endif
|
||||
|
@ -447,6 +439,3 @@
|
|||
#ifndef EFI_SENT_SUPPORT
|
||||
#define EFI_SENT_SUPPORT FALSE
|
||||
#endif
|
||||
|
||||
// killing joystick for now due to Unable to change broken settings #3227
|
||||
#define EFI_JOYSTICK FALSE
|
||||
|
|
|
@ -32,12 +32,6 @@
|
|||
#undef EFI_MC33816
|
||||
#define EFI_MC33816 FALSE
|
||||
|
||||
#undef EFI_HD44780_LCD
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
|
||||
#undef EFI_LCD
|
||||
#define EFI_LCD FALSE
|
||||
|
||||
// todo: our "DMA-half" ChibiOS patch not implemented for USARTv2/STM32F7/STM32H7
|
||||
#undef EFI_USE_UART_DMA
|
||||
#define EFI_USE_UART_DMA FALSE
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "spark_logic.h"
|
||||
#include "idle_thread.h"
|
||||
#include "svnversion.h"
|
||||
#include "lcd_controller.h"
|
||||
#include "can_hw.h"
|
||||
#include "periodic_thread_controller.h"
|
||||
#include "cdm_ion_sense.h"
|
||||
|
@ -388,25 +387,6 @@ static CommunicationBlinkingTask communicationsBlinkingTask;
|
|||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_LCD
|
||||
class LcdController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
LcdController() : PeriodicController("LCD") { }
|
||||
private:
|
||||
void PeriodicTask(efitick_t nowNt) override {
|
||||
UNUSED(nowNt);
|
||||
setPeriod(NOT_TOO_OFTEN(10 /* ms */, 300));
|
||||
if (engineConfiguration->useLcdScreen) {
|
||||
#if EFI_HD44780_LCD
|
||||
updateHD44780lcd();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static LcdController lcdInstance;
|
||||
#endif /* EFI_LCD */
|
||||
|
||||
#if EFI_HIP_9011
|
||||
extern HIP9011 instance;
|
||||
#endif /* EFI_HIP_9011 */
|
||||
|
@ -876,8 +856,4 @@ void startStatusThreads(void) {
|
|||
initStatusLeds();
|
||||
communicationsBlinkingTask.start();
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_LCD
|
||||
lcdInstance.start();
|
||||
#endif /* EFI_LCD */
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
|||
$(PROJECT_DIR)/controllers/algo/engine.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/engine2.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/gear_detector.cpp \
|
||||
$(PROJECT_DIR)/controllers/gauges/lcd_menu_tree.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/event_registry.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/airmass.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/alphan_airmass.cpp \
|
||||
|
|
|
@ -635,8 +635,6 @@ static void setDefaultEngineConfiguration() {
|
|||
// https://github.com/rusefi/rusefi/issues/4030
|
||||
engineConfiguration->mapErrorDetectionTooHigh = 410;
|
||||
|
||||
engineConfiguration->useLcdScreen = true;
|
||||
|
||||
engineConfiguration->hip9011Gain = 1;
|
||||
|
||||
engineConfiguration->isEngineControlEnabled = true;
|
||||
|
@ -1051,15 +1049,6 @@ void commonFrankensoAnalogInputs() {
|
|||
engineConfiguration->vbattAdcChannel = EFI_ADC_14;
|
||||
}
|
||||
|
||||
void setFrankenso0_1_joystick() {
|
||||
|
||||
engineConfiguration->joystickCenterPin = Gpio::C8;
|
||||
engineConfiguration->joystickAPin = Gpio::D10;
|
||||
engineConfiguration->joystickBPin = Gpio::Unassigned;
|
||||
engineConfiguration->joystickCPin = Gpio::Unassigned;
|
||||
engineConfiguration->joystickDPin = Gpio::D11;
|
||||
}
|
||||
|
||||
// These symbols are weak so that a board_configuration.cpp file can override them
|
||||
__attribute__((weak)) void setBoardDefaultConfiguration() { }
|
||||
__attribute__((weak)) void setBoardConfigOverrides() { }
|
||||
|
|
|
@ -43,7 +43,6 @@ void onBurnRequest();
|
|||
void incrementGlobalConfigurationVersion();
|
||||
|
||||
void commonFrankensoAnalogInputs();
|
||||
void setFrankenso0_1_joystick();
|
||||
|
||||
void emptyCallbackWithConfiguration(engine_configuration_s * engine);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ CONTROLLERS_SRC_CPP = \
|
|||
$(CONTROLLERS_DIR)/actuators/gppwm/gppwm.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/tachometer.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/malfunction_indicator.cpp \
|
||||
$(CONTROLLERS_DIR)/gauges/lcd_controller.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/signal_executor_sleep.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/single_timer_executor.cpp \
|
||||
$(CONTROLLERS_DIR)/system/timer/pwm_generator_logic.cpp \
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
static critical_msg_t warningBuffer;
|
||||
static critical_msg_t criticalErrorMessageBuffer;
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
#include "HD44780.h"
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
extern int warningEnabled;
|
||||
|
||||
bool hasFirmwareErrorFlag = false;
|
||||
|
@ -98,10 +94,6 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
|||
exit(-1);
|
||||
#else // EFI_PROD_CODE
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
lcdShowPanicMessage((char *) msg);
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
firmwareError(OBD_PCM_Processor_Fault, "assert fail %s %s:%d", msg, file, line);
|
||||
|
||||
// If on the main thread, longjmp back to the init process so we can keep USB alive
|
||||
|
|
|
@ -84,7 +84,6 @@
|
|||
|
||||
#if EFI_PROD_CODE
|
||||
#include "pwm_tester.h"
|
||||
#include "lcd_controller.h"
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_CJ125
|
||||
|
@ -660,10 +659,6 @@ void initEngineController() {
|
|||
addConsoleAction("reset_accel", resetAccel);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
initLcdController();
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,348 +0,0 @@
|
|||
/**
|
||||
* @file lcd_controller.cpp
|
||||
*
|
||||
* LCD is a tree-like set of menues controlled by a joystick. At the moment three actions are supported:
|
||||
* "next item"
|
||||
* "enter sub-menu"
|
||||
* "return one level up"
|
||||
*
|
||||
* In case of a 20x4 display top three lines are three menu items you can scroll through and
|
||||
* bottom line is error or warning line.
|
||||
*
|
||||
* By default the first line shows current RPM and time since boot in seconds.
|
||||
* The "more" symbol points at the currently selected menu item.
|
||||
*
|
||||
* @date Aug 14, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
|
||||
|
||||
#include "lcd_controller.h"
|
||||
#include "HD44780.h"
|
||||
#include "rtc_helper.h"
|
||||
#include "svnversion.h"
|
||||
#include "joystick.h"
|
||||
#include "utlist.h"
|
||||
#include "lcd_menu_tree.h"
|
||||
#include "memstreams.h"
|
||||
#include "settings.h"
|
||||
#include "bench_test.h"
|
||||
#include "mmc_card.h"
|
||||
#include "idle_thread.h"
|
||||
#include "fuel_math.h"
|
||||
|
||||
static MenuItem ROOT(NULL, NULL);
|
||||
|
||||
static MenuTree tree(&ROOT);
|
||||
|
||||
/**
|
||||
* todo: add some comment explaining how this works
|
||||
*/
|
||||
static MenuItem miRpm(tree.root, LL_RPM);
|
||||
static MenuItem miSensors(tree.root, "SENSORS");
|
||||
static MenuItem miFuelControl(tree.root, "FUEL CONTROL");
|
||||
static MenuItem miBench(tree.root, "BENCH TEST");
|
||||
static MenuItem miAbout(tree.root, "ABOUT");
|
||||
|
||||
static MenuItem miTriggerErrors(&miRpm, LL_TRIGGER_ERRORS);
|
||||
static MenuItem miTriggerDuty(&miRpm, LL_TRIGGER_DUTY);
|
||||
|
||||
static MenuItem miFuelCltCorr(&miFuelControl, LL_FUEL_CLT_CORRECTION);
|
||||
static MenuItem miFuelIatCorr(&miFuelControl, LL_FUEL_IAT_CORRECTION);
|
||||
static MenuItem miFuelInjectorLag(&miFuelControl, LL_FUEL_INJECTOR_LAG);
|
||||
|
||||
static MenuItem miClt(&miSensors, LL_CLT_TEMPERATURE);
|
||||
static MenuItem miIat(&miSensors, LL_IAT_TEMPERATURE);
|
||||
static MenuItem miTps(&miSensors, LL_TPS);
|
||||
static MenuItem miVBatt(&miSensors, LL_VBATT);
|
||||
static MenuItem miMap(&miSensors, LL_MAP);
|
||||
static MenuItem miAfr(&miSensors, LL_AFR);
|
||||
static MenuItem miBaro(&miSensors, LL_BARO);
|
||||
static MenuItem miMapV(&miSensors, LL_MAF_V);
|
||||
static MenuItem miMapKgHr(&miSensors, LL_MAF_KG_HR);
|
||||
|
||||
static MenuItem miStopEngine(&miBench, "stop engine", scheduleStopEngine);
|
||||
static MenuItem miTestFan(&miBench, "test fan", fanBench);
|
||||
static MenuItem miTestFuelPump(&miBench, "test pump", fuelPumpBench);
|
||||
static MenuItem miTestMIL(&miBench, "test MIL", milBench);
|
||||
static MenuItem miTestIAC(&miBench, "test IAC", startIdleBench);
|
||||
// todo: looks like these are not finished yet?
|
||||
static MenuItem miTestSpark1(&miBench, "test spark1");
|
||||
static MenuItem miTestSpark2(&miBench, "test spark2");
|
||||
static MenuItem miTestSpark3(&miBench, "test spark3");
|
||||
static MenuItem miTestSpark4(&miBench, "test spark4");
|
||||
static MenuItem miTestInj1(&miBench, "test injector1");
|
||||
static MenuItem miTestInj2(&miBench, "test injector2");
|
||||
static MenuItem miTestInj3(&miBench, "test injector3");
|
||||
static MenuItem miTestInj4(&miBench, "test injector4");
|
||||
|
||||
static MenuItem miVersion(&miAbout, LL_VERSION);
|
||||
static MenuItem miConfig(&miAbout, LL_CONFIG);
|
||||
static MenuItem miAlgo(&miAbout, LL_ALGORITHM);
|
||||
static MenuItem miInjection(&miAbout, LL_INJECTION);
|
||||
static MenuItem miIgnition(&miAbout, LL_IGNITION);
|
||||
static MenuItem miInjFlow(&miAbout, LL_ING_FLOW);
|
||||
|
||||
#define DISP_LINES (engineConfiguration->HD44780height - 1)
|
||||
|
||||
static char lcdLineBuffer[30];
|
||||
static MemoryStream lcdLineStream;
|
||||
|
||||
void onJoystick(joystick_button_e button) {
|
||||
/**
|
||||
* this method is invoked on EXTI IRQ thread
|
||||
*/
|
||||
if (button == JB_CENTER) {
|
||||
tree.enterSubMenu();
|
||||
} else if (button == JB_BUTTON_D) {
|
||||
tree.nextItem();
|
||||
} else if (button == JB_BUTTON_A) {
|
||||
tree.back();
|
||||
}
|
||||
// actual repaint happends in the repaint loop
|
||||
}
|
||||
|
||||
char * appendStr(char *ptr, const char *suffix) {
|
||||
for (uint32_t i = 0; i < efiStrlen(suffix); i++) {
|
||||
*ptr++ = suffix[i];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void initLcdController(void) {
|
||||
tree.init(&miRpm, engineConfiguration->HD44780height - 1);
|
||||
msObjectInit(&lcdLineStream, (uint8_t *) lcdLineBuffer, sizeof(lcdLineBuffer), 0);
|
||||
}
|
||||
|
||||
static char buffer[MAX_LCD_WIDTH + 4];
|
||||
|
||||
static void lcdPrintf(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
// todo: migrate to chsnprintf
|
||||
lcdLineStream.eos = 0; // reset
|
||||
chvprintf((BaseSequentialStream *) &lcdLineStream, fmt, ap);
|
||||
lcdLineStream.buffer[lcdLineStream.eos] = 0; // terminator
|
||||
va_end(ap);
|
||||
lcd_HD44780_print_string(lcdLineBuffer);
|
||||
}
|
||||
|
||||
static void showLine(lcd_line_e line, int /*screenY*/) {
|
||||
static char buffer[_MAX_FILLER + 2];
|
||||
|
||||
switch (line) {
|
||||
case LL_VERSION:
|
||||
lcdPrintf("ver %s %d", VCS_VERSION, getRusEfiVersion());
|
||||
return;
|
||||
case LL_CONFIG:
|
||||
lcdPrintf("config %s", getEngine_type_e(engineConfiguration->engineType));
|
||||
return;
|
||||
case LL_RPM:
|
||||
{
|
||||
int seconds = minI(9999, getTimeNowS());
|
||||
lcdPrintf("RPM %d %d ", (int)Sensor::getOrZero(SensorType::Rpm), seconds);
|
||||
}
|
||||
#if EFI_FILE_LOGGING
|
||||
{
|
||||
char sdState;
|
||||
if (engineConfiguration->isSdCardEnabled) {
|
||||
sdState = isSdCardAlive() ? 'L' : 'n';
|
||||
} else {
|
||||
sdState = 'D';
|
||||
}
|
||||
|
||||
lcdPrintf("%c", sdState);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
case LL_CLT_TEMPERATURE:
|
||||
lcdPrintf("Coolant %.2f", Sensor::getOrZero(SensorType::Clt));
|
||||
return;
|
||||
case LL_IAT_TEMPERATURE:
|
||||
lcdPrintf("Intake Air %.2f", Sensor::getOrZero(SensorType::Iat));
|
||||
return;
|
||||
case LL_ALGORITHM:
|
||||
lcdPrintf(getEngine_load_mode_e(engineConfiguration->fuelAlgorithm));
|
||||
return;
|
||||
case LL_INJECTION:
|
||||
lcdPrintf(getInjection_mode_e(engineConfiguration->injectionMode));
|
||||
return;
|
||||
case LL_ING_FLOW:
|
||||
lcdPrintf("Inj %.2fcc", engineConfiguration->injector.flow);
|
||||
return;
|
||||
case LL_IGNITION:
|
||||
lcdPrintf(getIgnition_mode_e(engineConfiguration->ignitionMode));
|
||||
return;
|
||||
case LL_TPS:
|
||||
getPinNameByAdcChannel("tps", engineConfiguration->tps1_1AdcChannel, buffer);
|
||||
|
||||
lcdPrintf("Throttle %s %.2f%%", buffer, Sensor::getOrZero(SensorType::Tps1));
|
||||
return;
|
||||
case LL_FUEL_CLT_CORRECTION:
|
||||
lcdPrintf("CLT corr %.2f", getCltFuelCorrection());
|
||||
return;
|
||||
case LL_FUEL_IAT_CORRECTION:
|
||||
lcdPrintf("IAT corr %.2f", getIatFuelCorrection());
|
||||
return;
|
||||
case LL_FUEL_INJECTOR_LAG:
|
||||
lcdPrintf("ING LAG %.2f", engine->module<InjectorModel>()->m_deadtime);
|
||||
return;
|
||||
case LL_VBATT:
|
||||
lcdPrintf("Battery %.2fv", Sensor::getOrZero(SensorType::BatteryVoltage));
|
||||
return;
|
||||
|
||||
#if EFI_ANALOG_SENSORS
|
||||
case LL_BARO:
|
||||
if (Sensor::hasSensor(SensorType::BarometricPressure)) {
|
||||
lcdPrintf("Baro: %.2f", Sensor::getOrZero(SensorType::BarometricPressure));
|
||||
} else {
|
||||
lcdPrintf("Baro: none");
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
case LL_AFR:
|
||||
if (Sensor::hasSensor(SensorType::Lambda1)) {
|
||||
lcdPrintf("AFR: %.2f", Sensor::getOrZero(SensorType::Lambda1));
|
||||
} else {
|
||||
lcdPrintf("AFR: none");
|
||||
}
|
||||
return;
|
||||
case LL_MAP:
|
||||
if (Sensor::hasSensor(SensorType::Map)) {
|
||||
lcdPrintf("MAP %.2f", Sensor::getOrZero(SensorType::Map));
|
||||
} else {
|
||||
lcdPrintf("MAP: none");
|
||||
}
|
||||
return;
|
||||
case LL_MAF_V:
|
||||
if (Sensor::hasSensor(SensorType::Maf)) {
|
||||
lcdPrintf("MAF: %.2fv", Sensor::getRaw(SensorType::Maf));
|
||||
} else {
|
||||
lcdPrintf("MAF: none");
|
||||
}
|
||||
return;
|
||||
case LL_MAF_KG_HR:
|
||||
if (Sensor::hasSensor(SensorType::Maf)) {
|
||||
lcdPrintf("MAF: %.2f kg/hr", Sensor::getOrZero(SensorType::Maf));
|
||||
} else {
|
||||
lcdPrintf("MAF: none");
|
||||
}
|
||||
return;
|
||||
case LL_TRIGGER_ERRORS:
|
||||
lcdPrintf("Errors");
|
||||
return;
|
||||
case LL_TRIGGER_DUTY:
|
||||
lcdPrintf("Duty");
|
||||
return;
|
||||
default:
|
||||
lcdPrintf("()");
|
||||
}
|
||||
}
|
||||
|
||||
static void fillWithSpaces() {
|
||||
int column = getCurrentHD44780column();
|
||||
for (int r = column; r < 20; r++) {
|
||||
lcd_HD44780_print_char(' ');
|
||||
}
|
||||
}
|
||||
|
||||
void updateHD44780lcd(void) {
|
||||
MenuItem *p = tree.topVisible;
|
||||
int screenY = 0;
|
||||
for (; screenY < tree.linesCount && p != nullptr; screenY++) {
|
||||
lcd_HD44780_set_position(screenY, 0);
|
||||
char firstChar;
|
||||
if (p == tree.current) {
|
||||
if (p->callback != NULL) {
|
||||
firstChar = '!';
|
||||
} else {
|
||||
firstChar = p->firstChild == NULL ? '*' : '>';
|
||||
}
|
||||
} else {
|
||||
firstChar = ' ';
|
||||
}
|
||||
lcd_HD44780_print_char(firstChar);
|
||||
if (p->lcdLine == LL_STRING) {
|
||||
lcd_HD44780_print_string(p->text);
|
||||
} else {
|
||||
showLine(p->lcdLine, screenY);
|
||||
}
|
||||
fillWithSpaces();
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
for (; screenY < tree.linesCount; screenY++) {
|
||||
lcd_HD44780_set_position(screenY, 0);
|
||||
fillWithSpaces();
|
||||
}
|
||||
|
||||
|
||||
const char * message = hasFirmwareErrorFlag ? getCriticalErrorMessage() : getWarningMessage();
|
||||
memcpy(buffer, message, engineConfiguration->HD44780width);
|
||||
buffer[engineConfiguration->HD44780width] = 0;
|
||||
lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0);
|
||||
lcd_HD44780_print_string(buffer);
|
||||
fillWithSpaces();
|
||||
|
||||
//
|
||||
// lcd_HD44780_set_position(0, 9);
|
||||
// /**
|
||||
// * this would blink so that we know the LCD is alive
|
||||
// */
|
||||
// if (isEven) {
|
||||
// lcd_HD44780_print_char('R');
|
||||
// } else {
|
||||
// lcd_HD44780_print_char(' ');
|
||||
// }
|
||||
// lcd_HD44780_set_position(0, 10);
|
||||
//
|
||||
// char * ptr = itoa10(buffer, Sensor::getOrZero(SensorType::Rpm));
|
||||
// ptr[0] = 0;
|
||||
// int len = ptr - buffer;
|
||||
// for (int i = 0; i < 6 - len; i++) {
|
||||
// lcd_HD44780_print_char(' ');
|
||||
// }
|
||||
// lcd_HD44780_print_string(buffer);
|
||||
//
|
||||
// if (hasFirmwareError()) {
|
||||
// memcpy(buffer, getCriticalErrorMessage(), LCD_WIDTH);
|
||||
// buffer[LCD_WIDTH] = 0;
|
||||
// lcd_HD44780_set_position(1, 0);
|
||||
// lcd_HD44780_print_string(buffer);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// lcd_HD44780_set_position(1, 0);
|
||||
// memset(buffer, ' ', LCD_WIDTH);
|
||||
// memcpy(buffer, getWarningMessage(), LCD_WIDTH);
|
||||
// buffer[LCD_WIDTH] = 0;
|
||||
// lcd_HD44780_print_string(buffer);
|
||||
//
|
||||
// if (engineConfiguration->HD44780height < 3) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// int index = (getTimeNowS() / 2) % (NUMBER_OF_DIFFERENT_LINES / 2);
|
||||
//
|
||||
// prepareCurrentSecondLine(engine, index);
|
||||
// buffer[LCD_WIDTH] = 0;
|
||||
// lcd_HD44780_set_position(2, 0);
|
||||
// lcd_HD44780_print_string(buffer);
|
||||
//
|
||||
// prepareCurrentSecondLine(engine, index + NUMBER_OF_DIFFERENT_LINES / 2);
|
||||
// buffer[LCD_WIDTH] = 0;
|
||||
// lcd_HD44780_set_position(3, 0);
|
||||
// lcd_HD44780_print_string(buffer);
|
||||
//
|
||||
//#if EFI_PROD_CODE
|
||||
// dateToString(dateBuffer);
|
||||
// lcd_HD44780_set_position(1, 0);
|
||||
// lcd_HD44780_print_string(dateBuffer);
|
||||
//#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* @file lcd_controller.h
|
||||
*
|
||||
* @date Aug 14, 2014
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_LCD_WIDTH 20
|
||||
|
||||
void initLcdController(void);
|
||||
void updateHD44780lcd(void);
|
|
@ -1,94 +0,0 @@
|
|||
/**
|
||||
* @file lcd_menu_tree.cpp
|
||||
*
|
||||
* @date Jan 6, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "stddef.h"
|
||||
#include "lcd_menu_tree.h"
|
||||
|
||||
MenuTree::MenuTree(MenuItem *root) {
|
||||
this->root = root;
|
||||
}
|
||||
|
||||
void MenuTree::init(MenuItem *first, int linesCount) {
|
||||
this->linesCount = linesCount;
|
||||
current = first;
|
||||
topVisible = first;
|
||||
}
|
||||
|
||||
void MenuTree::enterSubMenu(void) {
|
||||
if (current->firstChild != NULL) {
|
||||
current = topVisible = current->firstChild;
|
||||
} else if (current->callback != NULL) {
|
||||
VoidCallback cb = current->callback;
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTree::back(void) {
|
||||
if (current->parent == root)
|
||||
return; // we are on the top level already
|
||||
current = topVisible = current->parent->topOfTheList;
|
||||
}
|
||||
|
||||
void MenuTree::nextItem(void) {
|
||||
if (!current->next) {
|
||||
current = topVisible = current->topOfTheList;
|
||||
return;
|
||||
}
|
||||
current = current->next;
|
||||
if (current->index - topVisible->index == linesCount)
|
||||
topVisible = topVisible->next;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor created a menu item and associates a callback with it
|
||||
*/
|
||||
MenuItem::MenuItem(MenuItem * parent, const char *text, VoidCallback callback) {
|
||||
baseConstructor(parent, LL_STRING, text, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks like this constructor is used to create
|
||||
*/
|
||||
MenuItem::MenuItem(MenuItem * parent, const char *text) {
|
||||
baseConstructor(parent, LL_STRING, text, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used for lines with dynamic content
|
||||
*/
|
||||
MenuItem::MenuItem(MenuItem * parent, lcd_line_e lcdLine) {
|
||||
baseConstructor(parent, lcdLine, NULL, NULL);
|
||||
}
|
||||
|
||||
void MenuItem::baseConstructor(MenuItem * parent, lcd_line_e lcdLine, const char *text, VoidCallback callback) {
|
||||
this->parent = parent;
|
||||
this->lcdLine = lcdLine;
|
||||
this->text = text;
|
||||
this->callback = callback;
|
||||
|
||||
firstChild = nullptr;
|
||||
lastChild = nullptr;
|
||||
topOfTheList = nullptr;
|
||||
next = nullptr;
|
||||
index = 0;
|
||||
|
||||
// root element has NULL parent
|
||||
if (parent != NULL) {
|
||||
if (!parent->firstChild) {
|
||||
topOfTheList = this;
|
||||
parent->firstChild = this;
|
||||
}
|
||||
if (parent->lastChild != NULL) {
|
||||
index = parent->lastChild->index + 1;
|
||||
topOfTheList = parent->lastChild->topOfTheList;
|
||||
parent->lastChild->next = this;
|
||||
}
|
||||
parent->lastChild = this;
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
* @file lcd_menu_tree.h
|
||||
*
|
||||
* @date Jan 6, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
LL_STRING,
|
||||
LL_VERSION,
|
||||
LL_CONFIG,
|
||||
LL_ALGORITHM,
|
||||
LL_INJECTION,
|
||||
LL_IGNITION,
|
||||
LL_ING_FLOW,
|
||||
|
||||
LL_RPM,
|
||||
LL_TRIGGER_ERRORS,
|
||||
LL_TRIGGER_DUTY,
|
||||
|
||||
LL_CLT_TEMPERATURE,
|
||||
LL_IAT_TEMPERATURE,
|
||||
LL_AFR,
|
||||
LL_TPS,
|
||||
LL_VBATT,
|
||||
LL_MAF,
|
||||
LL_MAP,
|
||||
LL_MAF_V,
|
||||
LL_MAF_KG_HR,
|
||||
LL_EGO,
|
||||
LL_BARO,
|
||||
|
||||
LL_FUEL_BASE,
|
||||
LL_FUEL_TOTAL,
|
||||
LL_FUEL_CLT_CORRECTION,
|
||||
LL_FUEL_IAT_CORRECTION,
|
||||
LL_FUEL_INJECTOR_LAG,
|
||||
} lcd_line_e;
|
||||
|
||||
typedef void (*VoidCallback)(void);
|
||||
|
||||
class MenuItem {
|
||||
public:
|
||||
void baseConstructor(MenuItem * parent, lcd_line_e lcdLine, const char *text, VoidCallback callback);
|
||||
MenuItem(MenuItem * parent, const char *text, VoidCallback callback);
|
||||
MenuItem(MenuItem * parent, const char *text);
|
||||
MenuItem(MenuItem * parent, lcd_line_e lcdLine);
|
||||
const char *text;
|
||||
lcd_line_e lcdLine;
|
||||
int index;
|
||||
// that's upper level menu item
|
||||
MenuItem *parent;
|
||||
MenuItem *topOfTheList;
|
||||
MenuItem *firstChild;
|
||||
MenuItem *lastChild;
|
||||
MenuItem *next;
|
||||
VoidCallback callback;
|
||||
};
|
||||
|
||||
class MenuTree {
|
||||
public:
|
||||
explicit MenuTree(MenuItem *root);
|
||||
void nextItem(void);
|
||||
void back(void);
|
||||
void enterSubMenu(void);
|
||||
void init(MenuItem *first, int linesCount);
|
||||
MenuItem *root;
|
||||
|
||||
int linesCount = 0;
|
||||
MenuItem *current = nullptr;
|
||||
MenuItem *topVisible = nullptr;
|
||||
};
|
|
@ -277,7 +277,6 @@ static void runChibioTest() {
|
|||
print("EFI_EMULATE_POSITION_SENSORS=%d\r\n", EFI_EMULATE_POSITION_SENSORS);
|
||||
print("EFI_ANALOG_SENSORS=%d\r\n", EFI_ANALOG_SENSORS);
|
||||
print("EFI_INTERNAL_ADC=%d\r\n", EFI_INTERNAL_ADC);
|
||||
print("EFI_HD44780_LCD=%d\r\n", EFI_HD44780_LCD);
|
||||
print("EFI_MAP_AVERAGING=%d\r\n", EFI_MAP_AVERAGING);
|
||||
print("EFI_LOGIC_ANALYZER=%d\r\n", EFI_LOGIC_ANALYZER);
|
||||
print("EFI_ENGINE_SNIFFER=%d\r\n", EFI_ENGINE_SNIFFER);
|
||||
|
|
|
@ -6,8 +6,7 @@ HW_LAYER_DRIVERS_INC = \
|
|||
$(DRIVERS_DIR)/can \
|
||||
$(DRIVERS_DIR)/sent \
|
||||
$(DRIVERS_DIR)/serial \
|
||||
$(DRIVERS_DIR)/i2c \
|
||||
$(DRIVERS_DIR)/lcd
|
||||
$(DRIVERS_DIR)/i2c
|
||||
|
||||
HW_LAYER_DRIVERS_CORE = \
|
||||
|
||||
|
@ -31,4 +30,3 @@ HW_LAYER_DRIVERS_CPP = \
|
|||
$(DRIVERS_DIR)/gpio/l9779.cpp \
|
||||
$(DRIVERS_DIR)/gpio/protected_gpio.cpp \
|
||||
$(DRIVERS_DIR)/sent/sent_hw_icu.cpp \
|
||||
$(DRIVERS_DIR)/lcd/HD44780.cpp
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
/**
|
||||
* @file HD44780.cpp
|
||||
* @brief HD44780 character display driver
|
||||
*
|
||||
* see http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller
|
||||
* @date 13.12.2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
|
||||
#include "HD44780.h"
|
||||
#include "string.h"
|
||||
|
||||
enum {
|
||||
LCD_HD44780_DISPLAY_CLEAR = 0x01,
|
||||
LCD_HD44780_SHIFT_CURSOR_RIGHT = 0x06,
|
||||
LCD_HD44780_DISPLAY_ON = 0x0C,
|
||||
LCD_HD44780_4_BIT_BUS = 0x20,
|
||||
LCD_HD44780_RESET = 0x30,
|
||||
LCD_HD44780_DDRAM_ADDR = 0x80,
|
||||
|
||||
// LCD_2X16_8_BIT_BUS = 0x30,
|
||||
// LCD_2X16_LINE_ONE = 0x20,
|
||||
// LCD_2X16_LINES_TWO = 0x28,
|
||||
// LCD_2X16_FONT_5X8 = 0x20,
|
||||
// LCD_2X16_FONT_5X10 = 0x24,
|
||||
// LCD_2X16_DISPLAY_HOME = 0x02,
|
||||
// LCD_2X16_DISPLAY_RIGHT = 0x1C,
|
||||
// LCD_2X16_DISPLAY_LEFT = 0x18,
|
||||
// LCD_2X16_DISPLAY_SHIFT = 0x05,
|
||||
// LCD_2X16_CURSOR_ON = 0x0A,
|
||||
// LCD_2X16_CURSOR_BLINK = 0x09,
|
||||
// LCD_2X16_CURSOR_RIGHT = 0x14,
|
||||
// LCD_2X16_CURSOR_LEFT = 0x10,
|
||||
// LCD_2X16_SHIFT_LEFT = 0x04,
|
||||
// LCD_2X16_CGRAM_ADDR = 0x40,
|
||||
// LCD_2X16_BUSY_FLAG = 0x80,
|
||||
// LCD_2X16_COMMAND = 0x01,
|
||||
// LCD_2X16_DATA = 0x00,
|
||||
} /*lcd_HD44780_command*/;
|
||||
|
||||
// http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html
|
||||
static const int lineStart[] = { 0, 0x40, 0x14, 0x54 };
|
||||
|
||||
static int BUSY_WAIT_DELAY = FALSE;
|
||||
static int currentRow = 0;
|
||||
static int currentColumn = 0;
|
||||
|
||||
static void lcdSleep(int period) {
|
||||
if (BUSY_WAIT_DELAY) {
|
||||
// this mode is useful for displaying messages to report OS fatal issues
|
||||
|
||||
int ticks = CORE_CLOCK / 1000000 * period;
|
||||
int a = 0;
|
||||
for (int i = 0; i < ticks; i++)
|
||||
a += i;
|
||||
// the purpose of this code is to fool the compiler so that the loop is not optimized away
|
||||
efiAssertVoid(CUSTOM_ERR_6656, a != 0, "true");
|
||||
|
||||
} else {
|
||||
chThdSleepMicroseconds(period);
|
||||
}
|
||||
}
|
||||
|
||||
//static char txbuf[1];
|
||||
#define LCD_PORT_EXP_ADDR 0x20
|
||||
|
||||
static bool lcd_HD44780_is_enabled() {
|
||||
/* check for valid LCD setting */
|
||||
return ((engineConfiguration->displayMode == DM_HD44780) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_rs)) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_e)) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_db4)) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_db5)) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_db6)) &&
|
||||
(isBrainPinValid(engineConfiguration->HD44780_db7)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void lcd_HD44780_write(uint8_t data) {
|
||||
if (engineConfiguration->displayMode == DM_HD44780) {
|
||||
writePad("lcd", engineConfiguration->HD44780_db7,
|
||||
data & 0x80 ? 1 : 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db6,
|
||||
data & 0x40 ? 1 : 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db5,
|
||||
data & 0x20 ? 1 : 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db4,
|
||||
data & 0x10 ? 1 : 0);
|
||||
|
||||
writePad("lcd", engineConfiguration->HD44780_e, 1); // En high
|
||||
lcdSleep(10); // enable pulse must be >450ns
|
||||
writePad("lcd", engineConfiguration->HD44780_e, 0); // En low
|
||||
lcdSleep(40); // commands need > 37us to settle
|
||||
} else {
|
||||
|
||||
// LCD D4_pin -> P4
|
||||
// LCD D5_pin -> P5
|
||||
// LCD D6_pin -> P6
|
||||
// LCD D7_pin -> P7
|
||||
// LCD Pin RS -> P0
|
||||
// LCD Pin RW -> P1
|
||||
// LCD Pin E -> P2
|
||||
|
||||
// todo: finish all this stuff
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void lcd_HD44780_write_command(uint8_t data) {
|
||||
palClearPad(getHwPort("lcd", engineConfiguration->HD44780_rs), getHwPin("lcd", engineConfiguration->HD44780_rs));
|
||||
|
||||
lcd_HD44780_write(data);
|
||||
lcd_HD44780_write(data << 4);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void lcd_HD44780_write_data(uint8_t data) {
|
||||
palSetPad(getHwPort("lcd", engineConfiguration->HD44780_rs), getHwPin("lcd", engineConfiguration->HD44780_rs));
|
||||
|
||||
lcd_HD44780_write(data);
|
||||
lcd_HD44780_write(data << 4);
|
||||
currentColumn++;
|
||||
|
||||
palClearPad(getHwPort("lcd", engineConfiguration->HD44780_rs), getHwPin("lcd", engineConfiguration->HD44780_rs));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void lcd_HD44780_set_position(uint8_t row, uint8_t column) {
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
||||
efiAssertVoid(CUSTOM_ERR_6657, row <= engineConfiguration->HD44780height, "invalid row");
|
||||
currentRow = row;
|
||||
currentColumn = column;
|
||||
lcd_HD44780_write_command(LCD_HD44780_DDRAM_ADDR + lineStart[row] + column);
|
||||
}
|
||||
|
||||
int getCurrentHD44780row(void) {
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return 0;
|
||||
|
||||
return currentRow;
|
||||
}
|
||||
|
||||
int getCurrentHD44780column(void) {
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return 0;
|
||||
|
||||
return currentColumn;
|
||||
}
|
||||
|
||||
void lcd_HD44780_print_char(char data) {
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
||||
if (data == '\n') {
|
||||
lcd_HD44780_set_position(++currentRow, 0);
|
||||
} else {
|
||||
lcd_HD44780_write_data(data);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_HD44780_print_string(const char* string) {
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
||||
while (*string != 0x00)
|
||||
lcd_HD44780_print_char(*string++);
|
||||
}
|
||||
|
||||
//getHwPin(engineConfiguration->HD44780_db7)
|
||||
static void lcdInfo() {
|
||||
efiPrintf("HD44780 RS=%s", hwPortname(engineConfiguration->HD44780_rs));
|
||||
efiPrintf("HD44780 E=%s", hwPortname(engineConfiguration->HD44780_e));
|
||||
efiPrintf("HD44780 D4=%s", hwPortname(engineConfiguration->HD44780_db4));
|
||||
efiPrintf("HD44780 D5=%s", hwPortname(engineConfiguration->HD44780_db5));
|
||||
efiPrintf("HD44780 D6=%s", hwPortname(engineConfiguration->HD44780_db6));
|
||||
efiPrintf("HD44780 D7=%s", hwPortname(engineConfiguration->HD44780_db7));
|
||||
}
|
||||
|
||||
void stopHD44780_pins() {
|
||||
efiSetPadUnused(activeConfiguration.HD44780_rs);
|
||||
efiSetPadUnused(activeConfiguration.HD44780_e);
|
||||
efiSetPadUnused(activeConfiguration.HD44780_db4);
|
||||
efiSetPadUnused(activeConfiguration.HD44780_db5);
|
||||
efiSetPadUnused(activeConfiguration.HD44780_db6);
|
||||
efiSetPadUnused(activeConfiguration.HD44780_db7);
|
||||
}
|
||||
|
||||
void startHD44780_pins() {
|
||||
if (lcd_HD44780_is_enabled()) {
|
||||
// initialize hardware lines
|
||||
efiSetPadMode("lcd RS", engineConfiguration->HD44780_rs, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
efiSetPadMode("lcd E", engineConfiguration->HD44780_e, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
efiSetPadMode("lcd DB4", engineConfiguration->HD44780_db4, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
efiSetPadMode("lcd DB5", engineConfiguration->HD44780_db5, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
efiSetPadMode("lcd DB6", engineConfiguration->HD44780_db6, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
efiSetPadMode("lcd DB7", engineConfiguration->HD44780_db7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
// and zero values
|
||||
writePad("lcd", engineConfiguration->HD44780_rs, 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_e, 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db4, 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db5, 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db6, 0);
|
||||
writePad("lcd", engineConfiguration->HD44780_db7, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_HD44780_init() {
|
||||
addConsoleAction("lcdinfo", lcdInfo);
|
||||
|
||||
if (engineConfiguration->displayMode == DM_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (engineConfiguration->displayMode > DM_HD44780_OVER_PCF8574) {
|
||||
warning(CUSTOM_ERR_DISPLAY_MODE, "Unexpected displayMode %d", engineConfiguration->displayMode);
|
||||
// I2C pins need initialization, code needs more work & testing
|
||||
return;
|
||||
}
|
||||
|
||||
efiPrintf("lcd_HD44780_init %d", engineConfiguration->displayMode);
|
||||
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
||||
startHD44780_pins();
|
||||
|
||||
chThdSleepMilliseconds(20); // LCD needs some time to wake up
|
||||
lcd_HD44780_write(LCD_HD44780_RESET); // reset 1x
|
||||
chThdSleepMilliseconds(1);
|
||||
lcd_HD44780_write(LCD_HD44780_RESET); // reset 2x
|
||||
lcd_HD44780_write(LCD_HD44780_RESET); // reset 3x
|
||||
|
||||
lcd_HD44780_write(LCD_HD44780_4_BIT_BUS); // 4 bit, 2 line
|
||||
chThdSleepMicroseconds(40);
|
||||
|
||||
lcd_HD44780_write(LCD_HD44780_4_BIT_BUS); // 4 bit, 2 line
|
||||
lcd_HD44780_write(0x80);
|
||||
chThdSleepMicroseconds(40);
|
||||
|
||||
lcd_HD44780_write_command(0x08); // display and cursor control
|
||||
chThdSleepMicroseconds(40);
|
||||
|
||||
lcd_HD44780_write_command(LCD_HD44780_DISPLAY_CLEAR);
|
||||
chThdSleepMilliseconds(2);
|
||||
|
||||
lcd_HD44780_write_command(LCD_HD44780_SHIFT_CURSOR_RIGHT);
|
||||
chThdSleepMilliseconds(2);
|
||||
|
||||
lcd_HD44780_write_command(LCD_HD44780_DISPLAY_ON);
|
||||
|
||||
lcd_HD44780_set_position(0, 0);
|
||||
efiPrintf("lcd_HD44780_init() done");
|
||||
}
|
||||
|
||||
void lcdShowPanicMessage(char *message) {
|
||||
/* this is not a good idea to access config data
|
||||
* when everything goes wrong... */
|
||||
if (!lcd_HD44780_is_enabled())
|
||||
return;
|
||||
|
||||
BUSY_WAIT_DELAY = TRUE;
|
||||
lcd_HD44780_set_position(0, 0);
|
||||
lcd_HD44780_print_string("PANIC\n");
|
||||
lcd_HD44780_print_string(message);
|
||||
}
|
||||
|
||||
#endif /* EFI_HD44780_LCD */
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* @file HD44780.h
|
||||
*
|
||||
* @date 13.12.2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void startHD44780_pins();
|
||||
void stopHD44780_pins();
|
||||
void lcd_HD44780_init();
|
||||
void lcd_HD44780_set_position(uint8_t row, uint8_t column);
|
||||
void lcd_HD44780_print_char(char data);
|
||||
void lcd_HD44780_print_string(const char *string);
|
||||
int getCurrentHD44780row(void);
|
||||
int getCurrentHD44780column(void);
|
||||
|
||||
void lcdShowPanicMessage(char *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
@ -40,8 +40,6 @@
|
|||
#include "hip9011.h"
|
||||
#include "histogram.h"
|
||||
#include "gps_uart.h"
|
||||
#include "HD44780.h"
|
||||
#include "joystick.h"
|
||||
#include "sent.h"
|
||||
#include "cdm_ion_sense.h"
|
||||
#include "trigger_central.h"
|
||||
|
@ -253,10 +251,6 @@ void applyNewHardwareSettings() {
|
|||
stopSent();
|
||||
#endif // EFI_SENT_SUPPORT
|
||||
|
||||
#if (HAL_USE_PAL && EFI_JOYSTICK)
|
||||
stopJoystickPins();
|
||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
||||
|
||||
#if EFI_CAN_SUPPORT
|
||||
stopCanPins();
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
@ -287,10 +281,6 @@ void applyNewHardwareSettings() {
|
|||
stopSpi(SPI_DEVICE_4);
|
||||
}
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
stopHD44780_pins();
|
||||
#endif /* #if EFI_HD44780_LCD */
|
||||
|
||||
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode)) {
|
||||
// bug? duplication with stopPedalPins?
|
||||
efiSetPadUnused(activeConfiguration.clutchUpPin);
|
||||
|
@ -318,10 +308,6 @@ void applyNewHardwareSettings() {
|
|||
|
||||
startHardware();
|
||||
|
||||
#if EFI_HD44780_LCD
|
||||
startHD44780_pins();
|
||||
#endif /* #if EFI_HD44780_LCD */
|
||||
|
||||
#if EFI_PROD_CODE && (BOARD_EXT_GPIOCHIPS > 0)
|
||||
/* TODO: properly restart gpio chips...
|
||||
* This is only workaround for "CS pin lost" bug
|
||||
|
@ -466,10 +452,6 @@ void stopHardware() {
|
|||
* This method is invoked both on ECU start and configuration change
|
||||
*/
|
||||
void startHardware() {
|
||||
#if (HAL_USE_PAL && EFI_JOYSTICK)
|
||||
startJoystickPins();
|
||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
validateTriggerInputs();
|
||||
|
||||
|
@ -498,15 +480,6 @@ const I2CConfig i2cfg = {
|
|||
#endif
|
||||
|
||||
void initHardware() {
|
||||
#if EFI_HD44780_LCD
|
||||
lcd_HD44780_init();
|
||||
if (hasFirmwareError())
|
||||
return;
|
||||
|
||||
lcd_HD44780_print_string(VCS_VERSION);
|
||||
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
||||
if (hasFirmwareError()) {
|
||||
return;
|
||||
}
|
||||
|
@ -597,10 +570,6 @@ void initHardware() {
|
|||
cdmIonInit();
|
||||
#endif // EFI_CDM_INTEGRATION
|
||||
|
||||
#if (HAL_USE_PAL && EFI_JOYSTICK)
|
||||
initJoystick();
|
||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
||||
|
||||
#if EFI_SENT_SUPPORT
|
||||
initSent();
|
||||
#endif
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/**
|
||||
* @file joystick.cpp
|
||||
*
|
||||
* See lcd_controller.cpp for more information
|
||||
* See void onJoystick(joystick_button_e button)
|
||||
*
|
||||
* TODO: separate EXTI layer from joystick logic
|
||||
* You cannot use two pins with same index for EXTI (for instance PA5 and PE5) since these would
|
||||
* be using same EXTI line. See https://stm32f4-discovery.net/2014/08/stm32f4-external-interrupts-tutorial/
|
||||
* See also comments in digital_input_icu.cpp
|
||||
*
|
||||
* @date Jan 2, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#if (HAL_USE_PAL && EFI_JOYSTICK)
|
||||
#include "joystick.h"
|
||||
#include "digital_input_exti.h"
|
||||
|
||||
static int joyTotal = 0;
|
||||
static int joyCenter;
|
||||
static int joyA = 0;
|
||||
static int joyB = 0;
|
||||
static int joyC = 0;
|
||||
static int joyD = 0;
|
||||
|
||||
// 50ms
|
||||
#define NT_EVENT_GAP US2NT(50 *1000)
|
||||
|
||||
static efitick_t lastEventTime = 0;
|
||||
|
||||
static bool isJitter() {
|
||||
efitick_t now = getTimeNowNt();
|
||||
if (now - lastEventTime < NT_EVENT_GAP)
|
||||
return true; // two consecutive events are probably just jitter
|
||||
lastEventTime = now;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void extCallback(ioportmask_t channel) {
|
||||
if (isJitter())
|
||||
return;
|
||||
joyTotal++;
|
||||
joystick_button_e button;
|
||||
// todo: I guess it's time to reduce code duplication and start working with an array
|
||||
if (channel == getHwPin("joy", engineConfiguration->joystickCenterPin)) {
|
||||
joyCenter++;
|
||||
button = JB_CENTER;
|
||||
} else if (channel == getHwPin("joy", engineConfiguration->joystickAPin)) {
|
||||
joyA++;
|
||||
button = JB_BUTTON_A;
|
||||
/* not used so far
|
||||
} else if (channel == getHwPin("joy", engineConfiguration->joystickBPin)) {
|
||||
joyB++;
|
||||
button = JB_BUTTON_B;
|
||||
} else if (channel == getHwPin("joy", engineConfiguration->joystickCPin)) {
|
||||
joyC++;
|
||||
button = JB_BUTTON_C;
|
||||
*/
|
||||
} else if (channel == getHwPin("joy", engineConfiguration->joystickDPin)) {
|
||||
joyD++;
|
||||
button = JB_BUTTON_D;
|
||||
} else {
|
||||
// unexpected channel
|
||||
return;
|
||||
}
|
||||
#if EFI_HD44780_LCD
|
||||
onJoystick(button);
|
||||
#else
|
||||
UNUSED(button);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void joystickInfo() {
|
||||
efiPrintf("total %d center=%d@%s", joyTotal, joyCenter,
|
||||
hwPortname(engineConfiguration->joystickCenterPin));
|
||||
efiPrintf("a=%d@%s", joyA, hwPortname(engineConfiguration->joystickAPin));
|
||||
efiPrintf("b=%d@%s", joyB, hwPortname(engineConfiguration->joystickBPin));
|
||||
efiPrintf("c=%d@%s", joyC, hwPortname(engineConfiguration->joystickCPin));
|
||||
efiPrintf("d=%d@%s", joyD, hwPortname(engineConfiguration->joystickDPin));
|
||||
}
|
||||
|
||||
static bool isJoystickEnabled() {
|
||||
return (isBrainPinValid(engineConfiguration->joystickCenterPin) &&
|
||||
isBrainPinValid(engineConfiguration->joystickAPin) &&
|
||||
// not used so far isBrainPinValid(engineConfiguration->joystickBPin) &&
|
||||
// not used so far isBrainPinValid(engineConfiguration->joystickCPin) &&
|
||||
isBrainPinValid(engineConfiguration->joystickDPin));
|
||||
}
|
||||
|
||||
void stopJoystickPins() {
|
||||
// todo: should be 'efiExtiDisablePin' or smth?
|
||||
efiSetPadUnused(activeConfiguration.joystickCenterPin);
|
||||
efiSetPadUnused(activeConfiguration.joystickAPin);
|
||||
efiSetPadUnused(activeConfiguration.joystickDPin);
|
||||
}
|
||||
|
||||
void startJoystickPins() {
|
||||
// todo: extract 'configurePalInputPin() method?
|
||||
// input capture driver would claim pin ownership so we are not using 'efiSetPadMode' here
|
||||
efiSetPadModeWithoutOwnershipAcquisition("joy center", engineConfiguration->joystickCenterPin, PAL_MODE_INPUT_PULLUP);
|
||||
efiSetPadModeWithoutOwnershipAcquisition("joy A", engineConfiguration->joystickAPin, PAL_MODE_INPUT_PULLUP);
|
||||
// not used so far efiSetPadModeWithoutOwnershipAcquisition("joy B", engineConfiguration->joystickBPin, PAL_MODE_INPUT_PULLUP);
|
||||
// not used so far efiSetPadModeWithoutOwnershipAcquisition("joy C", engineConfiguration->joystickCPin, PAL_MODE_INPUT_PULLUP);
|
||||
efiSetPadModeWithoutOwnershipAcquisition("joy D", engineConfiguration->joystickDPin, PAL_MODE_INPUT_PULLUP);
|
||||
}
|
||||
|
||||
void initJoystick() {
|
||||
int channel;
|
||||
addConsoleAction("joystickinfo", joystickInfo);
|
||||
if (!isJoystickEnabled())
|
||||
return;
|
||||
|
||||
channel = getHwPin("joy", engineConfiguration->joystickCenterPin);
|
||||
efiExtiEnablePin("joy", engineConfiguration->joystickCenterPin, PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback, (void *)channel);
|
||||
channel = getHwPin("joy", engineConfiguration->joystickAPin);
|
||||
efiExtiEnablePin("joy", engineConfiguration->joystickAPin, PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback, (void *)channel);
|
||||
// not used so far applyPin(engineConfiguration->joystickBPin);
|
||||
// not used so far applyPin(engineConfiguration->joystickCPin);
|
||||
channel = getHwPin("joy", engineConfiguration->joystickDPin);
|
||||
efiExtiEnablePin("joy", engineConfiguration->joystickDPin, PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)(void *)extCallback, (void *)channel);
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_PAL && EFI_JOYSTICK */
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* @file joystick.h
|
||||
*
|
||||
* @date Jan 2, 2015
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
|
||||
typedef enum {
|
||||
JB_CENTER = 0,
|
||||
JB_BUTTON_A = 1,
|
||||
// not used so far JB_BUTTON_B = 2,
|
||||
// not used so far JB_BUTTON_C = 3,
|
||||
JB_BUTTON_D = 4,
|
||||
} joystick_button_e;
|
||||
|
||||
void onJoystick(joystick_button_e button);
|
||||
void initJoystick();
|
||||
void startJoystickPins();
|
||||
void stopJoystickPins();
|
|
@ -7,7 +7,6 @@ HW_SENSORS_CPP = \
|
|||
$(HW_SENSORS_DIR)/cj125_logic.cpp \
|
||||
$(HW_SENSORS_DIR)/yaw_rate_sensor.cpp \
|
||||
$(HW_SENSORS_DIR)/accelerometer.cpp \
|
||||
$(HW_SENSORS_DIR)/joystick.cpp \
|
||||
$(HW_SENSORS_DIR)/lps25.cpp \
|
||||
$(HW_SENSORS_DIR)/max31855.cpp \
|
||||
$(HW_SENSORS_DIR)/gps_uart.cpp
|
||||
|
|
|
@ -566,14 +566,8 @@ custom can_nbc_e 1 bits, U08, @OFFSET@, [0:4], "None", "FIAT", "VAG", "MAZDA RX8
|
|||
can_nbc_e canNbcType;set can_mode X
|
||||
|
||||
int canSleepPeriodMs;CANbus thread period in ms;"ms", 1, 0, 0, 1000, 2
|
||||
|
||||
|
||||
custom display_mode_e 1 bits, U08, @OFFSET@, [0:1], "none", "hd44780", "hd44780 over pcf8574"
|
||||
display_mode_e displayMode;
|
||||
|
||||
uint8_t unused440
|
||||
int byFirmwareVersion;;"index", 1, 0, 0, 300, 0
|
||||
int HD44780width;;"index", 1, 0, 0, 300, 0
|
||||
int HD44780height;;"index", 1, 0, 0, 300, 0
|
||||
|
||||
adc_channel_e tps1_1AdcChannel;First throttle body, first sensor. See also pedalPositionAdcChannel
|
||||
adc_channel_e vbattAdcChannel;This is the processor input pin that the battery voltage circuit is connected to, if you are unsure of what pin to use, check the schematic that corresponds to your PCB.
|
||||
|
@ -672,16 +666,7 @@ engineSyncCam_e engineSyncCam;Select which cam is used for engine sync. Other ca
|
|||
|
||||
pin_output_mode_e injectionPinMode;
|
||||
pin_output_mode_e ignitionPinMode;
|
||||
Gpio HD44780_rs;
|
||||
Gpio HD44780_e;
|
||||
|
||||
Gpio HD44780_db4;
|
||||
Gpio HD44780_db5;
|
||||
Gpio HD44780_db6;
|
||||
Gpio HD44780_db7;
|
||||
|
||||
Gpio gps_rx_pin;
|
||||
Gpio gps_tx_pin;
|
||||
output_pin_e fuelPumpPin;
|
||||
pin_output_mode_e fuelPumpPinMode;
|
||||
|
||||
|
@ -768,7 +753,7 @@ bit is_enabled_spi_2
|
|||
|
||||
bit enabledStep1Limiter
|
||||
bit useTpicAdvancedMode
|
||||
bit useLcdScreen
|
||||
bit unused760b12
|
||||
bit verboseTLE8888
|
||||
bit enableVerboseCanTx;CAN broadcast using custom rusEFI protocol\nenable can_broadcast/disable can_broadcast
|
||||
bit etb1configured
|
||||
|
@ -877,12 +862,6 @@ custom script_setting_t 4 scalar, F32, @OFFSET@, "", 1, 0, 0, 18000, 2
|
|||
|
||||
Gpio spi3sckPin;
|
||||
Gpio cdmInputPin;Saab Combustion Detection Module knock signal input pin\nalso known as Saab Ion Sensing Module;
|
||||
Gpio joystickCenterPin;
|
||||
Gpio joystickAPin;
|
||||
|
||||
Gpio joystickBPin;
|
||||
Gpio joystickCPin;
|
||||
Gpio joystickDPin;
|
||||
uart_device_e consoleUartDevice;
|
||||
|
||||
|
||||
|
|
|
@ -1836,8 +1836,6 @@ menuDialog = main
|
|||
subMenu = engineTypeDialog, "Popular vehicles"
|
||||
subMenu = std_separator
|
||||
|
||||
subMenu = lcdScreen, "LCD" @@if_ts_show_lcd
|
||||
subMenu = joystickPanel, "Joystick" @@if_ts_show_joystick
|
||||
subMenu = spiFunction, "SPI"@@if_ts_show_spi
|
||||
subMenu = monitoringSettings, "rusEFI console"
|
||||
subMenu = std_separator
|
||||
|
@ -2651,13 +2649,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "Input channel", fuelLevelSensor
|
||||
panel = fuelLevelCurve
|
||||
|
||||
dialog = joystickPanel, "Joystick"
|
||||
field = "joustick center button", joystickCenterPin
|
||||
field = "joustick button A", joystickAPin
|
||||
field = "joustick button B", joystickBPin
|
||||
field = "joustick button C", joystickCPin
|
||||
field = "joustick button D", joystickDPin
|
||||
|
||||
;
|
||||
; allXXX sections allows a quick overview of used I/O in order to address conflicts mostly, not really to
|
||||
; configure the features.
|
||||
|
@ -2712,7 +2703,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "Warning Led", warningLedPin
|
||||
field = "tle6240_cs", tle6240_cs
|
||||
field = "tle6240 SPI", tle6240spiDevice
|
||||
panel = joystickPanel
|
||||
|
||||
dialog = allPins1_2
|
||||
field = "Tachometer output", tachOutputPin
|
||||
|
@ -2771,11 +2761,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "Ignition Output 12", ignitionPins12
|
||||
|
||||
dialog = allPins2_3
|
||||
field = "LCD E pin", HD44780_e
|
||||
field = "LCD D4 pin", HD44780_db4
|
||||
field = "LCD D5 pin", HD44780_db5
|
||||
field = "LCD D6 pin", HD44780_db6
|
||||
field = "LCD D7 pin", HD44780_db7
|
||||
field = "Debug Trigger Sync", debugTriggerSync
|
||||
panel = allTriggerDebug
|
||||
panel = allPinsMC33
|
||||
|
@ -3607,17 +3592,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "gps RX", gps_rx_pin
|
||||
field = "gps TX", gps_tx_pin
|
||||
|
||||
dialog = lcdScreen, "LCD screen"
|
||||
field = "display Mode", displayMode
|
||||
field = "height", HD44780height
|
||||
field = "width", HD44780width
|
||||
field = "RS pin", HD44780_rs
|
||||
field = "E pin", HD44780_e
|
||||
field = "D4 pin", HD44780_db4
|
||||
field = "D5 pin", HD44780_db5
|
||||
field = "D6 pin", HD44780_db6
|
||||
field = "D7 pin", HD44780_db7
|
||||
|
||||
dialog = tle8888, "TLE8888", yAxis
|
||||
field = "TLE8888 Chip Select", tle8888_cs @@if_ts_show_spi
|
||||
field = "TLE8888 SPI", tle8888spiDevice @@if_ts_show_spi
|
||||
|
|
|
@ -45,7 +45,6 @@ public class RecentCommands {
|
|||
private static final String CANINFO = "caninfo";
|
||||
private static final String TSINFO = "tsinfo";
|
||||
private static final String SPEEDINFO = "speedinfo";
|
||||
private static final String joystickINFO = "joystickinfo";
|
||||
private static final String FUELINFO = "fuelinfo";
|
||||
private static final String HIPINFO = "hipinfo";
|
||||
private static final String SDINFO = "sdinfo";
|
||||
|
@ -67,7 +66,6 @@ public class RecentCommands {
|
|||
COMMAND_ICONS.put(TSINFO, infoIcon);
|
||||
COMMAND_ICONS.put(TPSINFO, infoIcon);
|
||||
COMMAND_ICONS.put(MAPINFO, infoIcon);
|
||||
COMMAND_ICONS.put(joystickINFO, AutoupdateUtil.loadIcon("joystick.png"));
|
||||
COMMAND_ICONS.put(CANINFO, infoIcon);
|
||||
COMMAND_ICONS.put(FUELINFO, infoIcon);
|
||||
COMMAND_ICONS.put(HIPINFO, AutoupdateUtil.loadIcon("knock.jpg"));
|
||||
|
@ -123,7 +121,6 @@ public class RecentCommands {
|
|||
add(CMD_TRIGGERINFO);
|
||||
add(TSINFO);
|
||||
add(SPEEDINFO);
|
||||
add(joystickINFO);
|
||||
add(CANINFO);
|
||||
add(Fields.CMD_WRITECONFIG);
|
||||
add("rewriteconfig");
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 373 B |
|
@ -40,8 +40,6 @@
|
|||
|
||||
#define EFI_CLOCK_LOCKS FALSE
|
||||
|
||||
#define EFI_LCD FALSE
|
||||
|
||||
#define TS_UART_MODE FALSE
|
||||
|
||||
#define EFI_USB_SERIAL FALSE
|
||||
|
@ -131,7 +129,6 @@
|
|||
#define EFI_STORAGE_EXT_SNOR FALSE
|
||||
#define EFI_RTC FALSE
|
||||
#define EFI_MALFUNCTION_INDICATOR FALSE
|
||||
#define EFI_HD44780_LCD FALSE
|
||||
#define EFI_LOGIC_ANALYZER FALSE
|
||||
#define EFI_PWM_TESTER FALSE
|
||||
#define TRIGGER_EXTREME_LOGGING FALSE
|
||||
|
@ -150,7 +147,6 @@
|
|||
#define EFI_TUNER_STUDIO TRUE
|
||||
|
||||
#define EFI_BOARD_TEST FALSE
|
||||
#define EFI_JOYSTICK FALSE
|
||||
|
||||
#define EFI_LUA TRUE
|
||||
#define LUA_USER_HEAP 100000
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
#define EFI_ANALOG_SENSORS TRUE
|
||||
|
||||
#define EFI_BOARD_TEST FALSE
|
||||
#define EFI_JOYSTICK FALSE
|
||||
|
||||
#define EFI_MAP_AVERAGING TRUE
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "nmea.h"
|
||||
#include "mmc_card.h"
|
||||
#include "lcd_menu_tree.h"
|
||||
#include "fl_stack.h"
|
||||
|
||||
TEST(util, testitoa) {
|
||||
|
@ -434,67 +433,6 @@ TEST(misc, testMisc) {
|
|||
// ASSERT_EQ(SPARKOUT_12_OUTPUT, getPinByName("spa12"));
|
||||
}
|
||||
|
||||
TEST(misc, testMenuTree) {
|
||||
MenuItem ROOT(NULL, NULL);
|
||||
|
||||
MenuTree tree(&ROOT);
|
||||
|
||||
MenuItem miTopLevel1(tree.root, "top level 1");
|
||||
MenuItem miTopLevel2(tree.root, "top level 2");
|
||||
MenuItem miTopLevel3(tree.root, LL_RPM);
|
||||
MenuItem miTopLevel4(tree.root, "top level 4");
|
||||
MenuItem miTopLevel5(tree.root, "top level 5");
|
||||
|
||||
MenuItem miSubMenu1_1(&miTopLevel1, "sub menu 1 1");
|
||||
MenuItem miSubMenu1_2(&miTopLevel1, "sub menu 1 2");
|
||||
|
||||
MenuItem miSubMenu5_1(&miTopLevel5, "sub menu 5 1");
|
||||
MenuItem miSubMenu5_2(&miTopLevel5, "sub menu 5 2");
|
||||
|
||||
ASSERT_EQ(0, miTopLevel1.index);
|
||||
ASSERT_EQ(1, miTopLevel2.index);
|
||||
ASSERT_EQ(4, miTopLevel5.index);
|
||||
|
||||
tree.init(&miTopLevel1, 3);
|
||||
|
||||
tree.nextItem();
|
||||
ASSERT_TRUE(tree.topVisible == &miTopLevel1);
|
||||
ASSERT_TRUE(tree.current == &miTopLevel2);
|
||||
|
||||
tree.back();
|
||||
ASSERT_TRUE(tree.current == &miTopLevel2); // no 'back' since we are on the top level already
|
||||
|
||||
tree.nextItem();
|
||||
ASSERT_TRUE(tree.topVisible == &miTopLevel1);
|
||||
ASSERT_TRUE(tree.current == &miTopLevel3);
|
||||
|
||||
tree.nextItem();
|
||||
ASSERT_TRUE(tree.topVisible == &miTopLevel2);
|
||||
ASSERT_TRUE(tree.current == &miTopLevel4);
|
||||
|
||||
tree.enterSubMenu();
|
||||
ASSERT_TRUE(tree.current == &miTopLevel4) << "still same"; // no children in this one
|
||||
|
||||
tree.nextItem();
|
||||
ASSERT_TRUE(tree.topVisible == &miTopLevel3);
|
||||
ASSERT_TRUE(tree.current == &miTopLevel5) << "tl5";
|
||||
|
||||
tree.nextItem();
|
||||
ASSERT_TRUE(tree.topVisible == &miTopLevel1) << "tl1 t";
|
||||
ASSERT_TRUE(tree.current == &miTopLevel1) << "tl1 c";
|
||||
|
||||
tree.nextItem();
|
||||
tree.nextItem();
|
||||
tree.nextItem();
|
||||
tree.nextItem();
|
||||
|
||||
tree.enterSubMenu();
|
||||
ASSERT_TRUE(tree.current == &miSubMenu5_1);
|
||||
|
||||
tree.back();
|
||||
ASSERT_TRUE(tree.current == &miTopLevel1);
|
||||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return TS_FILE_VERSION;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue