Commit Graph

549 Commits

Author SHA1 Message Date
Andrey f1f447df45 tear down Engine god object #4511
just trying different things
2022-09-05 03:38:44 -04:00
Andrey 99d8801dc6 tear down Engine god object #4511
just trying different things
2022-09-05 02:59:38 -04:00
Andrey 268a5c7964 tear down Engine god object #4511
just trying different things
2022-09-05 02:44:06 -04:00
Andrey 6d72805a56 tear down Engine god object #4511
just trying different things
2022-09-05 02:28:46 -04:00
Andrey 7139c21e7a Injection Offset for skipped wheel triggers fix #4536 2022-09-05 01:31:03 -04:00
Andrey c1b218b772 refactoring: let's use different names for different things 2022-09-05 01:16:24 -04:00
Andrey d51511a15e refactoring: moving field 2022-09-05 00:53:05 -04:00
Andrey ccfe2a5d58 refactoring: splitting header where cpp was already split 2022-09-05 00:48:38 -04:00
Andrey 0ed576031e refactoring: moving method closer to usage 2022-09-05 00:32:36 -04:00
Matthew Kennedy c4080e7c80
extract updateInjectionAngle (#4512) 2022-09-01 18:48:03 -04:00
Andrey ac0b4a05fc a bit of dead code 2022-09-01 12:05:01 -04:00
Andrey 9d8afea152 a bit of dead code 2022-09-01 11:47:56 -04:00
Andrey e240ac84d3 refactoring: reducing outputChannels copy 2022-09-01 01:06:49 -04:00
Andrey 705dda095e dead code 2022-09-01 00:23:33 -04:00
Andrey da66fa055c refactoring: enum name clean-up 2022-09-01 00:23:33 -04:00
Andrey 9f4f85a097 let spark deal with spark limpManager 2022-08-31 23:59:40 -04:00
Andrey 28d797d5c2 moving confusion further away from fuel control 2022-08-31 23:59:40 -04:00
Andrey 6d3a6dc2f8 readability 2022-08-31 23:29:47 -04:00
Andrey 4cbaddcc60 less code is better 2022-08-31 23:14:20 -04:00
Andrey 039f70b18e unused parameter 2022-08-31 22:59:05 -04:00
Andrey fef406a5a6 english do you speak it 2022-08-31 22:56:38 -04:00
Andrey c8e821ce16 dead 2022-08-31 22:45:35 -04:00
Andrey a4805dace0 dead console command and minor refactoring 2022-08-31 22:41:58 -04:00
GitHub gen-configs Action 490d9b0c93 Auto-generated configs and docs 2022-08-30 06:02:26 +00:00
Matthew Kennedy ee97e2a7d0
knock retard limit table (#4498)
* add max retard table

* ui

* s

* better naming

* s

* test can use base class
2022-08-30 01:57:37 -04:00
Andrey 3fe2c74730 docs 2022-08-25 19:58:15 -04:00
Andrey cecc5a9d6e https://github.com/rusefi/hellen154hyundai/issues/60
extra logging
2022-08-25 19:58:10 -04:00
rusefillc 5d2096f906 require full sync for odd cylinder count #4478 2022-08-23 22:58:33 -04:00
rusefillc c7c443ea24 https://github.com/rusefi/hellen154hyundai/issues/57 2022-08-09 13:26:11 -04:00
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
rusefillc 232729e8bf todo: shall we move into high_pressure_fuel_pump.txt and reduce OOP elegance or create a separate live data just for these ones? 2022-07-04 17:08:41 -04:00
Andrey dc4fcda6da logging of live data structs was: data points #3614 2022-06-29 03:21:53 -04:00
rusefillc 8acbf9d8df logging of live data structs was: data points #3614 2022-06-29 03:13:35 -04:00
Matthew Kennedy c0f290b922
Injector scheduled by angle, not tooth index (#4208)
* trigger decoder returns a result

* TriggerFormDetails

* s

* don't reach out and touch the engine

* injection doesn't care about teeth

* fix up existing tests

* oh look, we can actually test this logic now without trying to depend on trigger shape!!!

* fix a real bug

* simplify
2022-06-24 17:43:23 -04:00
rusefi a552d58d42 verbose trigger sync should reuse engineSnifferRpmThreshold #4259
reducing complexity
2022-06-18 14:17:36 -04:00
Matthew Kennedy 720c463ffb
trigger decoder returns a result (#4206) 2022-05-28 09:01:45 -04:00
Matthew Kennedy fe77f5127e
12 tooth crank mode (#4179)
* 12 tooth crank

* comment

* s

* rusefi config
2022-05-17 21:38:24 -04:00
rusefillc 7ca32951ec An option to disable semi-random ignition fix #4151 2022-05-08 09:16:43 -04:00
Andrey e62877964a Move curves out of engineConfiguration in order to reduce RAM usage #4127 2022-05-01 23:43:43 -04:00
rusefillc ec1a6a84db knock reaction #202
LiveData
2022-04-29 15:23:22 -04:00
rusefillc 243fde13fa knock reaction #202
steps towards new LiveData convention
2022-04-29 13:47:31 -04:00
rusefillc b8c82889f3 knock reaction #202 2022-04-29 12:25:33 -04:00
GitHub build-firmware Action acaadb476e Auto-generated configs and docs 2022-04-29 16:04:30 +00:00
rusefillc 07201ae979 knock reaction #202 2022-04-29 11:22:24 -04:00
Matthew Kennedy 38213bbc00
more missing autoscale (#4112)
* autoscale m_config->timeConstant

* min/max afr

* more

* dwell voltage

* closed loop fuel

* knock

* map estimate

* applyNonlinearBelowPulse

* fix

* add a test while we're at it for un-covered code

* test fallback MAP since we touched that

* always compute fallback MAP even if sensor is OK
2022-04-28 08:16:02 -04:00
Matthew Kennedy bc6a87cadc
allow enum_class in rusefi_hw_enums.h (#4104)
* make things c++ friendly

* install various canaries in coal mines

* using is much clearer than typedef

* fixing builds

* lps25

* trigger includes were a mess

* c -> c++ cleanup

* os util

* why did so many include os_util.h?

* fwd declare

* cypress/kinetis

* s

* eg33 happy

* happy sim

* cypress usb

* pch

* cypress

* doesn't need to include all that

* h7
2022-04-25 20:38:16 -04:00
rusefillc 71275e841b
m_hasSynchronizedSymmetrical handling improvements #4099 (#4101) 2022-04-23 19:45:29 -04:00
Matthew Kennedy 16de438ab8
knock threshold table fix (#4077)
* fix knock threshold table

* defaults

* knock controller is engine module

* testable

* test builds

* knock tests work

* s

* format

* everyone loves changelogs
2022-04-18 08:03:16 -04:00
GitHub build-firmware Action a2cff4ee12 Auto-generated configs and docs 2022-04-17 20:30:07 +00:00
rusefillc 0b21ddce9c random progress 2022-04-16 16:39:52 -04:00
Matthew Kennedy 497e7ffe77
allow setting injection phase by start or center of injection (#4068)
* allow SOI/COI

* other change

* renames and simplify

* clean up ownIndex

* double check in spark logic
2022-04-15 10:22:36 -04:00
rusefillc b776003989 do not control VVT during cranking fix #3443 2022-04-10 19:22:39 -04:00
rusefillc 6b5747d4c8 refactoring: method rename 2022-04-02 21:01:29 -04:00
Matthew Kennedy f742ae8b7e
limp mangaer handles more stuff (#3983) 2022-03-20 09:28:17 -04:00
Benas Brazdziunas 2035c2fa7f
Launch fuel and spark cut issue (#3988)
* Launch fual and spark cut issue

* moved launch cuts to limp_manager

* Applied recomendations

* Auto-generated configs and docs

* Added recomendations

* Auto-generated configs and docs

Co-authored-by: GitHub build-firmware Action <action@github.com>
Co-authored-by: Benas <bbrazdziunas@gavea.co.uk>
2022-03-11 09:27:42 -05:00
rusefillc 751355a04b
Limp shutdown rebase (#3879)
* limp manager handles engine stop

* use timer

* dead relevant fsio

* this stuff needs its own ticket

* if we can comment out 'business logic' and tests do not fail it's not a great sign :(

Co-authored-by: Matthew Kennedy <matthewkennedy@outlook.com>
Co-authored-by: rusefillc <sdfsdfqsf2334234234>
2022-02-01 20:47:17 -05:00
Matthew Kennedy 41ab294281
fix sequential mode cranking (#2919)
* fix

* use the right enum

* do it for fuel too

* earlier

* s
2022-02-01 19:04:20 -05:00
Matthew Kennedy c6f45c5022
warnings fixes (#3851)
* unused things

* !!! actual bug !!!

* dead

* unused

* unused

* multi-bus lua RX was just broken

* make the compiler angry about it

* dead config

* alphax 2

* just call, no store

* compiler too angry
2022-01-31 18:37:42 -05:00
Matthew Kennedy b5232ab5e6
decouple TPS accel enrichment from trigger (#3825)
* move call site

* move thresholding out of fast path

* adjust config

* test
2022-01-23 15:31:39 -05:00
Andrey 365f2f24f0 Good news RPM is now float
open question if I've affected performance negativelly or not.
2022-01-21 00:56:13 -05:00
Andrey 33df88d3f7 fixing NOISY_RPM handling via Sensor framework 2022-01-21 00:21:45 -05:00
Andrey 1bd71e4b2e migrating to SensorType::Rpm API 2022-01-20 23:54:52 -05:00
Andrey 26c2d76f6c migrating to SensorType::Rpm API 2022-01-20 23:36:09 -05:00
Andrey cda2b711cf migrating to SensorType::Rpm API 2022-01-20 23:32:59 -05:00
Andrey c7a62bcdb3 migrating to SensorType::Rpm API 2022-01-20 22:04:45 -05:00
Andrey 5f788415ea what's the difference between setRpmValue and assignRpmValue #3815
refactoring
2022-01-20 21:48:18 -05:00
Matthew Kennedy 38ee722d49
#3815 (#3816) 2022-01-19 17:38:17 -05:00
Matthew Kennedy 07024f4c3b
add option to always use instant RPM (#3813)
* option to always use instant RPM

* duh
2022-01-19 07:34:22 -05:00
rusefillc 729c9a1ff4 On m_event vs lobe vs scheduling #3804 2022-01-18 22:36:05 -05:00
rusefillc 0e17f9d6e8 On m_event vs lobe vs scheduling #3804 2022-01-18 21:01:49 -05:00
rusefillc f470d93cca On m_event vs lobe vs scheduling #3804 2022-01-18 20:57:24 -05:00
rusefillc c23c93a384 On m_event vs lobe vs scheduling #3804 2022-01-18 10:16:47 -05:00
rusefillc 5e2ad39d91 GDI Epic #1448 2022-01-18 00:27:20 -05:00
GitHub build-firmware Action 726147da75 Auto-generated configs and docs 2022-01-18 05:10:57 +00:00
rusefillc 12ce80f1cb live data 2022-01-18 00:05:34 -05:00
Andrey a1374062f0 Better handling of RPM during stop of cranking #3803
reuse existing magic constant
2022-01-17 21:18:43 -05:00
rusefillc bc66096574 Better handling of RPM during stop of cranking #3803
refactoring: reusing existing method
2022-01-17 21:00:49 -05:00
rusefillc 177a5faa63 limp ClearReason 2022-01-08 22:13:20 -05:00
GitHub build-firmware Action 2208947bb3 Auto-generated configs and docs 2022-01-05 06:49:51 +00:00
GitHub build-firmware Action 38b17f5859 Auto-generated configs and docs 2022-01-05 05:09:04 +00:00
Scott Smith efd59d6cbc
GDI/HPFP: Don't take P term into account when clamping I. (#3732) 2022-01-02 18:45:31 -05:00
rusefillc 95136893de GDI Epic #1448 2022-01-01 17:18:11 -05:00
Matthew Kennedy ab3e3ac83f
hook up fuel trims (#3715)
* hook up fuel trims

* pass all the params

* store per-cylinder fuel mass directly

* main trigger callback only touches per-cylinder, no banks!

* test test test test

* move UI to happy land

* changelog
2022-01-01 02:19:59 -05:00
rusefillc f715210b39 GDI Epic #1448
live view
2021-12-31 15:28:24 -05:00
rusefillc bb3f8cb76f GDI Epic #1448 2021-12-31 03:09:04 -05:00
rusefillc 268827b87b GDI Epic #1448 2021-12-31 03:09:04 -05:00
Matthew Kennedy b3de217c1b
adjustment to #3722 (#3723)
* s

* behold, another bug a test caught

* test

* test generates usable trigger pattern so it works correctly

* comment

* don't need that
2021-12-31 01:21:21 -05:00
rusefillc 12d79c138b GDI Epic #1448 2021-12-30 19:14:49 -05:00
Matthew Kennedy c3b712aa3b
remove vvtSyncTimeNt (#3722)
* s

* poke

* poke again for science

* kick for science

* kick

* kick

* comment kick

* s

* don't try to compare the array decay pointer to 0 (!)

* collateral damage

* adjust miata sync

* reset trigger states correctly on engine stop

* s

* check synchronized bit

* now we don't need it at all?!

* and *NOT* synced

* start VVT sync earlier
2021-12-28 00:00:26 -05:00
Matthew Kennedy 95ad75318d
improved noFiringUntilVvtSync logic (#3696)
* s

* poke

* poke again for science

* kick for science

* kick

* kick

* comment kick

* s

* don't try to compare the array decay pointer to 0 (!)

* collateral damage

* adjust miata sync

* reset trigger states correctly on engine stop

* s

* nissan MR too
2021-12-27 12:09:38 -05:00
rusefillc 06ccf524dd MAP phase sensing #3544
removing dead implementation
2021-12-16 21:13:55 -05:00
rusefillc 82c061a8e0 MAP phase sensing #3544 2021-12-16 21:11:29 -05:00
Matthew Kennedy 4148ee76bf
smarter priming logic (#3674)
* ignition controller detects rising edge on voltage

* update test

* comment

* ignore negative transients

* tweak

* test

* priming happens on ignition-on

* priming has its own scheduling

* config & UI

* dead config

* implementation

* look, the test caught a bug

* keep the watchdog happy

* bad merge

* changelog

* easier to read the test

* test naming
2021-12-08 16:20:19 -05:00
Matthew Kennedy 2050580a16
prime upon ignition voltage, not on power on (#3662)
* ignition controller detects rising edge on voltage

* update test

* comment

* ignore negative transients

* tweak

* test

* priming happens on ignition-on

* priming has its own scheduling

* test

* dead adjacent line of code
2021-12-08 07:26:49 -05:00
Andrey 940b04ab24 Let's always have TS structure so that unit tests can check values in outputChannels, kind of making outputChannels a god dump for state but whatever since Live View is coming 2021-12-07 20:18:47 -05:00
Matthew Kennedy 3a95e86112
calculate per-cylinder ignition timing (#3652)
* simplify cylinder phasing

* per cylinder timing

* s

* s

* s

* why was there a divide by 2?
2021-12-06 21:19:37 -05:00
rusefillc 2f45ed205c MAP phase sensing #3544
option to look for high and low peaks
2021-12-05 14:25:26 -05:00
Matthew Kennedy 555a8d5f43
simplify cylinder phasing (#3650) 2021-12-05 10:46:35 -05:00
rusefillc 0c91e77749 MAP phase sensing #3544
taking a step back to happy place
2021-12-04 18:21:10 -05:00
rusefillc 004f28a60a MAP phase sensing #3544 2021-12-04 17:19:35 -05:00
rusefillc 3a8e7e00f9 MAP phase sensing #3544 2021-12-02 22:32:07 -05:00
rusefillc e75590fd45 why so many channels are hidden in debug ? #3614 2021-11-29 14:11:19 -05:00
rusefillc edb10af9f4 automation around outputs section #197 2021-11-27 13:36:37 -05:00
Andrey 48ed80ffb9 MAP phase sensing #3544 2021-11-24 23:06:52 -05:00
Andrey e2fa1af527 MAP phase sensing #3544 2021-11-24 22:36:36 -05:00
Matthew Kennedy 992689ced5
bye (#3609) 2021-11-24 22:03:17 -05:00
Matthew Kennedy bc1c2e78fd
fix map avg logging (#3606)
* s

* s
2021-11-24 18:24:39 -05:00
Matthew Kennedy 09bf989995
map averaging usability (#3603) 2021-11-24 14:39:54 -05:00
rusefillc 446252d77d MAP phase sensing #3544 2021-11-24 14:26:41 -05:00
Matthew Kennedy 3334a6963c
oh my god we've had no asserts (#3595) 2021-11-22 17:52:03 -05:00
Matthew Kennedy a342bee57e
rpm calculator refactoring, gm 24x test (#3585)
* data

* stub test

* use getTimeSinceSyncPoint

* s

* s

* no

* test

* stray ;

* those were 1/10 what they were supposed to be

* actually check something

* dead log line?
2021-11-20 14:59:02 +03:00
Scott Smith 5bc1949aef
Basic framework for high pressure fuel pump control (#3476)
* Basic framework for high pressure fuel pump control

* Many changes

Move calculations to fast callback
Move main object into Engine
Respond to pin changes without requiring a reboot

* Use EngineModule for HpfpController
Schedule pin off after executing pin on so we are sure it ends, even if the motor stops.
Test scheduling.
Less RAM use by only having one event and reordering fields.

* Make scheduling test actually useful - need non-0 activation angle.

Co-authored-by: rusefillc <48498823+rusefillc@users.noreply.github.com>
2021-11-19 23:06:51 -05:00
Matthew Kennedy d40ca0f581
fuel pump doesn't use fsio (#3576)
* fuel pump

* s

* call correct callback

* more dead

* test adjustment

* don't overflow

* don't need separate function

* java

* give it a name

* generated

* generated

* add to generate script

* import *

* this is so cheap we don't need a flag
2021-11-19 22:23:12 -05:00
Scott Smith 18c27a6e9c
Separate out scheduleOrQueue into it's own standalone scheduler. (#3573)
It's a large enough entity that it shouldn't be buried in ignition logic.
2021-11-18 14:27:21 -05:00
Scott Smith 98040ad9af
Make the module API more concise. (#3571)
engineModules.get<FOO>(). becomes modules<FOO>()->

I believe the new API is more conducive to supporting arrays, by doing std::array<T, N> or
std::array<Mockable<T>, N>, with the support of a helper class.
2021-11-17 21:50:00 -05:00
Scott Smith ba8bd0a704
Add a lock for scheduleOrQueue events. (#3572)
Ignition callers are all tooth based, but aux valves calls it from both the microsecond timer and
the main initialization thread.  HPFP will also soon call it from both those places too.
2021-11-18 05:08:32 +03:00
Scott Smith 69d36dad6e
Final cleanup of ENGINE macros (#3567)
Fix some uses of ENGINE() not detected by regex due to parenthesis.
Remove now empty engine_ptr.h
Don't worry about EFI_* not being defined, the compiler defaults to 0 if they aren't.
2021-11-17 13:45:10 -05:00
Scott Smith 988aacdd91
Create a base class EngineModule for that contains various useful callbacks. (#3548)
* Create a base class EngineModule for that contains various useful callbacks.

This cleans up the API by not requiring the notifiers to know about who wants callbacks.  The only
place you need to update to add a module is in one place.

* Add mockability.

* Convert InjectorModel to a Mockable EngineModule
2021-11-17 20:13:19 +03:00
rusefillc d688f72c3e proportional spark cut #3427 2021-11-17 04:06:22 -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
Andrey 3748bf5ad0 proportional spark cut #3427 2021-11-16 05:56:15 -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
Andrey 655b77dc3f random refactoring: trigger central encapsulation 2021-11-15 20:22:05 -05:00
Andrey 928c673695 refactoring launch 2021-11-15 20:09:03 -05:00
Andrey 05fa6071dd refactoring launch 2021-11-15 19:55:04 -05:00
Andrey 4002c92dcc refactoring launch 2021-11-15 18:57:12 -05:00
Andrey 34015eceee refactoring launch 2021-11-15 14:40:35 -05:00
Matthew Kennedy cb032fb1ea
(void) -> () (#3550)
* static functions with (void)

* more

* Revert "more"

This reverts commit 246e53441f.

* s

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-15 13:02:34 +01:00
Matthew Kennedy 145316c497
less macro, more c++ (#3549)
* less macro

* s
2021-11-15 12:44:40 +01:00
rusefillc 22c872d8d8 Epic: Remove FSIO #2928 2021-11-14 10:57:19 -05:00
rusefillc 6210eaacf7 script settings need names! 2021-11-13 23:10:38 -05:00
Andrey cd57e1fdb6 Something something Automatic Compression Release #3442 2021-11-11 20:16:46 -05:00
Andrey 6436a2b9a4 dead line 2021-11-11 20:16:46 -05:00
Scott Smith 158f719d95
Save ~2800 bytes of RAM by not caching angle->trigger mapping (#3506)
Memory seems more valuable than CPU; use the O(lg n) lookup by angle.  A side effect is that it
seems to fix trigger lookup for the second phase of TRIGGERTYPE 53 544 TT_TRI _TACH 0.00
2021-11-09 07:03:27 -05:00
Scott Smith f9e36f5ea4
Configuration for HPFP control algorithm. (#3475) 2021-11-05 23:15:35 -04:00
rusefillc 85984928ca more curves! also names for curves 2021-11-04 23:19:44 -04:00
Matthew Kennedy 59e9d05fc7
extract engine phase function (#3456)
* extract getCurrentEnginePhase

* inject engine ref

* never invalid RPM, use 0 instead

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-04 05:46:16 -04:00
Matthew Kennedy 75a2b5ef02
Knock retard (#3396)
* output gauge

* knock controller

* don't need that

* inject engine ref

* test knock

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-11-01 23:33:59 -04:00
rusefillc 61e2b3d5db Remove engine load acceleration enrichment fix #3357 2021-10-16 21:24:05 -04:00
Matthew Kennedy 9797d25b7c
getOrZero (#3319) 2021-10-05 19:59:07 -04:00
Matthew Kennedy 9806373dac
dead map (#3316) 2021-10-04 18:33:10 -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 346fe25267.

* 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 f6d492121e
shrink multi cylinder map average buffer (#3315)
* halve

* add tooltip, rename UI
2021-10-04 07:50:17 -04:00
rusefillc b4884498cb OBD error renames 2021-10-03 01:30:42 -04:00
Andrey fdab6c303c overdwell protection #3071 2021-10-02 01:33:26 -04:00
rusefillc 77ebc71f9a
overdwell protection #3071 (#3294) 2021-10-02 01:17:53 -04:00
Matthew Kennedy 0a550a70b1
overdwell protection (#3220)
* cancel event

* looks like it works...

* some tests are happy

* add enable bit

* undo test changes

* Revert "add enable bit"

This reverts commit 000afadd3f.

* enable bit in engine

* only turn off for one test

* Revert "undo test changes"

This reverts commit 106db49e29.
2021-10-02 01:10:24 -04:00
Andrey 2a2722c3cc SPARK_EXTREME_LOGGING 2021-10-01 23:50:32 -04:00
Matthew Kennedy 90e5fba5db
dead code in map avg (#3290)
* dead code in map avg

* while we're at it

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-09-30 23:05:58 -04:00
Matthew Kennedy 4b6a67f8f0
bye frequency map (#3285)
* bye freq map

* map.cpp

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-09-30 00:20:21 -04:00
rusefillc a6fbb98193 Complete fuel cut, maybe by wall wetting? Warning on decel (?) CUSTOM_OBD_SKIPPED_FUEL = 9010 fix #3225 2021-09-27 22:04:03 -04:00
rusefillc bca1b11146 "Injector Duty cycle cut" 2021-09-26 20:59:32 -04:00
Matthew Kennedy 34c98c1485
weak link stub (#3258) 2021-09-22 14:33:25 -04:00
Matthew Kennedy 8cd132b8a8
dead knock code (#3255)
* more unification

* hip stub

* comment

* guard

* channel idx

* include

* hip

* move in to engine

* hip9011

* dead stuff

* dead

* fsio

* lcd

* more dead
2021-09-21 20:40:20 -04:00
Matthew Kennedy 5de27e0b92
more knock sense unification (#3250)
* more unification

* hip stub

* comment

* guard

* channel idx

* include

* hip

* move in to engine

* hip9011
2021-09-21 17:39:21 -04:00
Matthew Kennedy bf98546314
share some knock logic (#3246)
* knocky knock

* only if TS

* typo

* merge
2021-09-20 16:10:34 -04:00
rusefillc ff6edb9790 refactoring: just a better constant name 2021-09-08 20:32:50 -04:00
rusefillc 0159e8e32b Smart ECU: misfire detection #936 2021-09-06 15:29:36 -04:00
rusefillc 059a82bcb2 Smart ECU: misfire detection #936 2021-09-06 11:10:11 -04:00
rusefillc a555b7a00f Smart ECU: misfire detection #936 2021-09-06 10:35:26 -04:00
Matthew Kennedy 87e4e7e4cf
simpler way for limp manager to handle engine stop (#3194)
* simpler

* why would we lie about spinning?
2021-08-25 11:29:20 +03:00
rusefillc cc9b8ffa98 Implement auto knock threshold sampling #3033 2021-08-10 06:42:39 -04:00
Matthew Kennedy 5ff7235040
don't "validate instant RPM" (#3095)
* don't "validate instant RPM"

* test actually tests the right thing

* test mode transition
2021-08-04 08:17:14 +03: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 0d983855b9
instant rpm uses full engine cycle (#3077)
* instant rpm uses full engine cycle

* turn off fast spinup for this test
2021-07-30 08:18:24 -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 2368e90ae7
dead (#3016) 2021-07-23 08:31:23 -04:00
Andrey 8b5dde5a8f trailing spark outputs fix #2931 2021-07-22 00:01:54 -04:00
Matthew Kennedy 76924be3d1
not setValue (#3026) 2021-07-21 23:36:46 -04:00
rusefillc 599943cf26 NB2 trigger shape does not seem to match JimStim #2980 2021-07-17 16:12:54 -04:00
Matthew Kennedy 2ce7777865
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
Andrey e1c41ff798 FATAL on NB2 tune jim stim input signal #2965 2021-07-14 16:03:00 -04:00
Matthew Kennedy 86683afca2
trailing spark scheduling (#2932)
* enable bit

* implement trailing sparks

* test trailing spark

* it helps to call the correct function

* add pins

* gobblin ram
2021-07-09 08:37:46 -04:00
Matthew Kennedy 9377a01aec
store cylinder count as plain number (#2915)
* update test framework

* eh

* hey look it's fewer warnings

* unwind

* fix

* config

* configs

* logic

* even java had some

* no need to be a typedef

* paste in actual cylinder count
2021-07-07 08:31:05 -04:00
Matthew Kennedy 2eb0b2a631
Unified cyl count macro (#2914)
* update test framework

* eh

* hey look it's fewer warnings

* unwind

* fix

* config

* configs

* logic

* even java had some

* console needs help
2021-07-06 20:14:08 -04:00
Matthew Kennedy 35ad1b7d89
fix instant rpm (#2886)
* fix instant rpm

* this is what it should look like!

* warning

* comment issue link

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-07-01 09:19:16 -04:00
rusefillc b84369c8c0 unit_tests: mapAveragingTriggerCallback causes segmentation fault fix #2858 2021-06-25 10:43:58 -04:00
rusefillc 6605935015 unit_tests: mapAveragingTriggerCallback causes segmentation fault #2858 2021-06-25 10:21:31 -04:00
Andrey 761d9fc40e global static not good, there shall be only one god object /s 2021-06-25 01:37:43 -04:00
Andrey 71fdfe6756 giving unit tests a chance to use tdcMarkCallback 2021-06-25 01:31:53 -04:00
Andrey a57d7c48fb global static not good, there shall be only one god object /s 2021-06-23 06:10:27 -04:00
Andrey 47b62a5a3a https://www.rusefi.com/forum/viewtopic.php?p=41296 2021-06-20 17:26:24 -04:00
Matthew Kennedy 3a30f038ce
kill engine if no oil pressure (#2800)
* min oil pressure for crank

* do it time-based

* rename field

* include

* fix existing test

* tests

* fix logic

* more test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-06-16 17:20:28 -04:00
Andrey G a1387d3bd2
Fixes (#2807)
* tle6240: fix Matt's trap

* map: report some default value if no map sensor configured

Othervise user will get "unexpected MAP value" warning

Thread 2 hit Breakpoint 1, validateMap (mapKPa=3121.66162) at ./controllers/sensors/map.cpp:126
126		if (cisnan(mapKPa) || mapKPa < CONFIG(mapErrorDetectionTooLow) || mapKPa > CONFIG(mapErrorDetectionTooHigh)) {
(gdb) bt
 0  validateMap (mapKPa=3121.66162) at ./controllers/sensors/map.cpp:126
 1  0x002717dc in getMap () at ./controllers/engine_cycle/map_averaging.cpp:334
 2  0x0028175a in GetMapWrapper::getMap (this=0x2004214c <mapWrapper>) at ./init/sensor/init_map.cpp:12
 3  0x0028177c in operator() (__closure=0x0) at ./init/sensor/init_map.cpp:20
 4  0x002817a8 in _FUN () at ./init/sensor/init_map.cpp:21
 5  0x002811de in FunctionPointerSensor::get (this=0x20042150 <mapSensor>) at ./controllers/sensors/function_pointer_sensor.h:24
 6  0x002651c0 in SensorRegistryEntry::get (this=0x2003ddf0 <s_sensorRegistry+48>) at ./controllers/sensors/sensor.cpp:111
 7  0x002653e2 in Sensor::get (type=SensorType::Map) at ./controllers/sensors/sensor.cpp:208
 8  0x00261f38 in updateTunerStudioState (tsOutputChannels=0x2003d2e8 <tsOutputChannels>) at ./console/status_loop.cpp:637
 9  0x00262e48 in prepareTunerStudioOutputs () at ./console/status_loop.cpp:900
 10 0x00260914 in TunerStudio::cmdOutputChannels (this=0x20021a64 <tsInstance>, tsChannel=0x2003d4dc <usbChannel>, offset=0, count=340) at ./console/binary/tunerstudio_commands.cpp:24
 11 0x00260584 in TunerStudioBase::handleCrcCommand (this=0x20021a64 <tsInstance>, tsChannel=0x2003d4dc <usbChannel>, data=0x2003d4e1 <usbChannel+5> "", incomingPacketSize=5)
    at ./console/binary/tunerstudio.cpp:701
 12 0x0025fb3c in tsProcessOne (tsChannel=0x2003d4dc <usbChannel>) at ./console/binary/tunerstudio.cpp:537
 13 0x0025fbe2 in TunerstudioThread::ThreadTask (this=0x2003d608 <usbConsole>) at ./console/binary/tunerstudio.cpp:554
 14 0x0025f094 in ThreadController<1200>::StaticThreadTaskAdapter (thread=0x2003d608 <usbConsole>) at ./controllers/system/thread_controller.h:37
 15 0x0020035e in _port_thread_start () at ChibiOS/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.S:201
2021-06-10 19:39:48 -04:00
Matthew Kennedy 8ce2057a89
parser rewrite prep: normalize config (#2741)
* cleanup 1

* cleanup 2

* impl

* fix
2021-05-27 08:23:28 -04:00
David Holdeman 6d4060d824
Doxygen titles (#2728)
* move addRow call

* undo submo bump

* add header titles
2021-05-22 22:10:58 +03:00
Matthew Kennedy 13f3d1e291
Fix multi bank fueling (#2661)
* add cylinder number

* changelog

* wording
2021-05-09 09:37:07 -04:00
Andrey G e18ba01fe5
hip9011 (#2658)
* hip9011: isolate debug stuff

* hip9011: renames

* hip9011: start sensing knockDetectionWindowStart degres from fire

* engine: more realistic values for knock window

* hip9011: remove magic CS toggling

* hip9011: EFI_HIP_9011_DEBUG should depend on EFI_HIP_9011
2021-05-08 18:43:55 -04:00
Matthew Kennedy 3968204dfa
Hook up multi bank fuel trim (#2532)
* multi bank trim

* cleaning

* output channels

* output channels
2021-05-08 17:41:50 -04:00
Matthew Kennedy c26987b96b
Destroy all shared logger (#2574)
* most of shared logger

* a few more

* one more

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-21 14:28:48 -04:00
Matthew Kennedy ad71016862
rip the bandaid: find-replace most of scheduleMsg (#2572)
* biiiig find replace

* more trivial find replace

* pwm

* almost all of them

* few more

* gpio

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-21 12:53:13 -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
Andrey G 70e0723626
use cylinders_count_t in loops through cylinders (#2563)
to supress signed vs usigned warnings
2021-04-18 08:58:56 -04:00
rusefillc 41804736e2 engine sniffer into unit tests 2021-04-04 22:41:38 -04:00
Andrey G fa840a7593
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
Andrey G bbe3291ccd
hip9011: get callback from spark on each cylinder (#2499)
* hip9011: get callback from spark on each cylinder

* hip9011: cleanup unused
2021-03-27 14:12:49 -04:00
Matthew Kennedy 4e3e95db2d
replace print/printMsg with scheduleMsg (#2497)
* start cleaning

* disabled feature means don't print that it's disabled

* cli

* usages

* printMsg -> scheduleMsg

* this is alllll dead now

* no crlf please

* all hope is lost if you manage to hit this line

* tests

* tests

* ok we did actually need that part

* sim

* d

* kinetis

* it did ifdef, not if

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-26 17:23:26 -04:00
Andrey G 89b631a794
Hip9011 and cleanups (#2477)
* hip9011: move hipCs out of EnginePins to hip9011 driver

* hip9011: cleanup debug output, save few RAM bytes

* Supress few signed vs unsigned warnings
2021-03-20 08:40:36 -04:00
Matthew Kennedy 650d148008
Usable fuel consumption data/gauges (#2474)
* fuel consumption

* gauge names

* consumers

* obd

* binary logging

* doesn't need explicit constructor

* getters

* it works

* correct for injections per cycle

* datalog

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-19 17:04:42 -04:00
Matthew Kennedy 3072d54717
dead code, warnings (#2461) 2021-03-15 10:23:19 -04:00
Matthew Kennedy 5067b81fce
Compute injection duration later in the pipeline (#2175)
* injector model, test

* new math

* inject fuel based on new math

* tests

* fix

* it should work like this

* format

* update TPS AE even when we're cutting fuel

* comment

* conversion factor

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-03 07:30:56 -05:00
Matthew Kennedy 3a8313a94a
try rpm calculator timer (#2053)
* add api

* rpm calculator

* fix fsio

* fix float

* remove wrong comment

* fix timer

* clang didn't like this

* oops

* format

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-02-28 18:56:34 -05:00
Matthew Kennedy 39884f8934
use DECLARE_ENGINE_PTR for Engine class (#2365)
* engine cleanup

* do the cleanup

* one last spot

* expand_engine noop for firmware

* simulator
2021-02-16 16:58:54 -05:00
Matthew Kennedy 4a1d3de9a6
remove unused msg parameter (#2360)
* dead parameter

* last few
2021-02-16 09:32:16 -05:00
rusefillc 2d99e77c95 M62T vanos support #2243 2021-02-08 21:50:31 -05:00
rusefi 6b10de5616 refactoring: naming consistency 2021-02-08 18:20:53 -05:00
Matthew Kennedy 93b034b8e9
Limp handles inj/ign disable (#2245)
* status loop just asks limp mgr

* put logic in limp manager

* don't need that function any more

* bye

* TIL these bits already exist in the configuration
2021-01-27 21:28:53 -05:00
Matthew Kennedy bdacda558c
fix instant rpm (#2180)
* consumers

* impl

* instant rpm in idle timing
2021-01-14 20:45:55 -05:00
Matthew Kennedy 2e557dbcf6
make fuel math look more like ign math (#2214) 2021-01-14 19:18:30 -05:00
Matthew Kennedy a5266cd6ef
part of 2217 which may fix it alone (#2220) 2021-01-11 08:01:54 -05:00
rusefillc 1cbb0c5680 Revert "Revert "rpm rate of change (#2159)""
This reverts commit 538b3ac6
2021-01-09 20:06:19 -05:00
rusefillc 538b3ac649 Revert "rpm rate of change (#2159)"
This reverts commit f73b7123

#2207 yes, this makes no sense but just to confirm
2021-01-09 19:45:07 -05:00
Andrey G 2af32084f4
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
Andrey G b92e3086d0
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 f73b7123bb
rpm rate of change (#2159)
* compute rpm rate of change

* fix units on gauge

* oops

* correct order

* scaling and limits

* correct for engine cycle length

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-01-03 09:55:44 -05:00
Matthew Kennedy ff4ce2fb1f
create limp manager (#2142)
* move rev limit to limp manager

* call fatal error

* include order

* fix bug

* tests

* comment

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-26 17:30:46 -05:00
rusefi 2fac4cd732 HW_CHECK_SPARK_FSIO 2020-12-26 16:16:40 -05:00
Matthew Kennedy 83a65032d6
clang warnings again (#2055)
* s

* changelog

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-11 13:59:28 -05:00
rusefi ac186d2b85 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
rusefillc 8deff87b4f refactoring 2020-12-08 21:33:59 -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 ffae0cd335
round rpm instead of truncating (#2023)
* round rpm instead of truncating

* efiround is expensive

* Revert "efiround is expensive"

This reverts commit e5690f89e1.

* round is better than rintf

* testing

* it works now?!

* comment

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-12-06 00:11:57 -05:00
rusefi 07a8e237a5 Merge remote-tracking branch 'origin/master' into master 2020-12-04 21:52:22 -05:00
rusefillc ba33a758e8 avoid float -> int64 conversion #1977
both cases have to be relatively small durations of time cherry picking...
2020-12-03 13:30:17 -05:00
rusefillc c36f76b68e Fuel pump should turn on at the first sign of engine rotation #1961 2020-12-02 23:09:39 -05:00
rusefi 8ee609fa3e Merge remote-tracking branch 'origin/master' into master 2020-11-29 12:51:04 -05:00
rusefillc ab8d6ff0df avoid float -> int64 conversion #1977
cherry picking...
2020-11-24 00:06:12 -05:00
rusefillc 9045470fc6 avoid float -> int64 conversion #1977
cherry picking...
2020-11-23 23:53:25 -05:00
Matthew Kennedy 55379463c0
remove (#1985) 2020-11-23 20:10:17 -05:00
rusefi b329cc66ed GDI Epic #1448 2020-11-23 01:10:12 -05:00
Matthew Kennedy f3b7a1d9da
Remove lockAnyContext, replace with CriticalSectionLocker (#1938)
* switch to CriticalSectionLocker

* that's just about all

* clean up last usage

* include hpp for sim

* need the cpp wrappers in the makefile too

* include dir

* include
2020-11-19 06:56:02 -05:00
Matthew Kennedy 2f4294ac4d
minor perf tweaks (#1946)
* only start PWM if needed

* put important stuff first

* use conversion

* this broke the logic
2020-11-16 00:06:11 -05:00
rusefillc 896a55d78e GDI Epic #1448 2020-11-09 22:53:23 -05:00
rusefillc 2293634ffa GDI Epic #1448 2020-11-09 22:33:48 -05:00
rusefillc 235fe9447b GDI Epic #1448 2020-11-09 22:21:38 -05:00
rusefillc 1eb5d7f927 refactoring: code duplication 2020-11-06 21:24:58 -05:00
rusefillc 111b017442 refactoring 2020-11-05 18:10:44 -05:00
rusefillc 01a0a8fff7 Output pin init/deinit needs a linked list #1803
one step back
2020-11-05 17:44:16 -05:00
rusefillc eae48cdda6 GDI Epic #1448 2020-11-05 16:42:56 -05:00
rusefillc fa58d75364 GDI Epic #1448 2020-11-05 16:34:25 -05:00
rusefillc a87c28a8ad dead legacy code - current implementation is definitely more correct 2020-10-17 18:46:07 -04:00
rusefillc b24f173892 refactoring: better method name 2020-10-17 18:45:08 -04:00
Matthew Kennedy 7eeb60a8a0
trigger/scheduler perf improvements (#1885)
* avoid 64b on hot path

* no tooth log when fast

* use crit section locker

* final

* only flip pins if not also self stim

* only trace if doing work

* slightly drop lateDelay

* trace if not bailing out
2020-10-16 11:04:27 -04:00
rusefillc 96a126d60f 60/2 perf grab #1850
unused parameter
2020-10-04 02:09:12 -04:00
rusefillc 030ec42ac7 60/2 perf grab #1850
a) removing more of stack validating - one validation within the deepest method would be enough

b) un-wrapping main callback loop for explicit order of execution
2020-10-04 01:43:02 -04:00
rusefillc 6b95579706 60/2 perf grab #1850 2020-10-04 01:26:29 -04:00
rusefillc c9d3d1f01a 60/2 perf grab #1850 2020-10-04 01:04:15 -04:00