Commit Graph

3093 Commits

Author SHA1 Message Date
DeionSi e99a9e52f1
Remove unused temp sensor calibration option (#1005) 2023-03-14 11:43:21 +11:00
tx_haggis 0afffb2ca0
Unit test the schedule calculations (#1010)
* 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
2023-03-06 17:23:17 +11:00
Josh Stewart 311cae3fac Allow fuel staging up to 8 total fuel channels (All reasonable combinations) 2023-03-06 16:49:30 +11:00
Pasi Kemppainen 3411917180
Accurate RPM conversion for BMW CAN broadcast (#1012)
* Adjust RPM conversion.

Change the BMW can broadcast RPM conversion to accurate calculation.

* no signed ints

Whoopsie. Non of these are signed values.
2023-02-28 19:48:17 +11:00
Josh Stewart 560764e50b Fix for potential timing issue running dual wheel, sequential at cam speed 2023-02-28 15:02:07 +11:00
tx_haggis f95b4978cd
Refactor comms: save 130+ bytes RAM (#906)
* Remove serialCRC - only used within parseSerial()
Also hoist the CRC read into a function.

* Minimize global variable visibility

* Encapsulate write of multi-byte primitives

* Factor out sendBufferAndCrc()

* Push safety test into TS_CommandButtonsHandler()

* Extract writePage()

* Simpler parsing

* Remove some functions from public interface

* Store constant arrays in progmem

* Centralize high speed logger start/stop code

* Factor out loadO2Calibration()

* Factor out temperature calibration table update functions

* Remove dead code

* Fix sendToothLog()

* Fix sendCompositeLog()

* Replace tooth log send booleans with an enum
Saves a byte

* Remove sendBufferAndCrcProgMem()
Use serialPayload to send

* Whitespace clean up

* Optimize comms.cpp for size

* Replace global unsigned long with bool
Saves 2 bytes

* Replace 2 global bools with an enum
Saves a byte, reads better.

* Remove global FastCRC instance

* Make sendSerialReturnCode blocking.
It was using non-blocking functions but was never
re-entered.
Rename to make blocking & non-blocking calls
more obvious.

* Use one uint16_t to track RX/TX byte count

* Simplify new comms log tx API

* Extract loadPageToBuffer function

* All endianess changes use the same code

* Doxygen comments and code organization

* Remove serialWriteUpdateCrc() & updateTmpCalibration()

* Combine SerialStatus & logSendStatus enums.
Makes sense since we can only be doing one thing at a time.

* Remove global inProgressCompositeTime
Only used when sending composite log

* Replace 3 global bools with expanded SerialStatus enum

* Remove unused global tsCanId

* Limit scope of some comms globals.

* Remove isMap global - replace witth function

* Reduce the serial API to only 2 calls
transmit & receive

* Tidy up #define visibility

* Fix Black* build errors

* Workaround Teensy code race condition
availableForWrite() is not reliable.

* Prevent race condition
Was pematurely setting the serialStatusFlag to
SERIAL_INACTIVE before final CRC ws read from
serial.

* Use post write buffer availability checks
Remove buffer size check prior to writing.

* Write multi-byte values as single bytes.
(attempt to fix Teensy 3.5 issue)

* Only use Serial.available() as a boolean test
(Teensy fix)

* writeNonBlocking checks Serial.write() return value

* Non-blocking CRC write
In sendBufferAndCrcNonBlocking().

* Fix compile warning

* Set serial status flag prior to transmitting!

* Reliable blocking byte writes.

* Fix timeout code: not firing under some conditions

* MISRA fixes
2023-02-21 12:55:54 +11:00
tx_haggis 0e19fc86bc
Sync mode changes: fuel shouldn't impact ignition (#1009)
This would mess with a combo of sequential fuel
and wasted spark.
2023-02-20 09:15:13 +11:00
tx_haggis d7d44014bf
Correct the get3DTableValue() return type. (#1007)
The core interpolation function returns table3d_value_t
2023-02-14 07:43:45 +11:00
DeionSi 2312102d4b
Replace 8 channelXInjEnabled variables with 1 (#1001) 2023-02-06 11:48:11 +11:00
Josh Stewart 6f61bd3ee6 Allow staged fuel table mode to work with TPS load
Fixes #998
2023-02-03 10:16:57 +11:00
DeionSi 84cc382b17
Duplicate engine_constants dialog (#997) 2023-02-01 14:24:26 +11:00
DeionSi 1b52719caf
Make curGap3 variable local. It's only used in one trigger. Also remove unused curTime3 variable. (#980) 2023-01-30 15:32:09 +11:00
DeionSi b2a3fdd88d
Add Lambda options for EGO correction and Nitrous leanest AFR (#993)
* Added Lambda option for EGO correction. Same fields, just another way to view and set them.

* Added Lambda option for Nitrous Leanest AFR. Same field, just another way to view and set it.
2023-01-30 15:22:15 +11:00
DeionSi 41352d22bf
Add lambdaTable and memory map to afrTable (#988)
* Add and memory map lambdaTable to afrTable

* Remove extra lambdaTargetTables entry
2023-01-30 14:20:14 +11:00
DeionSi 9a03a91261
Use separate afrProtectDeviationLambda constant memory-mapped onto afrProtectDeviation (#989)
* Use separate afrProtectDeviationLambda constant memory-mapped onto afrProtectDeviation

* 3 decimal accuracy for Lambda

* Add default for afrProtectDeviationLambda
2023-01-30 14:18:52 +11:00
DeionSi 6df8162897
Scale AFR gauge warnings by stoichiometric ratio (#986) 2023-01-30 14:13:46 +11:00
wonder99 ee0818d982
Add Tacho Sweep function at startup (#935) 2023-01-11 14:27:16 +09:00
tx_haggis 3595634bd2
Table3D: MISRA fixes (#973) 2023-01-11 10:58:48 +09:00
Josh Stewart a311c37e31 Fix README badges
See https://github.com/badges/shields/issues/8671
2023-01-10 08:59:01 +09:00
Pasi Kemppainen 11313ba440
Fix decel in AE Add -mode (#971) 2023-01-10 08:46:34 +09:00
DeionSi fec50e9db7
Fix reset lock indicator for always on (#951) 2023-01-09 21:55:31 +09:00
DeionSi 3495877d0f
Tests failing due to out of memory and uninitialized variables (#979)
* Free up memory for tests_misc

* Tests failed by uninitialised variables
2023-01-09 06:53:45 +09:00
tx_haggis efccfed057
Install dos2unix (#974) 2023-01-05 00:28:21 +09:00
tx_haggis 8888e06e7f
MISRA check: add XML output (#967)
* MISRA check: add XML output

* Improve handling of cppcheck output

* Simplify - make cppcheck do more work
Now need for the script to gather source files
and run them one at a time, or flatten xml etc.

* Define the byte type - flushes out violations.

* Precaution: apply dos2unix before invoking shell script

* Restore force rename of libdivide folder
Scans on Windows Git Bash were taking way too long.

* Performance: run as many cppcheck jobs as possible
Logical CPU count - 1

* Set the build dir
Prevents temp files being left in the source tree
2023-01-01 10:25:59 +09:00
Josh Stewart b30fde5685 Fix unit tests following #939 2022-12-14 11:25:54 +00:00
Jon Billings 8e4b840325
stuck ego fix (#942)
Ego control gets stuck at 100% when ignitionCount wraps during an DFCO event because the test "if (ignitionCount < AFRnextCycle).." continues to fail until ignitionCount catches up with AFRnextCycle again - long time.
This fix also checks for ignitionCount < (AFRnextCycle - configPage6.egoCount)
2022-12-14 12:03:53 +11:00
Pasi Kemppainen f59d013714
Add deceleration enleanment feature (#939)
* Add decel enleanment feature

* Fix tps and map DOT scaling in TS.

* updates.ino

* Small bug fix.

* One more small bug fix.

* Update cancomms.ino

Cast tps/mapDOT as uint8 to cancomms to retain backwards compatibility

* Fix programmable outputs list.

* Fix programmable outputs in updates.ino

* Add abs around currentStatus.mapDOT
2022-12-14 11:17:47 +11:00
Pasi Kemppainen eb97b8458c
Add parameters to require power cycle (#940) 2022-11-30 15:19:01 +11:00
DeionSi 647681767e
Scale IAT and CLT calibration to ADC 1023 instead of 992 (#959) 2022-11-30 15:16:49 +11:00
Josh Stewart 03d09e91d3
Update README.md 2022-11-24 10:25:18 +11:00
Josh Stewart 22d2b4e38e Add delay to oil pressure engine protection 2022-11-23 16:15:01 +11:00
Josh Stewart 461e632db7 Allow use of RPM2 pin as VSS input with missing tooth 2022-11-22 16:46:32 +11:00
Josh Stewart 4693cb2013 Change to single decoder state variable. Small (12 byte) RAM free up 2022-11-22 15:53:35 +11:00
rafolg 86319f43ca
Update decoders.ino (#944)
Fix an issue where negative trigger angles cause erroneous crankAngles for ignition by tooth.
2022-11-14 10:52:21 +11:00
dependabot[bot] 1f03a7b25e
Bump actions/cache from 2 to 3 (#964)
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 10:46:19 +11:00
tx_haggis 56ab7c054d
Table 3d: change X-axis orientation to match Y-axis (#771)
* Change X axis in memory orientation to match Y

* X & Y axes can use the same type (Ie.e class)

* Table3D axis iterator: replace reverse() with rbegin()

* Use iterators as part of unit tests

* Doxygen fixes/corrections
2022-11-14 10:26:14 +11:00
Josh Stewart a71dcffe9f Small memory reduction in AE code 2022-11-07 14:49:49 +11:00
tx_haggis ad7d4f6ae9
Fix Miata 99-05 new ignition mode conditional (#918)
It was being applied when the trigger angle==0 regardless
of the perToothIgn ignition flag: replace || with &&.
2022-11-07 13:54:36 +11:00
Vitor Moreno B. Sales 8e2fb0b36e
Added possibility to configure Steper bounds (#930)
Previous bounding worked only for PWM
2022-11-07 13:52:04 +11:00
Josh Stewart be58be3b18 Add missing pin defaults for v0.3 board 2022-11-07 12:12:31 +11:00
Josh Stewart 2fc29ceef5 MISRA cleanup rule: misra-c2012-8.2 2022-11-06 09:43:29 +11:00
DeionSi a1d3c59af7
Lower max on IAT and CLT gauges for celsius (#958)
* Lower max on IAT and CLT gauges

* CLT, IAT and FuelTemp gauges to max 120c/248f
2022-11-04 12:36:10 +11:00
dependabot[bot] 7062f5381d
Bump actions/checkout from 2 to 3 (#947)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 12:03:15 +11:00
Piotr Rogowski 6b98ebbaaf
Add upload INI action (#962)
* Add upload INI action

* Run only when INI changes
2022-11-04 10:39:45 +11:00
Piotr Rogowski 9affde119e
Fix INI validation (#952) 2022-10-24 09:20:39 +11:00
dependabot[bot] 4da699bb39
Bump schneegans/dynamic-badges-action from 1.4.0 to 1.6.0 (#950)
Bumps [schneegans/dynamic-badges-action](https://github.com/schneegans/dynamic-badges-action) from 1.4.0 to 1.6.0.
- [Release notes](https://github.com/schneegans/dynamic-badges-action/releases)
- [Changelog](https://github.com/Schneegans/dynamic-badges-action/blob/master/changelog.md)
- [Commits](https://github.com/schneegans/dynamic-badges-action/compare/v1.4.0...v1.6.0)

---
updated-dependencies:
- dependency-name: schneegans/dynamic-badges-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-20 13:56:39 +11:00
Josh Stewart 2269e688f3 Lower SPI EEPROM write frequency 2022-10-19 12:19:52 +11:00
dependabot[bot] 2f77ce0303
Bump actions/setup-python from 2 to 4 (#949)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 10:42:56 +11:00
Piotr Rogowski 5b9f66a8d6
Add `dependabot` (#946) 2022-10-19 10:38:57 +11:00
Josh Stewart eb5ed8e460 Fix syntax error in ini 2022-10-18 11:25:27 +00:00