* 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
* calculateInjector1Timeout proxies calculateInjectorNTimeout
Unit test still pass.
* Remove calculateInjector1Timeout,
Replace with call to calculateInjectorTimeout
All unit tests still pass.
* Remove unecassary unit test
* calculateIgnition1Timeout proxies calculateIgnitionNTimeout
Unit test all pass
* Remove calculateIgnition1Timeout,
Replace with call to calculateIgnitionTimeout
All unit tests still pass.
* Remove unecassary unit test
* calculateIgnitionAngle\d proxies
calculateIgnitionAngle
Unit tests all pass
* Remove calculateIgnitionAngle\d
Just call calculateIgnitionAngle() directly
* Route rotary ignition angle calcs
through generic calculateIgnitionTrailingRotary
function.
* Remove calculateIgnitionAngle\d
Just call calculateIgnitionTrailingRotary() directly
* calculateInjectorStartAngle: inject all parameters
Do not rely on global state
Easier unit testing.
* calculateIgnitionAngle: inject all parameters
Do not rely on global state
Easier unit testing.
* Pull all ignition global vars into schedule_calcs
* Conditional compile for schedule calc vars
Saves memory
* Optimize: break out angleToTimeIntervalRev
from angleToTime. The new function will
always be inlined.
* Optimize - simpler code path
when no channel offset (zero)
Some optimization of arithmetic operations.
* Fix unit tests
* Fix bug on injector angle calculations
Need while loops to correctly bring intermediate
values into range
---------
Co-authored-by: Josh Stewart <josh@noisymime.org>
* Refactor: separate out schedule calcs from speeduino.ino
(so they can be unit tested)
* Add unit tests for compute_delay
* Use PROGMEM to store test input & output
* Add some 720 unit tests
* Rename unit test file
* Test ignition codepaths 2-8
* Test ign1 calcs
* Add first injector calc tests
* Add 720 deg tests
Simplify
* Simplify test_calc_inj1_timeout
* Claw back RAM
* Simplify test framework
Channel angle is part of the test data set.
* Move schedule calculation unit tests into their own harness
Competing for RAM with the rest of Speeduino
can cause them to fail,
* Performance: inline all schedule calcs.
* Unit test end angle
* Unit test calculateIgnitionAngle1
* Test start angles also
And test end angles for channel 1
* Unit test calculateIgnitionAngle3
* Unit test calculateIgnitionAngle4
* Improve unit test output
* Add Nissan360 decoder unit tests.
* Add Ford ST170 decoder unit tests
* Add NGC decoder unit tests