remove old vss implementation (#3208)

* dead vss

* remove
This commit is contained in:
Matthew Kennedy 2021-08-27 22:39:55 -07:00 committed by GitHub
parent 55a6a9cf9d
commit 730b26d034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 2 additions and 263 deletions

View File

@ -65,7 +65,6 @@ extern bool main_loop_started;
#include "pin_repository.h"
#include "flash_main.h"
#include "max31855.h"
#include "vehicle_speed.h"
#include "single_timer_executor.h"
#include "periodic_task.h"
extern int icuRisingCallbackCounter;

View File

@ -34,7 +34,6 @@
#include "idle_hardware.h"
#include "periodic_task.h"
#include "vehicle_speed.h"
#include "dc_motors.h"
#if EFI_TUNER_STUDIO

View File

@ -9,9 +9,8 @@
#if EFI_DYNO_VIEW
#include "dynoview.h"
#include "vehicle_speed.h"
DynoView dynoInstance;
static DynoView dynoInstance;
void DynoView::update(vssSrc src) {

View File

@ -106,12 +106,6 @@ public:
GearControllerBase *gearController;
float mockVehicleSpeed = DEFAULT_MOCK_SPEED; // in kilometers per hour
efitick_t vssLastSignalTimeNt = 0;
efitick_t vssDiff = 0;
efitick_t mostRecentSparkEvent;
efitick_t mostRecentTimeBetweenSparkEvents;
efitick_t mostRecentIgnitionEvent;

View File

@ -9,7 +9,6 @@
#if EFI_LAUNCH_CONTROL
#include "boost_control.h"
#include "vehicle_speed.h"
#include "launch_control.h"
#include "periodic_task.h"
#include "advance_map.h"
@ -18,7 +17,7 @@
static bool isInit = false;
LaunchControlBase launchInstance;
static LaunchControlBase launchInstance;
static int retardThresholdRpm;

View File

@ -13,7 +13,6 @@
#include "can_dash.h"
#include "can_msg_tx.h"
#include "vehicle_speed.h"
#include "rtc_helper.h"
#include "fuel_math.h"
// CAN Bus ID for broadcast

View File

@ -14,7 +14,6 @@
#include "can.h"
#include "fuel_math.h"
#include "spark_logic.h"
#include "vehicle_speed.h"
struct Status {
uint16_t warningCounter;

View File

@ -11,7 +11,6 @@
#if EFI_CAN_SUPPORT
#include "can.h"
#include "vehicle_speed.h"
#include "dynoview.h"
static bool isInit = false;

View File

@ -28,7 +28,6 @@
#include "obd2.h"
#include "can.h"
#include "can_msg_tx.h"
#include "vehicle_speed.h"
#include "fuel_math.h"
static const int16_t supportedPids0120[] = {

View File

@ -14,8 +14,6 @@
#include "serial_hw.h"
#include "serial_sensor.h"
#include "vehicle_speed.h"
uint8_t ser_buffer[SERBUFFLEN] = {};
size_t innovate_msg_len = 1;
innovate_serial_id_state_t innovate_serial_id_state = UNKNOWN;

View File

@ -18,7 +18,6 @@
#include "trigger_emulator_algo.h"
#if EFI_PROD_CODE
#include "vehicle_speed.h"
#include "rtc_helper.h"
#include "can_hw.h"
#include "rusefi.h"
@ -1051,10 +1050,6 @@ const command_f_s commandsF[] = {
{"fsio_curve_1_value", setFsioCurve1Value},
{"fsio_curve_2_value", setFsioCurve2Value},
#if EFI_PROD_CODE
#if EFI_VEHICLE_SPEED
//todo: This function become deprecated soon
{"mock_vehicle_speed", setMockVehicleSpeed},
#endif /* EFI_VEHICLE_SPEED */
#if EFI_IDLE_CONTROL
{"idle_offset", setIdleOffset},
{"idle_p", setIdlePFactor},

View File

@ -16,7 +16,6 @@
#include "rtc_helper.h"
#include "os_util.h"
#include "bench_test.h"
#include "vehicle_speed.h"
#include "yaw_rate_sensor.h"
#include "pin_repository.h"
#include "max31855.h"
@ -399,10 +398,6 @@ void applyNewHardwareSettings(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
#endif
/* #if EFI_VEHICLE_SPEED && ! EFI_UNIT_TEST
startVSSPins();
#endif EFI_VEHICLE_SPEED */
#if EFI_BOOST_CONTROL
startBoostPin();
#endif
@ -483,10 +478,6 @@ void stopHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
stopSmartCsPins();
#endif /* (BOARD_EXT_GPIOCHIPS > 0) */
/* #if EFI_VEHICLE_SPEED
stopVSSPins();
#endif EFI_VEHICLE_SPEED */
#if EFI_LOGIC_ANALYZER
stopLogicAnalyzerPins();
#endif /* EFI_LOGIC_ANALYZER */
@ -605,10 +596,6 @@ void initHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
initAuxSerial();
#endif /* EFI_AUX_SERIAL */
/*#if EFI_VEHICLE_SPEED
initVehicleSpeed();
#endif // EFI_VEHICLE_SPEED*/
#if EFI_CAN_SUPPORT
initCanVssSupport();
#endif // EFI_CAN_SUPPORT

View File

@ -29,7 +29,6 @@ HW_LAYER_EMS_CPP = \
$(PROJECT_DIR)/hw_layer/sensors/hip9011.cpp \
$(PROJECT_DIR)/hw_layer/sensors/hip9011_logic.cpp \
$(PROJECT_DIR)/hw_layer/mc33816.cpp \
$(PROJECT_DIR)/hw_layer/vehicle_speed.cpp \
$(PROJECT_DIR)/hw_layer/stepper.cpp \
$(PROJECT_DIR)/hw_layer/stepper_dual_hbridge.cpp \
$(PROJECT_DIR)/hw_layer/servo.cpp \

View File

@ -1,135 +0,0 @@
/**
* @file vehicle_speed.cpp
*
* @date Dec 26, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
#include "vehicle_speed.h"
#include "pch.h"
#if EFI_VEHICLE_SPEED
#include "digital_input_icu.h"
#include "digital_input_exti.h"
#include "can_vss.h"
/**
* @return vehicle speed, in kilometers per hour
*/
float getVehicleSpeed(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engine->mockVehicleSpeed != DEFAULT_MOCK_SPEED)
return engine->mockVehicleSpeed;
#if EFI_CAN_SUPPORT
if (CONFIG(enableCanVss)) {
return getVehicleCanSpeed();
}
#endif /* EFI_CAN_SUPPORT */
if (!hasVehicleSpeedSensor(PASS_ENGINE_PARAMETER_SIGNATURE))
return 0;
efitick_t nowNt = getTimeNowNt();
if (nowNt - engine->vssLastSignalTimeNt > NT_PER_SECOND)
return 0; // previous signal time is too long ago - we are stopped
return engineConfiguration->vehicleSpeedCoef * NT_PER_SECOND / engine->vssDiff;
}
// todo: make this method public and invoke this method from test
void vsCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engine->engineState.vssEventCounter++;
efitick_t nowNt = getTimeNowNt();
engine->vssDiff = nowNt - engine->vssLastSignalTimeNt;
engine->vssLastSignalTimeNt = nowNt;
}
#if ! EFI_UNIT_TEST
static void vsAnaWidthCallback() {
vsCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
}
static void speedInfo(void) {
efiPrintf("VSS input at %s",
hwPortname(CONFIG(vehicleSpeedSensorInputPin)));
efiPrintf("c=%.2f eventCounter=%d speed=%.2f",
engineConfiguration->vehicleSpeedCoef,
engine->engineState.vssEventCounter,
getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE));
efiPrintf("vss diff %d", engine->vssDiff);
}
#endif // EFI_UNIT_TEST
bool hasVehicleSpeedSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return (isBrainPinValid(CONFIG(vehicleSpeedSensorInputPin)));
}
#if HAL_VSS_USE_PAL
static void vsExtiCallback(void *) {
vsAnaWidthCallback();
}
#endif /* HAL_VSS_USE_PAL */
void stopVSSPins(void) {
#if HAL_VSS_USE_PAL
efiExtiDisablePin(activeConfiguration.vehicleSpeedSensorInputPin);
#elif HAL_USE_ICU
stopDigitalCapture("VSS", activeConfiguration.vehicleSpeedSensorInputPin);
#endif /* HAL_VSS_USE_PAL, HAL_USE_ICU */
}
#if ! EFI_UNIT_TEST
void startVSSPins(void) {
if (!hasVehicleSpeedSensor()) {
return;
}
// todo: refactor https://github.com/rusefi/rusefi/issues/2123
#if HAL_VSS_USE_PAL
efiExtiEnablePin("VSS", CONFIG(vehicleSpeedSensorInputPin), PAL_EVENT_MODE_BOTH_EDGES, vsExtiCallback, nullptr);
#elif HAL_USE_ICU
digital_input_s* vehicleSpeedInput = startDigitalCapture("VSS", CONFIG(vehicleSpeedSensorInputPin));
if (vehicleSpeedInput) {
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, nullptr);
}
#else
#error "HAL_USE_ICU or HAL_VSS_USE_PAL should be enabled to use EFI_VEHICLE_SPEED"
#endif /* HAL_VSS_USE_PAL, HAL_USE_ICU */
}
#endif
void initVehicleSpeed() {
#if ! EFI_UNIT_TEST
addConsoleAction("speedinfo", speedInfo);
startVSSPins();
#endif // EFI_UNIT_TEST
}
#else /* EFI_VEHICLE_SPEED */
#if EFI_UNIT_TEST
float getVehicleSpeed(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// Mock return to be used in unit tests
return mockVehicleSpeed;
}
#else
float getVehicleSpeed(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// no VSS support
return 0;
}
#endif /* EFI_UNIT_TEST */
#endif /* EFI_VEHICLE_SPEED */
void setMockVehicleSpeed(float speedKPH DECLARE_ENGINE_PARAMETER_SUFFIX) {
engine->mockVehicleSpeed = speedKPH;
}

View File

@ -1,20 +0,0 @@
/**
* @file vehicle_speed.h
*
*@date Dec 26, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "global.h"
/**
* @return vehicle speed, in kilometers per hour
*/
float getVehicleSpeed(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void initVehicleSpeed();
void setMockVehicleSpeed(float speedKPH DECLARE_ENGINE_PARAMETER_SUFFIX);
bool hasVehicleSpeedSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void stopVSSPins(void);
void startVSSPins(void);

View File

@ -1,7 +1,6 @@
#include "pch.h"
#include "init.h"
#include "vehicle_speed.h"
#include "frequency_sensor.h"
#include "vehicle_speed_converter.h"

View File

@ -1,7 +1,6 @@
#include "pch.h"
#include "dynoview.h"
#include "vehicle_speed.h"
void printResults(DynoView *dut) {
#ifdef DBG_TESTS

View File

@ -1,7 +1,6 @@
#include "pch.h"
#include "launch_control.h"
#include "vehicle_speed.h"
TEST(LaunchControl, TpsCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);

View File

@ -1,67 +0,0 @@
#include "pch.h"
#include "vehicle_speed.h"
extern void vsCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
typedef void(*vss_callback_fp)(DECLARE_ENGINE_PARAMETER_SIGNATURE) ;
static constexpr brain_pin_e anyPin = GPIOA_0;
static constexpr const char* const vehicleSpeedSensorMessage = "VSS";
/*
* Used to convert expected speed into simulation frequency
*/
static float speedToSimulationFrequency(float speedCoef, float speed) {
return speed/speedCoef;
}
/*
* Use engine test helper as time source,
* to simulate periodic signal on input pin with passed callback.
*/
static void simulatePeriodicSignalForCallback(
EngineTestHelper& eth,
float freqHz,
vss_callback_fp cb
DECLARE_ENGINE_PARAMETER_SUFFIX)
{
constexpr auto periods = 50;
auto period = (1 / freqHz);
for (auto i = 0; i < periods; i++) {
cb(PASS_ENGINE_PARAMETER_SIGNATURE);
// Time rewind after the callback, due internal vehicle_speed.cpp logic
// (last signal time check for stop tracking)
eth.moveTimeForwardSec(period);
}
}
TEST(VehicleSpeedSensor, testValidSpeedDetection) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
engineConfiguration->vehicleSpeedCoef = 0.5f;
// Valid speed 15kmh should be returned
float freq = speedToSimulationFrequency(engineConfiguration->vehicleSpeedCoef, 15.0f);
simulatePeriodicSignalForCallback(eth, freq, vsCallback PASS_ENGINE_PARAMETER_SUFFIX);
float measuredSpeed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
EXPECT_NEAR(15.0f, measuredSpeed, 0.01);
}
TEST(VehicleSpeedSensor, testInvalidSpeed) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
engineConfiguration->vehicleSpeedCoef = 0.5f;
// Invalid (slow) interval, should return 0 speed
simulatePeriodicSignalForCallback(eth, 0.5f, vsCallback PASS_ENGINE_PARAMETER_SUFFIX);
float measuredSpeed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
// Direct comparasion as invalid speed shoud return true zero
EXPECT_EQ(0.0f, measuredSpeed);
}

View File

@ -86,7 +86,6 @@ TESTS_SRC_CPP = \
tests/trigger/test_all_triggers.cpp \
tests/test_stepper.cpp \
tests/sensor/test_frequency_sensor.cpp \
tests/sensor/test_vehicle_speed.cpp \
tests/sensor/test_vehicle_speed_converter.cpp