* Fix Stepper idle cranking outputting half steps
* Add macros for stepper less and more air
---------
Co-authored-by: Josh Stewart <josh@noisymime.org>
* 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
* Fix problem of using an uninitialised variable when initialising the stepper
after power on.
* Fix faulty idle taper causing OLCL and CL stepper to get stuck in the cranking position.
Co-authored-by: Richard Metcalfe <richard@richmet.com>
* 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
* Flag unused parameters
* Fix compile warnings: abuse of static inline
Place functions in correct order & only forward
declare when necessary
* Suppress unused parameter warnings
Co-authored-by: Josh Stewart <josh@noisymime.org>
* Squashed commit of the following:
commit c73f316fa5bf8c929a8fef5736f4a40045ea992f
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Wed Nov 25 21:53:45 2020 +0100
cleanup and fix merge issues
commit 57f1e8c6c73bcfb699b18ac51a2ec646be822f55
Merge: 04478ca 131673d
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Wed Nov 25 18:59:58 2020 +0100
Merge branch 'Closedloop_idle_improvements' into ClosedLoopIdleImprovement
commit 131673dc60417cbc773b0763d2f93e917c83325f
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Sun Nov 22 21:54:03 2020 +0100
more fiddeling with idle control
commit e4406166cde91552027a0dfb7958d6894098f066
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Sun Nov 22 20:36:24 2020 +0100
More fiddeling with idle control
commit 45822003d41e021e3ed93e8e14ce05479ddfd17b
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Sat Nov 21 14:59:32 2020 +0100
fix initial value
commit ff8fadae7844bd8e5934ee0f311fbf5e0842ec29
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Thu Nov 19 23:14:14 2020 +0100
add TPS limit to prevent integeral windup.
commit 7683b2e65569787b1c94eae6f4847cdadd394402
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Thu Nov 19 22:40:53 2020 +0100
cleanup idle.h
commit da55ee9dbd76d65608bfb5b950bc948a498b9599
Author: Tjeerd <tjeerdie@users.noreply.github.com>
Date: Thu Nov 19 22:36:18 2020 +0100
Further improvement simplifying code for closedloop PID control with feedforward.
make PWM output work
Tinkering new Idle control
working on closedloop idle
Initial work on improving closed loop Idle control
* reset platformio.ini
Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
Implement functionality to allow a defined output pin to toggle (normal or inverted) based on the idle up input pin.
Co-authored-by: Josh Stewart <josh@noisymime.org>
of an "inverted Y/N" setting. This is to avoid the need to change wiring
if it turns out the stepper is working in the opposite direction to what
is expected.