Commit Graph

6 Commits

Author SHA1 Message Date
tx_haggis 96dce4429c
Unit test all corrections (#1207)
* Add unit tests for correctionCranking

* Unit test correctionASE

* Add test_maths_div10_s16_perf

* Make TPS AE tests independent

* Add test_corrections_MAE

* Use RUN_TEST_P to reduce test RAM usage

* Unit test correctionFloodClear

* Unit test battery correction

* Add unit tests for correctionLaunch

* Test repetability - initialiseAll at the start of every test

* Unit test flex & fuel temp corrections, plus minor cleanup

* Unit tests - avoid forward declarations

* Separate out populate_table() from 3D table tests

* Separate calculation of AFR target from correction (and unit test the calculation).
Separation of concerns and will make unit test AFR correction easier.

* Unit test correctionAFRClosedLoop

* Unit test correctionsFuel

* Add populate_2dtable_P test utility function

* Unit test all ignition corrections

* Add compile time buffer overflow check to RUN_TEST_P

* DFCO - test behavior not implementation

* Tweak tests to pass on Teensy 3.5

* Shrink unit test for faster build/upload/execute
We just need the 2D tables wired up, not the whole system initialized.
1. Factor out construct2dTables() from initialiseAll()
2. In the unit tests,  call construct2dTables() instead of initialiseAll()
Linker then does the heavy lifting of removing unused symbols

* Add test_correctionsDwell_uses_batvcorrection

* Use TEST_ASSERT_BIT_[HIGH_LOW] instead of TEST_ASSERT_[TRUE|FALSE]
Better failure messages, declares intent

* Igniton corrction test: expand assertions: make sure all corrections test both positive an negative advance values.

* Add AE test assertion: especially for MAE

* Add AE timeout unit tests

* Convert copy/paste 2D table construction code into shared functions

* Disbale knock unit tests until knock implementation is stable.
2024-07-30 14:35:20 +10:00
Josh Stewart fc536d15f0 Rename all ino files to cpp (Excluding speeduino.ino).
Confirmed this compiles OK in Arduino IDE 2.x
Frees up 8 bytes of RAM
2023-10-06 18:10:20 +11:00
Josh Stewart 9c3e993b53 Initial commit of new rolling rev limiter 2023-06-09 16:10:43 +10:00
Josh Stewart 2fc29ceef5 MISRA cleanup rule: misra-c2012-8.2 2022-11-06 09:43:29 +11:00
tx_haggis be0f2c69c7
Add table2d tests (#748)
* Improve native debug experience

* Add unit tests for table2d
2021-12-23 15:07:38 +11:00
tx_haggis 5ed9ec3ca9
Reduce 3d table memory usage (>500 bytes) (#662)
* Use table_row_iterator_t to adjust ignitionTable

* Separate 2d & 3d table code, abstract page to table iterator conversion.

This is just moving code around in preparation for future changes.

* Reduce table RAM (.bss) usage

Generate a separate type for each possible
3d axis & size combination.

This turns what was runtime information into
compile time data.

* Save 1 byte per table.

Use a flag value (INT16_MAX) instead of a separate boolean
flag

* File renaming

table_iterator -> table3d_iterator.h
table3d.h -> table3d_interpolate.h
table3d.cpp -> table3d_interpolate.cpp
table3d_types.h -> table3d.h

* Optimize page.cpp: reduce code clutter, maintain performance

* Reduce flash usage

* Encapsulate table metadata

* Performance - hoist if statement

* Replace function with macro

* Use a packed enum as a type identifier

Use a packed enum as a type identifier

Slimmer data types

* Use table iterators for random access to table
values and axis.

* Centralize write buffer check

* Encapsulate 16-bit reference concept

* Performance: make table iterators proper classes

This allows us to chain calls on temporaries - not possible
with regular function calls.

* Performance: encapsulate EEPROM update
& address increment

* Save flash - don't duplicate function

* Performance: directly invalidate table cache

* Separate out iterator reversal

* Separate out entity mapping & per-byte access

Much faster, smaller code footprint & easier to understand

* Code quality fixes

* Separate out axis metadata

* Doxygen comments

* Separate int16_ref into separate file

* Separate out table axies & values into separate types

No need for metadata types & more localised code.
E.g. creating iterators is now alongside the data over
which they iterate.

* Doxygen
2021-11-18 11:30:29 +11:00