* 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
* 19.09.2021
* Final testing of AC Control, some idle features fixed
AC control feature added, better than the existing idle-up feature (which can still be used for other things, e.g. electrical load detection). Air conditioning is locked out with coolant temp, RPM high/low, and high TPS. So the A/C automatically cuts out when driving hard.
Idle step now works correctly with closed loop PWM, open loop PWM, and closed+open loop PWM. Untested with stepper motor, but no reason it shouldn't work.
* Fixed mistakenly incremented page sizes
* Initial changes as per HWright9
-Renamed engineRunSeconds to acAfterEngineStartDelay
-Formatted large if statements better
-Fixed acStartDelay overflow bug
-Improved readability of logic
* Final fixes as per HWright9's feedback
-Add high/low RPM lockout delay, similar to the high TPM lockout delay
-General tidy-up
* Added stand-alone fan, moved config data in EEPROM
-Added additional configurable stand-alone A/C fan output, for when there is dedicated cooling fan for the A/C compressor. This is independent of the engine cooling fan logic.
-Moved config storage in EEPROM to configPage9, as noisymime's SD card logging has used the (previously unused) bytes I had used in configPage13.
-Minor bug fix - rename Aux in 1-16 to Aux in 0-15
* Revert to current master branch - as of master commit 97f8ef795a
* A/C Control Re-Integrated from AC-Control-Clean-3 (@Corey-Harding). Tested & ready to merge.
Additionally, added @HazuTo25's lines into the update() routine to configure default A/C settings.
* Changed updates.ino to just set A/C to disabled
* Fix change reverted by mistake - master merge commit 73badbce8c
* Fix remaining mistakes from previous master merge
* Remove test statements left in by mistake
* define unusedBits
* Remove test statements left in by mistake
* Increase timing granularity to 0.1s
* idleUpRPMAdder
* Remove another line put in by mistake by auto merge
* idleUpRPMFixes
* Update speeduino.ino
* Tweak A/C idle up descriptions
* Tweak A/C TS descriptors again
* Fixed alignment bug that turned page 15 config values into gobbledegook.
This had the symptom of the A/C request never triggering, because when a pin was assigned in TS (e.g. I did 27), a completely different pin would be read from config15 (in my case 22 - connecting the button to pin 22 would work in this case, even though TS was set to 27).
* Fix bit count - should be 6 to match ini file
* Increase minimum RPM lockout granularity
* Change granularity of A/C minimum RPM lockout to 10 RPM; Inline some functions for readability
* Add static inline function prototypes to auxiliaries.h as per the style guide.
* Fixed page 15 merge errors
* Style changes to suit new pinIsUsed() checks in setPinMappings()
* Add PWM Fan Control Minimum Clamp Value when A/C Compressor Engaged
* Fix comment
* Fix bug with stand-alone fan initialisation
Pin was unable to be used in prog. I/O even if fan was disabled, because it was always initialised as an output even if it was disabled. Fixed in this commit.
* Correction to Fahrenheit temperature scaling
* Move A/C updates to correct next release
Co-authored-by: shiznit304 <62686180+shiznit304@users.noreply.github.com>
Co-authored-by: Josh Stewart <josh@noisymime.org>
* EEPROM_MAX_WRITE_BLOCK can be local to writeConfig()
This saves a byte of memory ;-)
* Fix MISRA/lint warnings
Correctly cast address parameter of eeprom_read_block
Statically access table 3d type_key member
* Remove force burn code - unused
* Replace eepromWritesPending with bit set/check
* Refactor: chain write_location instances.
Clearer code.
* First try on updating closedloop boost control
* added eeprom updates for backward comp[atibility
* fix merge conflict
* Change updates to next release EEPROM version.
* Fix some issues after merging master
* some cleanup to minimize changes and speedup review
* cleanup updates
* chances on updates to alaign with new table format
* move LUT to new config page in eeprom
* little cleanup
* Update storage.h comments
* fix some ini warnings
Co-authored-by: Tjeerd <tjeerdie@users.noreply.github.com>
The tableCrcCommand is used by TS to determine what calibrations (IAT, CLT and O2) are currently on the board. This is an optional command, however v3.1.07 unintentionally assumed it was implemented on all boards and gave a 'null' error if the command was not present.
This adds the command for all future versions, but previous releases will need to wait for theTS fix release
* refactor: use a loop for writeAllConfig.
Future proofing: new pages will get automatically
written
* Call existing [read|store]EEPROMVersion functions
* Common function to compute CRC address
* Bulk write calibration tables
* Use EEPROM get/put instead of hand rolled code
* Typedef the EEPROM address
I.e. the EEPROM.read() parameter type
* Encapsulate eepromWritesPending
* Remove C++ namespaces
* Use table iterators for read/write
* Rename storage.ino to .cpp
This fixes a warning
* fix!: fix ODR violations
* refactor: move page specific code into a separate CPP file
* refactor: page getter/setter share mapping logic
Extract common page-to-entity mapping logic from
getPageValue() & setPageValue() - place in map_page_offset_to_entity()
and share.
* performance: optimize CRC calc
Calculate page CRC by iterating over entities & tables.
* CRC table calculation - use table iterator
* refactor: use iterators for sendPage()
Re-implement sendPage() using page & table iterators
Future proof & fast
* refactor: sendPageASCII()
Pull put shared code into functions.
Use table iterator
* refactor: use shared axis factor
This puts the axis factor usage in one place
* refactor: encapsulate page size & count
Added getPageCount() & getPageSize()
* Added static_assert for all pages.
* Remove C++ language elements
namesapces, scope resolution, enum struct
* Rename comms.ino to comms.cpp
Provides better encapsulation of non-global
data & functions.
INO files are all mashed together by some
custom process. So everything becomes global and
static functions/variables aren't really private to
the translation unit. Thus breaking encapsulation :-(
* Programmable outputs
* Prevent array overflow
* Show fullStatus variables names on dialog
* Further fixes
* Update with master
Co-authored-by: Josh Stewart <josh@noisymime.org>
* 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