* 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
* Moved STM32 definitions from globals to board file
Moved definitions from globals.h
Removed old STM32 generic library as this is very old and unused for almost 5 years.
* Remove old stm32_generic build environment from platformio.ini
---------
Co-authored-by: Josh Stewart <josh@noisymime.org>
* Add missing forward declarations
Found while compiling teensy35 unit tests
* Unit test should not rely on EEPROM
* Fix bad lib_dep
Teensy35 #includes FlexCAN_4 headers
* Fix circular include
logger.h needs FPU_MAX_SIZE which is defined
in globals.h. Globals.h includes logger.h!
* Ambguity in integer typedefs
* Push libdivide #def into build flags
* Allow build without USE_LIBDIVIDE
* Rename libdivide folder before & after scan
It's the only way to really exclude it
* Bi-linear interpolation - round towards nearest integer
Add the equivalent of 0.5 to the final calculation pre-rounding.
This will have the effect of rounding to the nearest integer, rather
than truncating. I.e. rounding down
* Unit tests: isolate table tests and check interpolation x/y bins
* Unit tests: add native table3d tests
* Unit tests: derive min/max from axis test values
* Unit tests: more detailed messages
* Unit tests: fix rounding & unit tests
* Performance
* Performance: use uint16_t instead of unsigned long
for the fixed point math: we only need the fractional
part. I.e. 1.16 not 16.16
* Use narrowest possible type
* Optimise bin position logic for performance
* Only promote to uint32_t when really required.
* Simplify bin checks - no zero width bins
* Save memory: use a single byte for the last bin caches
* Performance: increment pointers instead of
repeatedly dereferncing array by index.
* Comments
* Incorrect array underrun logic
* Rename type, comments
* Fix unit tests
* STM32 fixes and tweaks
Removed generic STM32F103 options from PlatformIO
Added optional serial compilations on PlatforIO
Make sure all timers are stoped at boot
Small speed improve at SPIasEEPROM
Added timers usage table to board_stm32_official.h
* Added base board
* fix building for STM32F401CC and general macro cleanup
* Now building for all generic STM32F4x7 boards in arduino IDE is ok.
* buildflag cleanup
Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
* Fix building for FRAM with globals.h setting
On request of vitor boss. A lot has been changed around to make the selection of EEPROM emulation type from the globals.h (including FRAM selection)
* Add support for EEPROM emulation on internal flash of STM32F7
* Updates on SPI Flash EEPROM
* Fix building for BACKUPSRAM as EEPROM.
* Add put() and get() functions to the EEPROM emulation. This is needed for the latest terminstor and other calibrations routines
Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
* Added new Flash EEPROM emulation
# Conflicts:
# platformio.ini
# speeduino/board_stm32_official.ino
# speeduino/init.ino
# speeduino/src/SPIAsEEPROM/SPIAsEEPROM.cpp
# speeduino/src/SPIAsEEPROM/SPIAsEEPROM.h
* changes to storage to make SPI flash work again
* cleanup
* fix building with spi flash as config storage
* Fixing build with spi flash as EEPROM. Changed some pin numbers to match the board i am designing and testing now.
* Now cs pin for spi eeprom is settable by flag in build enviroment.
* Correct overflow for 32bit timers
* fix pins PA0-PA5 on some f407 boards
* Enable access to SRAM Backup domain at boot
* Add missing callback functions
* Change timer resolutions. Corrects idle/aux timer frequencies
* 32 bit overflow only for STM32F4
* Update platformio.ini
debug tool added as default
* fix building with spi flash as config storage
* Fixing build with spi flash as EEPROM. Changed some pin numbers to match the board i am designing and testing now.
* Now cs pin for spi eeprom is settable by flag in build enviroment.
* Update platformio.ini
debug tool added as default
* Update cancomms.ino
Removed CAN build on black_F407VE for now. It needs fixing the build fails otherwise.
Co-authored-by: hoogendijkta <tjeerdie@users.noreply.github.com>
Co-authored-by: iLeeeZi <ilari.vehniainen@hotmail.fi>
* fix to serial0 and serial3 when offset is 0 uses wrong command
* fix to serial0 and serial3 when offset is 0 uses wrong command
* fix hex num
* add teensy canbus library
teensy can read and write functions enabled
* update to teensyduino 1.49
* part 1 prepare structure for obd can port works
rename old can_command() to secondarySerial_command() for secondary serial and create new can_command for real CAN instruction decode.
fix masking for teensy 3x and 4
* set mega as default build
Co-authored-by: Josh Stewart <josh@noisymime.org>
add temp test file to gitignore
improve schedule testing
add check for schedule delays and pending variants
move time sampling to callback methods
add comments and improve pending tests