Commit Graph

42 Commits

Author SHA1 Message Date
rusefillc a9af65a0a8 only:better code placement, zero logic changes 2023-06-14 23:37:51 -04:00
rusefillc 3c09d6b28e only:todo Timer 2023-06-13 21:33:28 -04:00
rusefillc 44ed1c2fba only:dead line 2023-06-13 21:31:48 -04:00
rusefillc ba73aff1fa startStopStateToggleCounter to live data 2022-10-06 22:21:02 -04:00
Andrey G 91d4844e38
time routines refactor (#4563)
* Extract time helpers from engine_controller_misc to efitime.cpp

* Rename currentTimeMillis() to getTimeNowMs()

We have getTimeNowNt(), getTimeNowUs(), currentTimeMillis() and getTimeNowSeconds()
Align a bit.

find . -type f -name '*.c*' -exec sed -i 's/currentTimeMillis/getTimeNowMs/g' {} \;

* Rename getTimeNowSeconds() to getTimeNowS()

To align with Nt, Us, Ms versions.

* Some comments about getTimeNowLowerNt()
2022-09-11 13:06:03 -04:00
Andrey ab4b451195 os_access.h dead? 2022-09-07 15:56:45 -04:00
Matthew Kennedy d8073e8b27
remove mock adc (#3888)
* remove mock adc

* do these do /anything/?
2022-02-03 20:43:34 -05:00
rusefillc 4db4ac060c Code style for methods with zero arguments #3535 2022-01-11 22:40:52 -05:00
Andrey e72d57438a MAP phase sensing #3544
new implementation
2021-12-07 20:00:04 -05:00
rusefillc abc76689e4 remaining mock ADC fix #3672
docs
2021-12-07 19:45:02 -05:00
rusefillc 18be72968a Revert "dead code?"
This reverts commit b771082419.
2021-12-07 19:44:00 -05:00
rusefillc b771082419 dead code? 2021-12-07 19:33:19 -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 13c496b79b
Make getTimeNowNt even faster (#3504)
The last version is already much better than the original, mostly because it doesn't call
CriticalSectionLocker, which has a ton of overhead due to debug tracking.  But this version is
another 4 instructions / 12 bytes shorter.  Does as much match in 32-bit land as possible, and
avoids math operations that span 64-bits (i.e. either operate on the lower half or upper half, but
not both).  The result is only 3 instructions not including the necessary 4 loads (ptr to now, now,
ptr to upper, upper), 1 store (upper), and 1 return/branch.
2021-11-08 14:24:31 -05:00
Scott Smith d4132fdf01
Change getTimeNowNt to be lock free. (#3502)
Track the top two bits of the 32-bit time field, along with the bits that comprise the top half of
the 64-bit time field.  We can detect when the 32-bit field is advancing or falling back from the
global time counter as long as the change is less than about 1 billion ticks.  This shows up as
either 01 or 11 in the top 2 bits of the 32-bit time field relative to the 64-bit field.  Or is
there is no change it shows up as 00.  Changes of 2 billion or more cannot be discerned as +2
billion and -2 billion both show up as 10.

Change the simulator to use this logic to make sure it gets some exercise.
2021-11-08 08:24:20 -05:00
Matthew Kennedy 114109bd83
dead mock iat/clt (#3293)
Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-10-01 09:20:08 -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
Matthew Kennedy 43e6cef77d
more graceful chibios assertion failure (#2859)
* no custom assert hook

* dead

* setjmp/longjmp

* always call tid hook

* tests get threadid

* simulator threadid

* kick

* stubs for kinetis

* make it happier

* noreturn

* oops

* comments

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-07-05 18:18:58 -04:00
Matthew Kennedy bbb6b6dd14
remove simple cases of LoggingWithStorage (#2569)
* remove simple cases

* more simple

* serial

* s

* more

* try memory

* easy

* mmc acc

* that's how much memory

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2021-04-19 08:11:59 -04:00
Matthew Kennedy 3d17e62d65
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 690ab7e917
gpio unit tests (#2099)
* 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

* move gpio mocking

* test gpios

* we must lock earlier to be truly safe

* this was using huge memory

* devirtualize

* test deinit
2020-12-18 17:19:02 -05:00
Matthew Kennedy 5f69d23976
fix mock pins array (#2050)
* fix

* fix probably
2020-12-10 00:10:58 -05:00
Matthew Kennedy 922f0249d2
squash warnings (#1984)
* warnings

* unused

* a few more

* too much

* uint16_t-ify
2020-11-23 09:43:16 -05:00
rusefillc 68c8d8c6a2 Starter is engaged on start-up in pull-up configuration #1969
usability & test improvement
2020-11-19 17:15:28 -05:00
rusefillc 47fbb92bff Starter seems to be engaged forever fix #1965 2020-11-18 23:54:30 -05:00
rusefillc a9e0bffbbd Starter seems to be engaged forever #1965 2020-11-18 22:47:40 -05:00
rusefillc ce202c7ed7 Starter seems to be engaged forever #1965 2020-11-18 21:08:01 -05:00
rusefillc 88a0b56cba Starter seems to be engaged forever #1965 2020-11-18 20:48:52 -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
Matthew Kennedy 2083b34cf9
simplify getTimeNowNt() (#1876)
* remove old impl

* add cpp wrapper to os_access

* clean up os_access

* remove touchTimeCounter

* new impl

* put comment about lock free impl

* include cpp wrappers for BL

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-10-15 08:57:13 -04:00
David Holdeman 337106cd24
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
David Holdeman f5d9263ad1
switch start/stop to ButtonDebounce (#1777) 2020-09-09 08:22:15 +01:00
Matthew Kennedy 95798a5246
fix broken master, inject engine ptr to rpmcalculator (#1759)
* fix

* oops
2020-09-05 18:49:42 -04:00
Matthew Kennedy 1f16228bdb
Perf Trace Improvements (#1383)
* add tid field to thread

* change perf trace format

* trace consumers

* Update java parsing

* guard for test + kinetis

* stubs

* ram

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-29 10:53:35 -04:00
Matthew Kennedy 6ce9ae4481
move hooks in to common chconf.h (#1376)
* move hooks in to common

* but not for kinetis

* don't use c style void arg

* kinetis needed more, not less

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
2020-04-27 16:07:05 -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
rusefi cd3ef56b55 Merge branch 'master' of https://github.com/rusefi/rusefi 2020-04-01 20:26:00 -04:00
rusefi 63246269c7 start/stop works now 2020-04-01 20:25:44 -04:00
Matthew Kennedy 50cd6549a2
Fully switch acc pedal to new sensors (#1212)
* proxy sensor

* header

* idle

* can

* settings

* remove old mocking

* remove old impl

* etb

* oops, gotta actually register it

* fix test

* structured bindings ftw!

* driver intent for stepper

* tear out old

* oops too much
2020-04-01 20:21:03 -04:00
rusefi 66ec0fdea6 moving a bit of crazy aside 2020-03-23 00:01:59 -04:00