Commit Graph

549 Commits

Author SHA1 Message Date
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
shadowm60 8d8e8ec260
Launch control - experimental (#1816)
* Update tachometer.cpp

Initial implementation of E30 M3 Tach output solution #907, unit_test plus debugging next

* tacho unit tests

First successfull unit test for tachometer

* RAM adjustment so it would link

* refactoring tacho, broken!

* starting to make some progress...still fails after a few seconds

* Rework with SW PWM

* Update after code review

* unit_test update

* First working unit_test

* Update .gitignore

* Update engine_controller.cpp

* Update engine_controller.cpp

* Update tachometer.h

* Update test_tacho.cpp

* Switched UART DMA on

* Revert "Switched UART DMA on"

This reverts commit 4a23974c43.

* enable launch control

make use of already existent code + integration

* Delete compile_frankenso_all.sh

remove it since it is not part of the project

* Update main_trigger_callback.cpp

broke unit_Tests

Co-authored-by: rusefi <rusefi@users.noreply.github.com>
2020-09-22 16:25:27 -04:00
rusefi 96ec6ef9ac better QC procedure 2020-09-19 04:57:07 -04:00
rusefi 1657e499ce better QC procedure 2020-09-19 04:39:32 -04:00
Matthew Kennedy d2d0ffa1ee
remove tach output pin (#1779)
* remove from cfg

* cfg

* rip out impl

* efi gpio
2020-09-09 16:52:23 -04:00
rusefi 8f8d4eccaf Hellen says merge #1772 progress 2020-09-08 00:15:09 -04:00
rusefi 6b82191ab7 Hellen says merge #1772
where is implementation?
2020-09-07 15:54:31 -04:00
rusefi a1de082dcd Merge remote-tracking branch 'origin/Hellen_fork_point' into master
# Conflicts:
#	firmware/controllers/engine_cycle/rpm_calculator.cpp
2020-09-07 15:39:23 -04:00
rusefi 4819c86eaa Hellen says merge #1772 noise filter bugfix 2020-09-07 15:36:17 -04:00
Matthew Kennedy 95798a5246
fix broken master, inject engine ptr to rpmcalculator (#1759)
* fix

* oops
2020-09-05 18:49:42 -04:00
rusefi bc115e70a0 OBD CAN sensors #1733 2020-09-03 23:27:53 -04:00
rusefi eb46386c36 refactoring 2020-09-03 19:51:50 -04:00
rusefi ca21d5b4c2 refactoring 2020-09-03 19:29:15 -04:00
Matthew Kennedy 988d9b138c
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
Matthew Kennedy 1a55085bb6
Software knock detection (#1730)
* 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

* config enable switch
2020-08-28 21:13:50 -04:00
rusefi 540eef5e0d VVT support for VAG trigger #883 2020-08-25 00:59:07 -04:00
rusefi c32c8d715d A vague bug #1684 2020-08-08 20:57:42 -04:00
rusefi 1ba4dd0dcc A vague bug #1684 2020-08-08 20:36:16 -04:00
Matthew Kennedy 244378aba1 fix the problem 2020-07-31 14:41:42 -07:00
Matthew Kennedy bbe7ac43db misc 2020-07-29 02:29:55 -07:00
Matthew Kennedy 5b99fdf3df deprecate 2020-07-28 12:13:55 -07:00
Matthew Kennedy 626f55a08a refacto 2020-07-24 18:26:24 -07:00
Matthew Kennedy 131f4c4e8f Merge remote-tracking branch 'upstream/master' into reset-overlap 2020-07-20 18:43:17 -07:00
rusefi 48cc155144 changing crazy in composite logger 2020-07-20 21:20:58 -04:00
Matthew Kennedy dc05efef61 Merge remote-tracking branch 'upstream/master' into reset-overlap 2020-07-20 14:53:59 -07:00
rusefi c34a0d95d7 unit test framework improvements for smoother event execution 2020-07-20 17:13:33 -04:00
Matthew Kennedy 8b0d6a26cf Merge remote-tracking branch 'upstream/master' into reset-overlap 2020-07-20 13:27:51 -07:00
rusefillc d85e98d1f7
Merge pull request #1622 from mck1117/encapsulate-wwae
put wall wetting inside InjectionEvent
2020-07-20 14:19:57 -04:00
rusefi d52fb0b168 better unit test logging 2020-07-20 13:38:33 -04:00
Matthew Kennedy a7d0678092 Merge remote-tracking branch 'origin/master' into reset-overlap 2020-07-20 00:07:04 -07:00
Matthew Kennedy 46b7567195 put wall wetting inside 2020-07-20 00:04:05 -07:00
rusefi f37e739438 logicdata into unit tests 2020-07-19 22:03:30 -04:00
Matthew Kennedy 428f2fe247 Merge remote-tracking branch 'upstream/master' into reset-overlap 2020-07-19 13:52:45 -07:00
Matthew Kennedy 94635f9f33
encapsulate (#1617) 2020-07-19 16:46:28 -04:00
rusefi b7109fa09c better unit test logging 2020-07-19 16:05:19 -04:00
rusefi 49e9e08c65 better unit test logging 2020-07-19 15:47:21 -04:00
rusefi 222655517b better unit test logging 2020-07-19 15:25:49 -04:00
rusefi dd3a080d88 better unit test logging 2020-07-19 14:26:28 -04:00
rusefi fbfef8290c better unit test logging 2020-07-19 14:17:15 -04:00
rusefi 5a10e8adac better unit test logging 2020-07-19 14:13:15 -04:00
Matthew Kennedy 77294ae542 encapsulate overlap logic 2020-07-18 23:03:12 -07:00
Matthew Kennedy b7336e953e comments & improve logic 2020-07-16 23:55:41 -07:00
Matthew Kennedy b3261f25f3 add reset 2020-07-14 23:54:41 -07:00
rusefi 0b5bb7c0cf useFSIO6ForRevLimiter 2020-06-01 09:09:55 -04:00
Matthew Kennedy d24b5d5e93
Integrate stft (#1475)
* code changes

* missed a spot

* update UI

* gauge name

* adjust gauge scaling

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-05-31 16:59:05 -04:00
rusefi 5d75c36651 composite log for console 2020-05-26 00:07:18 -04:00
rusefi a4329169e9 better file name 2020-05-25 13:02:05 -04:00
Matthew Kennedy b11c5cd8c8
switch some firmware warnings to errors (#1465)
* warnings as errors

* throw instead of exit

* test massaging

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-05-23 10:46:28 -04:00
Matthew Kennedy 8dadb554c4
as suggested by the comment, this doesn't need a warning (#1464)
* the comment is correct

* format
2020-05-23 00:40:20 -04:00
Matthew Kennedy e46d9f0c99
Fix 100% duty injection (#1431)
* skip turn-off for high duty

* mock executor injection

* test

* switch to hard cut

* test no longer relevant
2020-05-14 07:44:32 -04:00
rusefi 88bbbb6c33 VVT miata trying to crank with random phase #1278 2020-04-26 20:50:49 -04:00
Matthew Kennedy b28740c20e
MAP scheduling (#1352)
* map sched

* format

* guard test
2020-04-23 08:12:44 -04:00
rusefi 387643047f docs 2020-04-20 23:44:59 -04:00
rusefi 799bd8489f BUGFIX: console engine sniffer was not displaying TDC mark properly in cases of negative angles 2020-04-20 22:43:55 -04:00
rusefi a3202ca612 more butter more better 2020-04-19 20:57:01 -04:00
rusefi 43ba5e1936 multi-channel Tuner Studio tooth logger #1284
composite TDC mark not working?
2020-04-19 20:46:29 -04:00
Matthew Kennedy 4d24fdd57d
Fuel/ign correctino on new temp sensors (#1318)
* corrections

* test

* adv map

* tests

* cleanup

* lcd

* fsio

* unneeded

* more math

* last consumer

* cleanup

* fix kinetis
2020-04-18 18:45:30 -04:00
Matthew Kennedy ff867b9301
fix warnings (#1282)
* warnings

* don't need to template those
2020-04-12 09:39:14 -04:00
Matthew Kennedy 345bf61bd5
Goodbye, old TPS (#1266)
* clear out tps

* boost control

* aux valves

* launch, aux valves

* unused field
2020-04-05 19:33:33 -04:00
Matthew Kennedy 7d5df29fbd
yet more tps consumers (#1258)
* advance_map

* tests

* unneeded

* idle

* use driver intent instead

* and obd and lcd

* engine load

* ve lookup

* unused

* oops we needed that

* oops needed that too

* mocking

* test mocks

* oops

* helps to use the right sensor

* and cylinder cleanup

* fuel math

* typo

* old tests

* kill dead stuff

* cleanup

* more

* fix

* test

* s

* fix signature

* fix test

* comment

* priming pulse

* remove mock tps

* remove more dead

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-05 09:11:25 -04:00
Matthew Kennedy 8fd9842310
cleanup extern mess (#1237)
* cleanup

* move outside define
2020-03-29 19:06:03 -04:00
Matthew Kennedy a5d4d06868
Multispark implementation (#1192)
* multispark prototype

* only multispark if not cut

* typo

* do some reasonableish math

* consume cfg

* todo

* bad merge

* move math out of engine2.cpp

* engine state config

* consume generated

* use new

* hand generate

* doc, debugging

* debug channel names

* don't depend on rpmcalc

* safer, fix math

* tests

* default multispark config

* remove todo

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-03-26 01:49:36 -04:00
Matthew Kennedy 2c809e4475
Remove old monitoring timestamps (#1217)
* remove monitoring timestamps

* adv map

* fuel calc

* map avg

* printing

* spark logic

* hip 9011

* new traces

* s

* missed a few
2020-03-24 20:19:19 -04:00
rusefi 165160bb40 random header clean-up 2020-03-23 09:00:57 -04:00
Matthew Kennedy 4740f525ee
save some ram (#1211)
* remove dead stuff

* why store those pointers twice?
2020-03-22 19:06:29 -04:00
Matthew Kennedy 397907a06f
Support disabling most/all features (#1162)
* this flag did nothing

* guard features properly
2020-02-26 18:16:35 -05:00
Matthew Kennedy 6038dc203b
minor simplify spark (#1150)
* simplify

* rename
2020-02-21 19:35:11 -05:00
Matthew Kennedy 7682192c2b
Simplify fuel math again (#1117)
* return the scheduled time from scheduleByAngle

* simplify fueling math
2020-02-01 17:29:55 -05:00
rusefi d48a57d599 refactoring: extracting DEEP_IN_THE_PAST_SECONDS contant 2020-01-31 01:21:56 -05:00
rusefi 241d491625 trigger refactoring 2020-01-26 12:02:54 -05:00
Matthew Kennedy 103e51dd85 Inject timestamps for injection too (#1108)
* schedule by nt, not us

* inject timestamp
2020-01-20 00:12:18 -05:00
Matthew Kennedy ba0c48e0ac use NT_PER_SECOND instead of convert from microseconds (#1107)
* add NT_PER_SECOND

* missed a few

* inject tooth logger timestamp

* inject
2020-01-19 22:23:41 -05:00
rusefi bb217b01dd happy new year unification 2020-01-13 21:57:43 -05:00
Matthew Kennedy dd3ded37f4 injector logic simplification (#1095)
* simplify injector scheduling a little

* clearer logic

* comment
2020-01-11 10:26:20 +03:00
rusefi 67377abdea better method name 2020-01-10 23:45:01 -05:00
rusefi 03a48455ed fear he who sees dead code: 'overlappingScheduleOffTime' was never assigned so the whole logic around it is dead 2020-01-10 23:39:30 -05:00
rusefi b7951e1e70 Merge branch 'master' of https://github.com/rusefi/rusefi
# Conflicts:
#	firmware/controllers/engine_cycle/main_trigger_callback.cpp
2020-01-10 23:19:30 -05:00
rusefi 645f51a038 better method names 2020-01-10 23:17:58 -05:00
rusefi b022f431e2 better method name 2020-01-10 23:09:38 -05:00
Matthew Kennedy 68813cda65 Dedupe (#1094)
* deduplicate

* yeah, the compiler is smart enough
2020-01-11 06:29:42 +03:00
Matthew Kennedy e25a93415f Schedule sparks with scheduleByAngle (#1092)
* injection

* injectors

* add edge timestamp to ShaftPositionListener

* scheduleByAngle require edgeTimestamp

* schedule with nt not us

* fix all schedulers

* schedule spark based on edge timestamp

* aux valves too

* update comments

* schedule dwell with new stamp

* format
2020-01-11 00:01:54 +03:00
Matthew Kennedy a6a1335adb Require tooth reference time for scheduleByAngle (#1091)
* injection

* injectors

* add edge timestamp to ShaftPositionListener

* scheduleByAngle require edgeTimestamp

* schedule with nt not us

* oops, these were missing from this branch
2020-01-09 23:45:13 +03:00
rusefi b83a5310be happy new year 2020-01-08 00:02:40 -05:00
Matthew Kennedy 95a7a9a8e1 Strongly typed action constructor (#1087)
* strong typing

* maybe we needed that one
2020-01-07 18:10:31 -05:00
Matthew Kennedy 5c85d53e16 Pass action_s instead of callback/param (#1084)
* change action

* consumers

* fix test

* didn't mean to add those

* simplify

* fix simulator

* fix sim for real

* oy

* maybe this time the simulator will actually be fixed, for real

* don't rely on undefined behavior
2020-01-07 00:41:18 -05:00
rusefi cc466ad3ef de-coupling things a bit 2019-12-24 00:26:23 -05:00
rusefi 3494f6ff9f adding simplicity 2019-12-23 23:25:08 -05:00
rusefi 82f3972417 refactoring 2019-12-23 22:12:55 -05:00
rusefi cf0b12b203 refactoring 2019-12-23 21:58:06 -05:00
rusefi 537a95a9b4 removing legacy perf code 2019-12-23 21:56:16 -05:00
rusefi 0a7ec2cf59 Revert "couple of dead lines"
This reverts commit 831dbde5
2019-12-23 21:55:08 -05:00
rusefi 831dbde538 couple of dead lines 2019-12-23 21:44:38 -05:00
rusefi 84e732846b replacing probably unused engineSnifferHisto with new perf_trace 2019-12-23 20:22:17 -05:00
rusefi a338f28396 removing one dead line 2019-12-23 20:19:13 -05:00
rusefi fde9a449cf random refactoring: hopefully not changing byte size of any variables but clarifying/fixing type between ticks, US and MS 2019-12-21 21:11:09 -05:00
rusefi ff9383eea1 fixing build is my most favourite time! 2019-12-13 20:51:04 -05:00
rusefi 9403b2a8fc fixing build is my most favourite time! 2019-12-13 18:02:24 -05:00
rusefi af4f20551b getting rid of boardConfiguration / binary compatible change 2019-12-11 17:48:55 -05:00
rusefi 62481d7fe8 The Big Refactoring of 2019: folder structure #723 2019-12-08 13:21:35 -05:00
rusefi cf8c6e7eca The Big Refactoring of 2019: folder structure #723 2019-12-08 13:09:51 -05:00