Commit Graph

126 Commits

Author SHA1 Message Date
Matthew Kennedy fe77f5127e
12 tooth crank mode (#4179)
* 12 tooth crank

* comment

* s

* rusefi config
2022-05-17 21:38:24 -04:00
rusefillc 70e4d118ef very random progress 2022-04-16 17:04:35 -04:00
Scott Smith ba4a00d3bb
Drop SingleChannelStateSequence in favor of MultiChannelStateSequenceWithData (#3519)
* Drop SingleChannelStateSequence in favor of MultiChannelStateSequenceWithData

Most all the users were Multi* anyways, so just improve that:
1. Allow up to 8 waveforms to share one byte per timestamp.  It could be better but this is simple
   and gets most of the benefit.
2. Use a wrapper structure to handle reserving space for the arrays.  Makes the interface simpler
   and more rigid.  Also saves 4 bytes per Multi*.  Downside is access is now via -> and *,
   not . and (nothing).

Saves 224 bytes of BSS, 1832 bytes of RAM4/CCM, 952 bytes of TEXT, and 103 bytes of RODATA

* Instantiate a base_t to make debugging easier.
Also fixes crash on real firmware by using &m_base instead - LTO optimization issue?

* No magical templated StaticAlloc thingy.  Just virtual functions.
2021-11-21 04:56:07 -05:00
Scott Smith 823d9a07e0
Programmatically replace ENGINE() and CONFIG() with engine-> etc (#3565)
git grep -l -w ENGINE | xargs sed -i -r "s/ENGINE\(([]a-zA-Z_0-9.[]+)\)/engine->\1/g"

git grep -l -w CONFIG | xargs sed -i -r "s/([^a-zA-Z_])CONFIG\(([]a-zA-Z_0-9.[]+)\)/\1engineConfiguration->\2/g"
2021-11-17 03:54:21 -05:00
Matthew Kennedy 8cdac4cac0
remove engine pointer passing (#3556)
* some

* more

* more

* the last?!
2021-11-16 04:15:29 -05:00
Scott Smith 713083baa5
Convert TriggerWaveform::wave to a pointer in preparation for code-defined sequences. (#3528)
It will eventually be class to support dynamic universal patterns in addition to ROM-based
tables.
2021-11-11 13:19:25 -05:00
Scott Smith d4c4db9a12
Move phaseCount into MultiChannelStateSequence (#3520)
We can them drop the field from a bunch of callers, simplifying the code.
2021-11-10 19:47:27 -05:00
Scott Smith dac67235c4
Don't keep a separate MultiChannelStateSequence for the trigger emulator, version 2. (#3517)
All it wants is to use the main trigger state, so don't bother copying it.  Instead, change
PwmConfig to take a const pointer to a Multi.*Sequence, then make all the users adapt.  Worse
fallout is that SimplePwm now has its own Multi.*Sequence, but PwmConfig is downgraded to a
pointer, so that's only a net +4 bytes.  And we can make the overhead of Multi.*Sequence much lower
using embedded arrays, which only the caller can do since it knows the maximum size... (for another
day...)

Also remove SimplePwm's 2nd copy of SingleChannelStateSequence.  It served no purpose.

Saves 1992 bytes of BSS and 24 bytes of RAM4 (latter probably due to SimplePwm change)
2021-11-10 07:01:20 -05:00
rusefillc 1db9a02f1d Revert "Don't keep a separate MultiChannelStateSequence for the trigger emulator. (#3513)"
This reverts commit 280dfa94e7.
2021-11-09 20:42:23 -05:00
Scott Smith 280dfa94e7
Don't keep a separate MultiChannelStateSequence for the trigger emulator. (#3513)
All it wants is to use the main trigger state, so don't bother copying it.  Instead, change
PwmConfig to take a const pointer to a Multi.*Sequence, then make all the users adapt.  Worse
fallout is that SimplePwm now has its own Multi.*Sequence, but PwmConfig is downgraded to a
pointer, so that's only a net +4 bytes.  And we can make the overhead of Multi.*Sequence much lower
using embedded arrays, which only the caller can do since it knows the maximum size... (for another
day...)

Also remove SimplePwm's 2nd copy of SingleChannelStateSequence.  It served no purpose.

Saves 1992 bytes of BSS and 24 bytes of RAM4 (latter probably due to SimplePwm change)
2021-11-09 14:35:07 -05:00
rusefillc 1493973bea very old very dead code 2021-10-20 10:38:36 -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 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 cf2e2a6451 Nissan VVT trigger decoder #2887
that looks like one bug
2021-07-05 22:44:20 -04:00
Matthew Kennedy 5c60973dd8
Consolidate hwHandleShaftSignal (#2875)
* consolidate trigger input

* merge functions

* comment

* dead

* hw vs. not hw

* stray comma

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-06-28 10:06:22 -04:00
Andrey 82439b3ffd so many wonderful discoveries 2021-06-27 00:54:38 -04:00
Matthew Kennedy ce4eb2b55d
fix trigger changed logic (#2860)
* reenable

* fix

* longer interval between updates

* only deinit hard trigger outputs if necessary

* init logic

* init order

* warning

* guard

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-06-25 19:38:42 -04:00
Andrey 12067584e9 helping build? 2021-06-25 12:28:55 -04:00
Andrey 5e87b326f2 refactoring 2021-06-25 12:01:59 -04:00
Andrey 266e50f4ca Trigger: warning code on normal engine start up #669
making more code unit-testable
2021-06-25 11:50:23 -04:00
Andrey 66b091a5a5 Trigger: warning code on normal engine start up #669
making more code unit-testable
2021-06-25 11:30:06 -04:00
Andrey 0c97b4bc83 refactoring: reducing code duplication 2021-06-25 10:55:46 -04:00
rusefi 3c9f7174ba improving QC process 2021-04-23 00:45:36 -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 3072d54717
dead code, warnings (#2461) 2021-03-15 10:23:19 -04:00
Matthew Kennedy e0763c6994
stop trigger emulator PWM when disabled (#2443)
* simplify trig emulator

* spelling is hard

* fix various builds

* spelling again

* add command/button for external stimulation

* enable hw stim for HW-in-loop test

* s

* I does spelling good

* clear flag when disabled

* generate enough for console build

* don't disable that

* this test needs external stimulation enabled

* import

* ui improvements

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-03-11 08:38:52 -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
rusefillc 8fb32b517b Audi OEM 5-cyl trigger pattern aka "Tri-Tach" https://rusefi.com/forum/viewtopic.php?f=5&t=1912 2021-01-04 21:30:54 -05:00
Matthew Kennedy 6168bcea80
Fix gpio reinit race condition (#2098)
* fix unregister api for gpio

* consumers

* guard with a critical section

* index

* guard less

* unregister under lock

* fix reinit

* dead flag

* fix most tests

* initialize properly

* initialize properly

* assertions in tests

* fix message

* we must lock earlier to be truly safe

* this was using huge memory

* devirtualize
2020-12-18 17:18:12 -05:00
Matthew Kennedy ebc786bc94
init pins (#2095) 2020-12-18 01:30:17 -05:00
rusefillc 7bdd047955 basic hw in the loop - pwm self validation #2028 2020-12-08 05:30:12 -05:00
rusefillc 5cda628c8b basic hw in the loop - pwm self validation #2028 2020-12-08 05:07:03 -05:00
rusefillc 824f87c2d0 basic hw in the loop - pwm self validation #2028 2020-12-08 04:52:49 -05:00
rusefillc 9efd231915 minor fixes 2020-12-06 19:25:48 -05: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
Matthew Kennedy 5925a5f4bd
const ref-ify trigger (#1856)
* const ref-ify

* tests
2020-10-05 14:22:59 -04:00
rusefi b0ad2fcb29 better variable name 2020-08-25 01:07:32 -04:00
rusefi 5925ca5125 trigger and VSS hw integrated testing #1668 2020-08-08 11:45:02 -04:00
rusefi 1b84406e77 dead code 2020-04-26 17:40:12 -04:00
Matthew Kennedy a8f466c615
trigger emulator refactoring (#1358)
* trigger gen refactoring

* missed one

* fix makefile

* commentary

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-24 14:00:06 -04:00
Matthew Kennedy 1bad5f3047
don't store self stim in config (#1356)
* kill

* add bench test

* fix
2020-04-23 22:38:14 -04:00
Matthew Kennedy 8fd9842310
cleanup extern mess (#1237)
* cleanup

* move outside define
2020-03-29 19:06:03 -04:00
rusefi bb217b01dd happy new year unification 2020-01-13 21:57:43 -05:00
Matthew Kennedy 851c6041b1 Inject timestamps in to hwHandleShaftSignal (#1090)
* injection

* injectors
2020-01-09 21:19:11 +03:00
rusefi 6ca549ca34 refactoring & fixing build 2019-12-21 20:43:11 -05:00
rusefi af4f20551b getting rid of boardConfiguration / binary compatible change 2019-12-11 17:48:55 -05:00
rusefi c5cfd21a70 just a trivial massive rename: TriggerState > TriggerWaveform 2019-12-08 01:09:39 -05:00
rusefi 5055797f6b The Big Refactoring of 2019: folder structure #723 2019-12-04 01:15:52 -05:00
rusefi 813b6aa6ce The Big Refactoring of 2019: folder structure #723 2019-12-04 01:11:10 -05:00