2019-09-21 12:33:13 -07:00
|
|
|
/**
|
|
|
|
* @file init_sensorss.cpp
|
|
|
|
*/
|
|
|
|
|
2021-07-25 22:05:17 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2019-09-21 11:33:38 -07:00
|
|
|
#include "init.h"
|
2020-04-05 06:10:08 -07:00
|
|
|
#include "cli_registry.h"
|
2019-09-21 11:33:38 -07:00
|
|
|
|
2021-04-18 17:02:32 -07:00
|
|
|
static void initSensorCli();
|
2020-02-08 01:22:23 -08:00
|
|
|
|
2021-04-18 17:02:32 -07:00
|
|
|
void initNewSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
2020-03-31 20:21:05 -07:00
|
|
|
#if EFI_CAN_SUPPORT
|
|
|
|
initCanSensors();
|
|
|
|
#endif
|
|
|
|
|
2021-02-03 05:55:40 -08:00
|
|
|
initVbatt(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2020-12-30 05:43:49 -08:00
|
|
|
initMap(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2020-08-31 05:12:33 -07:00
|
|
|
initTps(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
initOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
initThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2020-09-01 13:22:31 -07:00
|
|
|
initLambda(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2021-01-05 04:57:26 -08:00
|
|
|
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-04-27 12:29:22 -07:00
|
|
|
initBaro(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-05-09 16:47:37 -07:00
|
|
|
initAuxSensors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-08-12 12:16:51 -07:00
|
|
|
initVehicleSpeedSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2019-09-21 11:33:38 -07:00
|
|
|
|
2021-03-19 05:39:08 -07:00
|
|
|
#if !EFI_UNIT_TEST
|
|
|
|
initFuelLevel(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-05-09 17:59:06 -07:00
|
|
|
initMaf(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-03-19 05:39:08 -07:00
|
|
|
#endif
|
|
|
|
|
2019-09-21 11:33:38 -07:00
|
|
|
// Init CLI functionality for sensors (mocking)
|
2021-04-18 17:02:32 -07:00
|
|
|
initSensorCli();
|
2019-09-21 11:33:38 -07:00
|
|
|
}
|
|
|
|
|
2020-04-05 06:10:08 -07:00
|
|
|
void reconfigureSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
2021-08-20 23:02:05 -07:00
|
|
|
deInitFlexSensor();
|
2021-02-03 05:55:40 -08:00
|
|
|
reconfigureVbatt(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2020-08-31 05:12:33 -07:00
|
|
|
reconfigureTps(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
reconfigureOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
reconfigureThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2021-08-20 23:02:05 -07:00
|
|
|
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2020-02-08 01:22:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mocking/testing helpers
|
2021-04-18 17:02:32 -07:00
|
|
|
static void initSensorCli() {
|
2019-09-21 11:33:38 -07:00
|
|
|
addConsoleActionIF("set_sensor_mock", Sensor::setMockValue);
|
|
|
|
addConsoleAction("reset_sensor_mocks", Sensor::resetAllMocks);
|
2021-04-18 17:02:32 -07:00
|
|
|
addConsoleAction("show_sensors", Sensor::showAllSensorInfo);
|
|
|
|
addConsoleActionI("show_sensor",
|
2020-03-30 15:29:42 -07:00
|
|
|
[](int idx) {
|
2021-04-18 17:02:32 -07:00
|
|
|
Sensor::showInfo(static_cast<SensorType>(idx));
|
2020-03-30 15:29:42 -07:00
|
|
|
});
|
2019-09-21 11:33:38 -07:00
|
|
|
}
|