Commit Graph

66 Commits

Author SHA1 Message Date
Matthew Kennedy 923d2c2e44
unexpected contains information about why it failed (#4393)
* unexpected can contain information

* info printing

* sensors return appropriate error codes

* remove reliance on undefined behavior

* s
2022-07-28 10:04:28 +03:00
Matthew Kennedy 41318e0f9d
detect bad Lua sensor name when registering (#4391)
* format

* lua error on bad sensor

* comment

* name validation

* soft check before the hard check causes a fatal error

* s
2022-07-27 12:41:21 +03:00
Matthew Kennedy e4a0979dc2
Brain pin is enum class (#4108)
* change most usages to Gpio::

* board configs

* engine configs etc

* isBrainPinValid, smart gpio

* generator

* generator

* generator

* connector yamls

* kinetis enums

* cypress txt

* kinetis config

* frankenso

* config generator

* actually do it for the others

* disable skips for pr ci

* fix tle8888

* misc

* weird cast from int

* needs this operator too

* this can be an unsigned subtract

* happy tests

* s

* kinetis isConfigurationChanged weirdness

* missed J/K

* cypress efifeatures

* build script mistake (!)

* mistake in smart gpio

* debounce

* eg33

* kinetis, so needy

* it's pretty green, we can skip these again
2022-04-28 17:32:39 -04:00
Matthew Kennedy c3fb211d6b
fix vss/iss filter parameter validation (#4114)
* fix filter parameter validation

* use values that don't get clipped
2022-04-27 22:29:51 -04:00
Matthew Kennedy baef88d1c7
make the vss fliter parameter work again (#4056)
* vss has adjustable filter

* tooltip and validate

* s
2022-04-09 09:00:19 -04:00
Matthew Kennedy d65652d7bc
vss and flex are filtered (#3839)
* vss and flex are filtered

* turbo

* freq sensor test
2022-01-26 17:33:04 -05:00
Andrey 19a8685644 refactoring 2021-12-24 16:51:31 -05:00
Matthew Kennedy d5363b814a
better VSS configuration (#3542)
* vss uses real values

* some defaults

* test and correct math

* km, not miles!

* comment

* tooltip

* that macro went away

* 100hz and default settings gives 9kph

* changelog

* order of operations safety

* make the test like the pwm test

* housekeeping

* this is why we need sensor automation

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-27 08:49:07 -05:00
Scott Smith 823d9a07e0
Programmatically replace ENGINE() and CONFIG() with engine-> etc (#3565)
git grep -l -w ENGINE | xargs sed -i -r "s/ENGINE\(([]a-zA-Z_0-9.[]+)\)/engine->\1/g"

git grep -l -w CONFIG | xargs sed -i -r "s/([^a-zA-Z_])CONFIG\(([]a-zA-Z_0-9.[]+)\)/\1engineConfiguration->\2/g"
2021-11-17 03:54:21 -05:00
Scott Smith cc95bd6c8e
Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER* (#3560)
* Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER*

for i in ": public EnginePtr " ", public EnginePtr" "EXPAND_Engine;" "EXPAND_Engine"; do
    git grep -l "$i" | xargs sed -i "s/$i//g"
done

git grep -l "inject" | xargs sed -i "/inject[(][)]/d"

for i in WITH_ENGINE_TEST_HELPER_SENS WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK WITH_ENGINE_TEST_HELPER; do
    git grep -l "$i" | xargs sed -i "s/$i/EngineTestHelper eth/g"
done

git checkout firmware/controllers/core/engine_ptr.h
git checkout unit_tests/global.h

* Review fixups.
2021-11-16 16:52:11 -05:00
Matthew Kennedy 8cdac4cac0
remove engine pointer passing (#3556)
* some

* more

* more

* the last?!
2021-11-16 04:15:29 -05:00
Scott Smith 344c9073e2
Start the process of using a global engine ptr for unit tests. (#3551)
* Start the process of using a global engine ptr for unit tests.

Passing around the engine, config, and persistent state wasn't buying anything.  Instead, use
EngineTestHelper(Base) to correctly set and clear the global variables.  Add a dummy check in
case some test tries to set them manually.

* Fix OSX build

* Adapt PR to recently added code.
2021-11-16 00:23:14 -05:00
Scott Smith 7011be6f86
Test for stack use after free in ASAN. (#3552)
Fix two cases that didn't affect the product, but did affect our ability to test.
2021-11-15 19:44:39 -05:00
Matthew Kennedy 145316c497
less macro, more c++ (#3549)
* less macro

* s
2021-11-15 12:44:40 +01:00
Matthew Kennedy 24224729a3
support autoscale on table axes (#3452)
* scale map Y axis

* allow different row/col types

* scaled channel detector

* interpolation

* looks like this actually works

* tests, no manual scaling

* comment
2021-11-03 19:53:26 -04:00
Matthew Kennedy 29ec0a5859
better pch usage and gmock constructors (#3426)
* break out mock constructors

* comment and spacing

* unnecessary compiler options

* happy stepper

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-30 20:31:09 -04:00
Andrey 37594d5646 findSensorTypeByName 2021-10-20 22:21:42 -04:00
Matthew Kennedy 9797d25b7c
getOrZero (#3319) 2021-10-05 19:59:07 -04:00
Matthew Kennedy db12cdbe19
put MAP in the sensor model (#3292)
* map averaging in sensor model

* deadly, deadly code!

* mpxh

* Revert "deadly, deadly code!"

This reverts commit 346fe25267966a313145a809792dced84be348cf.

* comments

* sensor types

* last sensor

* channel init

* correct spot

* deinit properly

* simplify

* fix

* mocks

* map init test

* showInfo

* comment

* singleton identity function

* sensor info print

* multiple cylinder averaging buffer

* comments

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-04 17:18:08 -04:00
Matthew Kennedy b5bde5c307
Turbo sensor (#3245)
* outputs rpm

* no msg param necessary

* new sensor type

* happy test
2021-09-20 15:39:41 -04:00
alxrMironov bb341c4c07
Turbo speed sensor implementation #2935 (#3209)
* Add turbocharger speed converter class

* Add turbocharger speed converter tests

* Add turbocharger speed sensor initialization functions

* Add turbocharger speed sensor to initialization

Co-authored-by: alxrMironov <330OMcorporative>
Co-authored-by: rusefillc <48498823+rusefillc@users.noreply.github.com>
2021-09-19 20:50:11 -04:00
Matthew Kennedy a18b86a09b
start allowing ADC change while running (#3100)
* allow re-register of the same sensor

* add api to unsubscribe

* do it for tps

* clear the pin

* happy test

* maybe make afr happy for now

* tests build

* happy simulator

* active configuration

* check valid

* we need vbatt now

* manage all pin init in init_sensors.cpp

* don't need that

* cleanup

* thermistors

* do two phase reinit in the right place

* config vs engine

* finally the tests are happy
2021-08-24 16:41:16 -04:00
alxrMironov f926d2ccba
Vehicle speed switching to frequency sensor #3106 (#3148)
* Add vehicle_speed_converter.h with realization.

* Add test_vehicle_speed_converter.cpp with realization.

* Add test_vehicle_speed_converter.cpp to Makefile

* Edit "VehicleSpeedSensor" from function pointer sensor to frequency sensor

* Fix "VehicleSpeedSensor" init function args

* Remove "VehicleSpeedConverter" empty constructor

* Edit vehicle_speed_converter.h code style

* Fix args and engine injection in "VehicleSpeedSensor" initialization procedure

* Remove old "Vehicle Speed" module initialization

* Revert "Remove old "Vehicle Speed" module initialization"

This reverts commit 100b7caa8c615c20eed3d0c23a49824b4e556148.

* Remove old "Vehicle Speed" module initialization pieces

* Revert "Revert "Remove old "Vehicle Speed" module initialization""

This reverts commit f559a726f1f7f5a7acacd1b6517e571743e84327.

* Debug changes

* Revert "Debug changes"

This reverts commit f7e2be1a8a46c6f3f93f14f002b2f2db539da8e2.

* Another debug changes

* More debug changes

* And more debug changes.

* Revert "Another debug changes"

This reverts commit 914fbb1df42c37e4b5ecbb119bb45e7cffdf4064.

* Revert "More debug changes"

This reverts commit 0b2d96d461c3cd9b0f1ae97ed110b8effe6b0cc6.

* Revert "And more debug changes."

This reverts commit 06ae8daded0e6e1c025e4e5058b47283f4adfe92.

* Add "Vehicle Speed" sensor reconfiguration

* Revert "Add "Vehicle Speed" sensor reconfiguration"

This reverts commit a089a6d563dd710004ce1a7da1744b0b4b90c3b1.

* Revert "Revert "Add "Vehicle Speed" sensor reconfiguration""

This reverts commit 7b2bb8af4b3caa547236ca59e4c4bdb3ac1200cc.

* Debug changes

* Another debug changes

* Fix another debug changes

* Another debug changes 2

* Revert "Another debug changes 2"

This reverts commit cfad55141eec125b2f1d35fb95d9f46b54f666b6.

* Revert "Fix another debug changes"

This reverts commit 9bc2c74a3be6fd896827ff48cf4580e7657529c0.

* Revert "Another debug changes"

This reverts commit 4337ed8cad8dff508d093944eb3f75e9a69e4a77.

* Edit class  FrequencySensor, make it more RAII

* Debug changes

* Debug changes 2

* Debug changes 3

* Revert "Debug changes 3"

This reverts commit 52a7054c122b5157540fe45a055a84b57478d722.

* Revert "Debug changes 2"

This reverts commit dec79fb913344ccb4b8614910ad62e6c129a243e.

* Revert "Debug changes"

This reverts commit eb08d7a529b55ba397a7dd2c154b76eab42f212b.

* Revert "Edit class  FrequencySensor, make it more RAII"

This reverts commit 3a0bb1d3f1dd23c1b04e4cc1c526cfdc67ae86a3.

* Remove VSS pin definition in "Citroen Berlingo" engine config.

This reverts commit 3a0bb1d3f1dd23c1b04e4cc1c526cfdc67ae86a3.

* Remove VSS pin definition in "Dodge Neon" engine config

Co-authored-by: alxrMironov <330OMcorporative>
2021-08-24 00:55:41 -04:00
Matthew Kennedy 25414ebdad
yet more pch (#3068)
* big pch energy

* put back ramdisk stub

* tests are happy

* h743 nucleo

* kinetis

* I love deleting code!

* make stepper happy

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-08-03 22:05:01 -04:00
Matthew Kennedy fcd6c3d520
fix the mess (#3094)
* test

* s
2021-08-01 23:21:53 -04:00
alxrMironov 6f96887d74
Unit test for flex sensor.cpp #3091 (#3093)
* Add test_flex_sensor.cpp

* Add test_flex_sensor.cpp to makefile

* Edit test_flex_sensor.cpp code formatting

* Fix test case name in test_flex_sensor.cpp

* Remove explicitly defined constructor of "FlexSensorForTests" class

* Edit included headers replaced by single one in test_flex_sensor.cpp

* Edit format to make similar to other files.

Co-authored-by: alxrMironov <330OMcorporative>
2021-08-01 22:14:01 -04:00
Matthew Kennedy b52d50bbf2
Use pch in lots of files (#3066)
* most engine.h

* most engine_configuration

* more

* more

* more

* more

* more

* moooooore

* ok I'm done for now

* oops
2021-07-26 01:05:17 -04:00
Matthew Kennedy 9b0c7ff693
explicitly test PTC thermistors (#2681)
* test ptc

* allow hotter for air cooled people

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-05-10 18:15:09 -04:00
Matthew Kennedy 8b30776016
remove stateChangeCallback from simplepwm (#2644)
* remove callback parameter from cj125

* remove from ext

* remove stateChangeCallback

* alt doesn't need that

* demorgan

* remove call

* bad cut/paste

* check the actual pin in the test
2021-05-07 09:38:41 -04:00
Matthew Kennedy 5145ee4b62
logging cleanup 2: sensors, pid, etb, etc (#2567)
* ts logger

* sensors

* wideband too

* missed one

* init

* motors, pid, etc

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-18 20:02:32 -04:00
Matthew Kennedy 46e38447e5
Ford redundant ETB tps (#2519)
* ford tps

* configurable maximum

* initialization

* check consistency when in the low range

* print info

* default

* config field

* config parameter

* test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-05 15:57:03 -04:00
Matthew Kennedy 95b08c433f
Implement nonlinear fuel level sender (#2473)
* table function

* config fields

* sensor type

* switch consumers

* init the sensor

* ui

* 1mv resolution

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-19 08:39:08 -04:00
Matthew Kennedy 2328c1be6b
Fuel pressure sensor checks (#2449)
* test for missing sensor

* test negative pressure delta checking logic

* test new hasSensor logic
2021-03-12 23:32:41 -05:00
rusefi a86481f3ba refactoring: more structure 2021-02-08 15:59:40 -05:00
Matthew Kennedy acdf6fdc85
Put map in the sensor model (#2161)
* hook up map

* check for init

* switch some consumers

* don't do limp for now

* oops

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-30 08:43:49 -05:00
Matthew Kennedy a08e79789d
second lambda (x-series CAN only, for now) (#2048)
* add sensor

* second sensor

* switch sensor name

* gobblin up your memory

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-09 20:26:23 -05:00
Matthew Kennedy 67269aa637
maybe fix sensor init checks (#2034)
* enums

* don't collide

* auto_generated_enums

* check based on new enum val

* maybe this will make generate tool happy

* add a test

* fix test

* fix and add another test

* make clang happier

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 23:19:57 -05:00
rusefillc b3d45b909f Revert "switch rpm calculator to use timer class (#2005)"
This reverts most of a26ed3eb5a commit.
2020-12-06 18:05:53 -05:00
Matthew Kennedy a26ed3eb5a
switch rpm calculator to use timer class (#2005)
* add api

* rpm calculator

* fix fsio

* fix float

* remove wrong comment

* fix timer

* clang didn't like this

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 16:01:45 -05:00
Matthew Kennedy c5e3657d45
don't duplicate sensor error logic (#2032)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 15:00:30 -05:00
Matthew Kennedy 9ccda6bbe7
add isRedundant (#2031)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 14:55:06 -05:00
rusefillc 29141055ab one step back #2017 2020-12-06 08:50:10 -05:00
Matthew Kennedy 2d9be1077b
require TPS values to be different (#2017)
* require values to be different

* fix not

* oops

* missed another spot

* test negative cases too

* resets

* test no sensor case

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 00:41:49 -05:00
Matthew Kennedy 5fec6d0c04
move lambda in to sensor model (#1736)
* lambda sens

* fix init

* fix

* a test for good measure

* he's climbin in your windows, snatchin you ram up

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-09-01 16:22:31 -04:00
rusefi efdaef81af this does not go as planned :( 2020-08-31 08:02:29 -04:00
rusefi 24cf51e883 this does not go as planned :( 2020-08-31 07:54:45 -04:00
Matthew Kennedy d6464fffe7
fix (#1620) 2020-07-19 18:05:31 -04:00
Matthew Kennedy 0290a268ab
Redundant accelerator pedal (#1470)
* add second boudns

* init logic

* test changes

* reconfigure correctly

* rams
2020-05-23 19:48:32 -04:00
Matthew Kennedy 9dda1a21bc
Redundant tps (#1427)
* add redundant sensor

* add tests

* add configure, info printing

* tests

* tests

* partial hookup

* fix

* fix

* bad makefile merge

* use second TPS config

* update test

* update test

* sensor names

* set second pin by default

* fix auto cal

* auto cal both sensors

* add reconfigure of secondary sensors

* gobblin' up your ram

* slow down write a little bit

* put split in debug gauge

* s

Co-authored-by: Matthew Kennedy <matthew@mck-mbp-15.local>
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-05-18 14:32:00 -04:00
Matthew Kennedy 0d699bcfe9
Improve unexpected (#1323)
* use type instead of value

* fix remaining initializer-list users

* impruv

* last consumer?

* consumer

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-19 08:37:43 -04:00