Go to file
tx_haggis 9bbd16c81b
Performance: optimize division (#1082)
* 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
2023-11-06 09:10:08 +11:00
.github Bump schneegans/dynamic-badges-action from 1.6.0 to 1.7.0 (#1121) 2023-10-19 22:45:48 +11:00
lib Move to PlatformIO for project layout 2017-02-06 20:56:46 +11:00
misra Fix command line for cppcheck v11 (#1099) 2023-09-18 15:39:20 +10:00
reference Fix misalignment of CAN address and start bytes 2023-11-03 15:23:55 +11:00
speeduino Performance: optimize division (#1082) 2023-11-06 09:10:08 +11:00
test Performance: optimize division (#1082) 2023-11-06 09:10:08 +11:00
.gitattributes Fix typo in gitattributes 2018-01-15 08:48:36 +11:00
.gitignore Add Microsoft temp files to gitignore 2021-07-06 20:32:18 +10:00
Doxyfile Refactor comms: save 130+ bytes RAM (#906) 2023-02-21 12:55:54 +11:00
LICENSE Add explicit license information 2015-05-29 09:49:44 +10:00
README.md 202311-dev signatures and updates file 2023-10-06 15:01:23 +11:00
contributing.md Update contributing file. Fixes #1004 2023-04-24 15:15:09 +10:00
platformio.ini Performance: optimize division (#1082) 2023-11-06 09:10:08 +11:00
post_extra_script.py Save 600+ bytes RAM (step 4 of 9) - deduplicate scheduler ISR functions (#1063) 2023-10-07 08:25:26 +11:00

README.md

Speeduino

Release License Build Status Unit Tests badge Sponsors GitHub commits https://img.shields.io/discord/879495735912071269

A low cost, DIY friendly Engine Management System (ECU) based on the Arduino framework

Speeduino

The Speeduino project is a flexible, fully featured Engine Management Systems (EMS aka ECU) based on the low cost and open source Arduino platform. It provides the hardware, firmware and software components that make up an engine management system, all provided under open licenses. With over 1000 installations, Speeduino has matured into a product that meets the needs of the hobbyist and enthusiast community without driving prices to the levels of traditional aftermarket ECUs.

Documentation

The Speeduino online manual can be found at: https://wiki.speeduino.com

Where to Buy

Pre-made Speeduino units/boards are available from a number of official resellers

These resellers all contribute a portion of sales back to the project to allow for continued development to take place and we encourage sales through them whenever possible.

Of course, being open source, you are free to use the design files provided here to create your own hardware!

Support

In addition the manual referenced above, Speeduino has a large and very vibrant community of people to help out with your setup or any questions you might add.

Contributors

This project exists thanks to all the people who contribute, both in terms of code and testing provided. If you'd like to get involved, please have a read through Contributing and then jump on Discord to discuss things further