* Bug fix - consistent #ifdef (ANALOG_ISR/ANALOG_ISR_MAP)
Also replace multiple #ifdefs with inline function.
* MISRA fixes for sensor.cpp
* Conditional compile to allow MAP sensor read pin even when using analog ISR
Useful for development testing
* Remove unused global variables
statuses::batADC
fpPrimed - duplicate of statuses::fpPrimed
injPrimed - duplicate of statuses::injPrimed
* Replace duplicate filter macros with one inline function: LOW_PASS_FILTER (which is MISRA compliant).
* Remove mapErrorCount - it's unused
(only ever written to, never read)
* Deduplicate MAP reading code
* Encapsulate MAP variables
* Add isEngineRunning() to capture duplicate code
* Make readBaro() independent of instanteneousMAPReading()
Removes a conditional and reduces module surafce area
* Use structs to capture the MAP algorithm state.
Also apply ATOMIC_BLOCK to prevent tearing of ISR modified variables.
* Force loop() inline
Reduces stack usage.
* Use 16-bit comparisons
* Remove validateMAP() - since we validate every sensor reading, it wasn't doing anything.
* Unit test engineIsRunning
* Apply SET_UNITY_FILENAME to K6A unit tests
* Unit test LOW_PASS_FILTER
* Unit test fastMap10Bit
* Reduce scope of MAP ADC variables - only used in sensors.cpp
* MAP: read the sensors in one place in the code & inject the values into the sampling algorithms
* MAP: encapsulate reset of state structures
* MAP: replace magic numbers wirth an enum
* MAP algorithms return a flag indicting whether they recomputed MAP/EMAP
* MAP sampling algorithms: push MAP value calculation up the call stack.
* Remove errors.* - it's never called an uses up RAM
* Unit Test: inject all MAP sampling algorithm dependencies
* Unit test MAP sampling algorithms
* Unit test validateFilterMapSensorReading
* Prevent torn reads during comparisons
* Don't skip readings on cycle/event boundaries
* 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.
* Add optimized 32-bit shifting
* Tooth based time to angle coversion is only used by a few decoders.
So move the functions into decoders.cpp
* Better separation of deocders and crank maths.
* Apply optimised shifts
* Doxygen
* Add udiv_32_16
* Apply udiv_32_16() where possible
* Convert udiv_32_16 to assembler
It's worth 20 loop/s
* Remove unused functions
* Remove degreesPeruSx2048 - unused
* Remove angleToTime - replace with direct calls
1. Drop angleToTime()
It's slow, only partially implemented and adds zero value
(and has MISRA violations)
2. Consistent function naming
3. Doxygen
* triggerPri_Nissan360 shouldn't set timePerDegree.
It will be overwritten every loop by doCrankSpeedCalcs()
* Use angleToTimeMicroSecPerDegree() instead of timePerDegree
No loss in performance
Increased injection open/close time accuracy (so unit test values must change)
Can remove timePerDegree global.
* Hide (encapsulate) crank math globals.
* Base all angle to time conversions on decoder computed variables.
This is within 2us of the revolution based method
and is much faster - which is essentially zero percent change.
* Performance: move calculation of degreesPeruSx32768
into decoders.
Remove doCrankSpeedCalcs() - it's doing nothing
at the moment.
* Apply libdivide to triggerSetEndTeeth functions.
Since triggerToothAngle is set once at initialization
time, we can generate the libdivide struct
once and reuse it many times.
* Remove lastToothCalcAdvance - unused
* Replace 16-bit division with shift
* Replace 32-bit divison with 16-bit division
* Avoid 32-bit division; use div100()
* inline percentage()
* Optimize div100()
* MISRA fixes
* Replace magic numbers with #defs
* Replace libdivide structs with inline constants
No perf or memory changes
* Use fixed types for PWM max count variables
* Accurate rounded integer division
* Formalise rounding behavior (DIV_ROUND_CORRECT)
* Apply DIV_ROUND_CORRECT to DIV_ROUND_CLOSEST(),
UDIV_ROUND_CLOSEST(), div100(), div360(),
percentage() & halfPercentage()
* Add, fix & improve unit tests
* Add udiv_32_16_closest()
* Perf: Limit percentage calculations to 16-bits
* MISRA fixes
* Add compare_executiontime() to encapsulate common perf testing code
* Signed to unsigned division
* Convert ignitionLimits() to an inline function.
Slight speed up, probably due to removing
multiple evaluations of macro arguments.
* Split unit tests up.
* udiv_32_16 - check for valid parameters
* Unit test fuel schedule initialisation
* Move initialisation tests to their own harness
Saves memory
* Rename test_misc to test_tables
* Rename test_misc2 to test_math
* Reduce memory usage
* Fill out remaining ignition init unit tests