Commit Graph

479 Commits

Author SHA1 Message Date
Matthew Kennedy e6a6548b2a implement adc unsubscription (#3149)
* allow re-register of the same sensor

* adc unsub
2021-08-14 15:41:27 +03:00
alxrMironov 9d1ce540c4 Begin "vehicleSpeed" refactoring. Module switched to "FunctionalPointerSensor" class. #3106 #3107 #3108. (#3132)
* Add new sensor type "VehicleSpeed"

* Add "Vehicle speed" sensor to name list

* Add Vehicle speed sensor initialization with function pointer sensor.

* Add init_vehicle_speed_sensor.cpp to Makefile

* Replace dependencies from "getVehicleSpeed" to OOP-like "Sensor::get()"

* Add warning and TODO to "mock vehicle speed" call

* Replace get & mock "VehicleSpeed" methods in tests

* Remove #warning directive (cause error by current settings)

* Remove stray tab

* Remove explicitly type casting.

* Add "InitVehicleSpeedSensor" function declaration to init.h

* Add "VehicleSpeedSensor" initialization call into "InitNewSensors"

Co-authored-by: alxrMironov <330OMcorporative>
2021-08-12 22:16:51 +03:00
rusefillc 06060dc43b Implement auto knock threshold sampling #3033 2021-08-10 06:42:39 -04:00
rusefillc 831c989cd0 Implement auto knock threshold sampling #3033 2021-08-09 17:07:38 -04:00
rusefillc 2962b47787 refactoring: reduce magic constant 2021-08-09 16:33:06 -04:00
Matthew Kennedy 39388c75d8 even more pch (#3112)
* s

* more

* s

* f7
2021-08-04 19:30:52 -04:00
Matthew Kennedy 4e6b61234f 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 4ea56e4122 fix the mess (#3094)
* test

* s
2021-08-01 23:21:53 -04:00
rusefillc c5d71c10ab header dreaming about file summary comment 2021-08-01 21:52:58 -04:00
rusefillc 5b940e2eca typo 2021-08-01 21:51:24 -04:00
Matthew Kennedy 263fd20dcb refactor out frequency sensor (#3092)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-08-01 15:58:39 -04:00
Matthew Kennedy 8ebb7b8f24 discrete VR threshold control (#3061)
* vr pwm

* rename

* scaling and ui

* hellen pin

* s

* math

* ooh, pch

* happy test

* not magic
2021-07-28 07:44:44 -04:00
Matthew Kennedy d3ec2b21d1 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 e3849b95d5 don't require EXTERN_ENGINE in every file (#2969)
* move enginePins

* no more extern engine

* uses

* more

* extern config too

* put this where it belongs

* include correct header

* merge
2021-07-16 18:13:33 -04:00
Matthew Kennedy 0a40ccd619 put names in flash (#2939)
* put names in flash

* probing freed ram

* this one too

* probing memory

* more like that much
2021-07-09 17:05:16 -04:00
Matthew Kennedy ba331f4895 knock sensing peak detect (#2910)
* knock peak detect

* comments

* comment

* initialize

* test

* fix warnings while we're here

* those are functions, not values

* ram
2021-07-06 21:44:59 -04:00
Andrey 1d4be8ee95 forgotten MPX4100 sensor 2021-06-13 20:30:51 -04:00
Andrey a0d835ed1c refactoring magic constant STOICH_RATIO 2021-05-20 02:39:20 -04:00
Matthew Kennedy 9307ab6b1e 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 76f2f063d2 Maf in sensor model (#2672)
* init

* consumers

* hasMafSensor

* consumers

* remove

* remove

* s

* guard

* tiny bit of ram

* ram
2021-05-09 20:59:06 -04:00
Matthew Kennedy 3dd6b2efc9 move FSIO aux analog inputs to sensor model (#2669)
* sensor entries

* init

* non-explicit for list init to work

* switch fsio

* no longer need this lua hook

* init
2021-05-09 19:47:37 -04:00
Matthew Kennedy 54fca52e42 sensor_type values (#2604)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-29 07:43:46 -04:00
Matthew Kennedy 1bd789a5a5 make wideband log fields match what it's actually sending (#2593)
* make log fields match what it's actually sending

* update wb firmware

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-28 18:28:29 -04:00
Matthew Kennedy 8cfb63455d Logging remove 3 (#2568)
* ts logger

* sensors

* wideband too

* missed one

* init

* motors, pid, etc

* vvt

* more

* idle

* missed one

* dynoview

* launch

* can

* console IO

* s

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-20 14:09:41 -04:00
Matthew Kennedy 992c16b4af 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 7782ebd7b4 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
Andrey G a0053d5845 hip9011 and friends (#2527)
* engine math: extrant getFiringOrderTable for reuse

* engine math: getNextFiringCylinderId helper

* introduce knock_logic: first member is getCylinderKnockBank()

moved from software_knock.cpp

* hip9011: support two inputs/banks

* fix CI

* Board Subaru EG33: populated with TPIC8101 with Advanced mode

* hip9011: test communication in advanced mode

* hip9011: handle situation when chip is already in advanced mode

* Board Subaru EG33: cylinder to knock bank mapping

* hip9011: count spi transactions in advansed mode too

* hip9011: reset incalid responce counter after chip initialization

* hip9011: make debug output more structured
2021-04-04 18:13:21 -04:00
Matthew Kennedy 8aed80c332 not all listeners are sensors (#2514)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-31 22:51:49 -04:00
Andrey G 112b4d1182 Hip9011 (#2512)
* hip9011: coexistance with other spi devices

* hip9011: rework so SPI transfer is invoked from thread

also use polling spi exchange to avoid cache problems

* hip9011: move calculations from ADC callback to thread

* hip9011: big cleanup

* hip9011: simplify spi communication

* No need to set knockBandCustom if it is not custom

HIP9011 calculates knockBand from cylinderBore same way

* hip9011: make unit test happy

* hip9011: fix unit test

* hip9011: remove duplicated initialization, reorder

* hip9011: just renames and data type adjustments

* hip9011: rename BAND() to HIP9011_BAND()

* hip9011: move some code from lookup.cpp to logic.cpp

* hip9011: move initEngineNoiseTable to engine_configuration.cpp

* hip9011: move lookup tables to hip9011_logic.c

* hip9011: remove empty files

* hip9011: additional checks
2021-03-30 10:56:25 -04:00
Matthew Kennedy 2839c6f069 use cpp (#2493) 2021-03-25 18:12:17 -04:00
Matthew Kennedy 5e6746c3aa 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 c168c748ea dead code, warnings (#2461) 2021-03-15 10:23:19 -04:00
Matthew Kennedy 765895d913 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
rusefillc 416c65b475 vBatt -> SensorType::vBatt #2260 2021-03-11 22:44:59 -05:00
Matthew Kennedy dafd28d751 enable CAN on H7 (#2393)
* enable

* guard correctly

* h7 bit timing

* allow longer frames

* allow data smaller than maximum

* mcu temperature

* typo

* tx message

* testing

* check for CAN or FDCAN

* don't need that any more

* h7 bitrate config

* undo testing

* h7-ify msg tx

* comment

* break out SID/EID macros

* guard differently

* update ChibiOS

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-09 18:54:01 -05:00
Matthew Kennedy d7536bf059 finish off vbatt -> sensor model (#2433)
* more vbatt

* s

* goodbye voltage

* makefile

* apparently that part was in use

* include

* mocking
2021-03-07 20:18:32 -05:00
Matthew Kennedy 122f31fe4a hook up lps25 on proteus (#2418)
* hook up lps25

* it would help to include all the files

* unguard some stuff

* unguard more

* guarding

* s

* guard

* only register if init worked

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-04 22:39:20 -05:00
Matthew Kennedy f8747a35bf set all thread priorities in the same place (#2412)
* unify thread priority

* header

* mmc
2021-02-28 07:30:45 -05:00
Matthew Kennedy dbebc353a2 remove unused msg parameter (#2360)
* dead parameter

* last few
2021-02-16 09:32:16 -05:00
Matthew Kennedy c75af2ac75 properly put buffers in no-cache regions (#2357)
* configure for no cache

* this doesn't need a setting

* now we don't need invalidate

* reorder and comment

* mmc

* sw knock
2021-02-15 17:39:11 -05:00
Matthew Kennedy 983d75444e baro in sensor model (#2306)
* baro in sensor model

* missed

* typo

* init baro

* needs an include there
2021-02-07 17:54:41 -06:00
Matthew Kennedy 8d9db6b5c1 put vbatt in sensor model (#2261)
* vbatt in sensor model

* sensor name

* vbatt

* s

* oy vei

* a little bit of cleanup

* memory apparently

* cj125 test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-03 07:55:40 -06:00
Brenton Hewitt 2ce14cb66e Gm map sensors (#2265)
* GM 2 and 1 Bar Map Sensors

* GM MAP Sensor Selection Options
2021-02-02 08:15:28 -06:00
Andrey G 27905c6817 Chibi os 20 (#2212)
* Update ChibiOS

* Fix Makefiles includes paths

* halconf.h: remove flash hack

* mcuconf: fix EXTI ptiorityes

* Digital Input: ICU: use designated initializers, initialize 'arr'

* ChibiOS: lis302dl fix

* ADC: update to new API

* UARTConfig: timeout_cb field, formating

* ChibiOS: remove _exit, _kill, _getpid

* Fix lis302dl

* Bump config versions

* chconfig_common: cosmetic changes

* stm32f4ems: commulative config update

* Update Simulator

* ALLCSRC already contain all needed ChibiOS files.

Same for ALLINC and ALLCPPSRC

* ChibiOS fix for Simulator

* ChibiOS: port lock/unlock hook and MMC over SPI timeout

* STM32F7: update configs

* STM32F7: update linker file

* Cypress: port ADC lld to ChibiOS-20

* Cypress: port SPI lld to ChibiOS-20

* Cypress: port CAN lld to ChibiOS-20

* Cypress: fix include path for rules.ld

* Cypress: update chconf.h and halconf.h for ChibiOS-20

* Kinetis: update ADC lld to ChibiOS-20

* Kinetis: update SPI lld to ChibiOS-20

* Kinetis: update UART lld driver for ChibiOS-20

* Kinetis: update chconf.h and halconf.h for ChibiOS-20

* Kinetis: fix include path for rules.ld

* Nucleo F746: update ld script

* Nucleo F746: fix compile

* Bootloader: fix compilation with ChibiOS-20, cleanup

* Bootloader: add way to pass crosscompiler using CROSS_COMPILE

* Debug build arguments

* Simulator: fix windows compilation

Exclude syscalls_cpp.cpp from compilation
2021-01-19 15:20:35 -05:00
rusefillc b2dedddc1b todo: reduce magic constants 2021-01-14 22:34:06 -05:00
Andrey G 052e2e558b Supress annoing unused warnings (#2216) 2021-01-11 08:49:20 -05:00
Andrey G b61ae75fe2 gpio helper (#2195)
* gpios: isBrainPinValid helper

* LCD HD44780: do not touch pins if DM_NONE or invalid gpio

* Fix isEnabled checks for GPS and Joystick

* LCD HD44780: writePad use this method wider
2021-01-08 20:01:26 -05:00
Matthew Kennedy b8cab765b8 better error checking of thermistor config (#2199)
* add bounds check on result

* validate thermistor config

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-01-07 20:37:15 -05:00
Matthew Kennedy d8ebf58f0d Implement flex sensor (#2189)
* config & ui

* stub sensor

* stub init

* output channel, gauge, SD log

* linky linky

* fix

* add sensor & init

* clamp

* update comment

* filter the resultant signal

* changelog

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-01-05 17:13:56 -05:00
Andrey G 71fe582ce5 Adc isAdcChannelValid helper (#2188)
* Guard define argument

* ADC: isAdcChannelValid

Check for both <= EFI_ADC_NONE and >= EFI_ADC_LAST_CHANNEL
Also check for value out of enum range (corrupted settings)

* Fix unit tests
2021-01-05 16:02:20 -05:00
Matthew Kennedy eba6ae2e8f Flex fuel stubs (#2187)
* config & ui

* stub sensor

* stub init

* output channel, gauge, SD log

* linky linky

* fix

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-01-05 07:57:26 -05:00
Matthew Kennedy 83266c904b 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
rusefi 04e1d4f639 removing warning? 2020-12-28 19:19:11 -05:00
Matthew Kennedy 1a14746e97 extra data for rusEfi wideband controller (#2082)
* add config

* logic

* remove old

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-16 18:25:11 -05:00
rusefillc 9b7acb9dbf clang warnings again #2055 2020-12-11 12:50:10 -05:00
Matthew Kennedy ba1ba1452d 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
rusefi df4f738401 Merge remote-tracking branch 'origin/master' into master
# Conflicts:
#	firmware/controllers/engine_cycle/high_pressure_fuel_pump.cpp
2020-12-08 21:37:45 -05:00
Matthew Kennedy d7c56f78a9 require redundant TPS for ETB (#2041)
* Require redundant tps for ETB (#2037)

* mod sensor api

* require redundancy

* fix tests

* check that it fails

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>

* add a test that fails but should not

* fix the bug

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-08 06:24:20 -05:00
rusefi e38c6d3660 Revert "Require redundant tps for ETB (#2037)"
This reverts commit c08d0b5e
2020-12-07 01:11:32 -05:00
Matthew Kennedy c08d0b5ed8 Require redundant tps for ETB (#2037)
* mod sensor api

* require redundancy

* fix tests

* check that it fails

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-07 00:05:06 -05:00
Matthew Kennedy 69f754bfbd 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 7dad3356e9 add isRedundant (#2031)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 14:55:06 -05:00
Matthew Kennedy fbcfb4534a 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 b0410167de encapsulate entry logic in to entry (#2018)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-05 10:16:52 -05:00
rusefi 6bf93b653f Merge remote-tracking branch 'origin/master' into master 2020-11-29 12:51:04 -05:00
Matthew Kennedy ebb8ede1da squash warnings (#1984)
* warnings

* unused

* a few more

* too much

* uint16_t-ify
2020-11-23 09:43:16 -05:00
rusefi a54f3e5289 GDI Epic #1448 2020-11-23 01:10:12 -05:00
rusefillc 17a110ad44 Starter is engaged on start-up in pull-up configuration #1969
maintainability
2020-11-19 23:57:06 -05:00
rusefillc 89a20a20b0 Proteus TCU gear shift configuration #1927 2020-11-06 23:48:35 -05:00
rusefi d2d8b78073 B6 GDI 2020-11-01 00:33:18 -04:00
rusefillc 91afd62a53 GDI 2020-10-28 01:01:54 -04:00
Matthew Kennedy c38eb6d38f add Injector pressure sensor (#1898)
* add sensor type

* add config

* initialize injector pressure

* add UI
2020-10-23 15:46:16 -04:00
Matthew Kennedy dbdeca93b0 implement fuel pressure sensors (#1897)
* add

* remove old

* remove more old

* makefile

* fix init

* patch up other stuff

* actually fix it this time

* raw output channels

* gauges, UI

* scaled channel

* fix field ordering
2020-10-23 07:31:47 -04:00
rusefillc c1023504e6 Re-applying #1841
Revert "HW CI has failed 11 times since Oct 2 #1849"

This reverts commit 7d8238e6
2020-10-04 01:54:29 -04:00
rusefillc 7d8238e697 HW CI has failed 11 times since Oct 2 #1849
Revert "configure all sample times - fix MRE knock sampling (#1841)"

This reverts commit e02c86a7
2020-10-03 21:36:09 -04:00
Matthew Kennedy e02c86a7dc configure all sample times - fix MRE knock sampling (#1841)
* configure all sample times

* smpr 1 vs smpr 2

* man I can't type

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-10-02 20:49:56 -04:00
David Holdeman e6f6c43767 switch to pass by reference (#1832) 2020-09-28 19:17:17 -04:00
shadowm60 c85932727e Mre sw knock detection (#1815)
* Add SW knock control to MRE on AT4

* Update software_knock.cpp

cleanup

* use knock only for final build

* adjust RAM

* Update engine_controller.cpp

Adjust RAM for HW QC special to build
2020-09-22 03:48:17 -04:00
Matthew Kennedy 9783f40820 move AEM xseries lambda to new sensor (#1764)
* lambda sens

* fix init

* new sensor aem

* comment

* g

* format

* x

* guard

* fix init for tests

* fix

* put back

* put back

* fix

* fix init

* why is this different

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-09-21 06:01:54 -04:00
Matthew Kennedy d23a48fc53 Dedicated sensors for wastegate + idle position (#1805)
* config

* add sensor

* listen to new adc channels

* fix

* add gauges to TS

* add gauge values

* TS UI
2020-09-18 10:04:07 +03:00
David Holdeman e8e2cf2cfd DebounceButton A/C switch (#1782)
* change acSwitch name, add mode

* fix

* remove some adc stuff

* remove some adc stuff

* semicolon stupid

* left behind

* add readpinstate

* wrong var name

* add functions back

* fix name

* bool, not void, plus fix name

* move

* not sure what I broke

* try setMockValue

* namespace

* whoops missed one

* switch values because adc was set up for pullup

* try 5

* comment for now

* comment for now

* uncomment tests, add function to mock, add mock to efiReadPin

* fixes

* for F's sake

* if

* add defy

* pass params

* use ASSERT_TRUE/FALSE

* advance time

* remove ifdef from readPin

* try moving if

* move to separate func

* move extern

* move include

* try engine_test_helper

* am confuse

* move func to else

* include hal

* add efi prod check

* remove include

* try extern

* move include

* semicolon stupid

* move extern again

* include

* move mockPinStates

* size

* add if

* add comment

* clean on instantiation
2020-09-10 22:16:20 -04:00
rusefi fd016995a0 microRusEFI used as Body Control Module BCM BCU 2020-09-07 20:06:13 -04:00
rusefi adbb3f07e7 microRusEFI used as Body Control Module BCM BCU 2020-09-07 16:25:00 -04:00
rusefi 995bc111ca microRusEFI used as Body Control Module BCM BCU 2020-09-06 23:39:25 -04:00
rusefi 0e3d16b5d5 microRusEFI used as Body Control Module BCM BCU 2020-09-06 23:19:32 -04:00
rusefi a87dfb7f87 microRusEFI used as Body Control Module BCM BCU 2020-09-06 22:36:31 -04:00
Matthew Kennedy fc02c2bdf4 fix broken master, inject engine ptr to rpmcalculator (#1759)
* fix

* oops
2020-09-05 18:49:42 -04:00
rusefi be49f46057 less hacky testing implementation 2020-09-03 22:52:29 -04:00
rusefi 868a8b02bb less hacky implementation 2020-09-03 21:47:50 -04:00
rusefi f9cad49f8d OBD CAN sensors #1733 2020-09-03 19:09:05 -04:00
rusefi 4e06bee9aa OBD CAN sensors #1733 2020-09-03 16:58:10 -04:00
Matthew Kennedy 96a9c7f4c4 Multiple knock sensors (#1745)
* fw

* cfg fields

* fix order

* ui for channel select

* clarify

* comments

* config
2020-09-02 07:19:02 -04:00
Matthew Kennedy bad69c812e 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 95f3ce2baf OBD CAN sensors #1733 2020-08-31 23:01:17 -04:00
rusefi 663b33376a OBD CAN sensors #1733 2020-08-31 22:50:01 -04:00
rusefi 262405a915 OBD CAN sensors #1733 2020-08-31 22:47:33 -04:00
Matthew Kennedy 95f858265b detect which cylinder knocked (#1732)
* s

* science

* set pin mode

* turn stuff off so it fits

* filtering maybe

* filtering actually works

* generate filter parameters internally

* shorter window

* guard behind enable flag

* use checked in filter

* add biquad reset

* tracing

* const

* exec order

* do it from a thread

* smaller buffer, comment

* configure with header

* only for proteus

* oops

* unused

* not needed

* guards

* pin config

* don't need that include

* precook filter steady state

* define sample rate

* multi cylinder knock

* TS

* only sense when running
2020-08-31 21:05:33 -04:00
rusefi 052ccd01d5 going human 2020-08-31 10:49:16 -04:00
rusefi 23a790f66d OBD CAN sensors #1733 2020-08-31 04:39:27 -04:00
rusefi e02a5eb88d OBD CAN sensors #1733 2020-08-30 14:27:41 -04:00