Commit Graph

1449 Commits

Author SHA1 Message Date
Josh Stewart 572d1b274b Remove missing tooth 1 tooth margin for low res (<=12 tooth) wheels on per tooth ign mode 2023-07-03 13:25:04 +10:00
Josh Stewart 4a18cb3ec5 Fixes for missing tooth decoder with 2 stroke sequential 2023-07-03 13:23:49 +10:00
Josh Stewart adee2bcc7f Prevent lockup if 36-2-1 (4B11) pattern is selected 2023-06-29 12:19:23 +10:00
Josh Stewart a1ae3db072 Fix for incorrect bracket in last commit 2023-06-26 16:17:59 +10:00
Josh Stewart 624d255123 Standardise all the fuel schedule setting channel calls 2023-06-26 15:52:02 +10:00
tx_haggis d9b5554a8c
Save 600+ bytes RAM (step 3 of 9) - remove per-channel schedule calculation functions, use generic equivalents instead (#1018)
* calculateInjector1Timeout proxies calculateInjectorNTimeout
Unit test still pass.

* Remove calculateInjector1Timeout,
Replace with call to calculateInjectorTimeout
All unit tests still pass.

* Remove unecassary unit test

* calculateIgnition1Timeout proxies calculateIgnitionNTimeout
Unit test all pass

* Remove calculateIgnition1Timeout,
Replace with call to calculateIgnitionTimeout
All unit tests still pass.

* Remove unecassary unit test

* calculateIgnitionAngle\d proxies
calculateIgnitionAngle
Unit tests all pass

* Remove calculateIgnitionAngle\d
Just call calculateIgnitionAngle() directly

* Route rotary ignition angle calcs
through generic calculateIgnitionTrailingRotary
function.

* Remove calculateIgnitionAngle\d
Just call calculateIgnitionTrailingRotary() directly

* calculateInjectorStartAngle: inject all parameters
Do not rely on global state
Easier unit testing.

* calculateIgnitionAngle: inject all parameters
Do not rely on global state
Easier unit testing.

* Pull all ignition global vars into schedule_calcs

* Conditional compile for schedule calc vars
Saves memory

* Optimize: break out angleToTimeIntervalRev
from angleToTime. The new function will
always be inlined.

* Optimize - simpler code path
when no channel offset (zero)

Some optimization of arithmetic operations.

* Fix unit tests

* Fix bug on injector angle calculations
Need while loops to correctly bring intermediate
values into range

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-06-26 12:13:53 +10:00
Josh Stewart e44f4c7b54 Fix issue where staging fuel channels would be active even when not required 2023-06-26 10:46:11 +10:00
vaiski fcb78b2e9f
Small fix so that vvt2PID get updated in a correct frequency. (#1060) 2023-06-19 18:33:26 +10:00
Josh Stewart 46a7c6fda5 Fix for O2 calibration not being written to EEPROM 2023-06-13 16:37:21 +10:00
Josh Stewart 9c3e993b53 Initial commit of new rolling rev limiter 2023-06-09 16:10:43 +10:00
Josh Stewart 6c6cd9488d Add updates section for 202306-dev 2023-06-05 16:41:59 +10:00
Josh Stewart fed32686a5 Dev signatures for 202306-dev 2023-05-28 00:11:29 +10:00
Josh Stewart dd41ae5f27 Signatures for 202305 release 2023-05-26 17:00:51 +10:00
Teemo Vaas 03f82ae8f0
HalfsyncToFullSync update (#1052)
Fix against possible condition that when fuel closeInjector assignments are changed, some injectors could remain open.
To prevent this, check was added to ensure that no fuel injection is ongoing when switching is done from halfsync to fullsync.
2023-05-26 14:59:04 +10:00
Josh Stewart ca4204234a Working SD logging on T4.1 2023-05-24 15:21:29 +10:00
Josh Stewart 85184deba3 Don't turn off DRV8825 ENABLE pin between steps, only when target is reached 2023-05-22 14:24:52 +10:00
Josh Stewart 1502b6ff88
Dwell error correction (#1049)
* Initial work on dwell error correction

* Fix error message in TS

* Add averaging to schedules 5-8

* Cleanup warning

* Final cleanup and comments
2023-05-22 13:37:40 +10:00
Vitor Moreno B. Sales 72dd807fb3
Consistent MAP readings for all platforms (#619)
* Added a 1000Hz call for MAP reading on ARM cores

* Use 1kHz section for map reads on all MCUs

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-05-19 10:24:56 +10:00
Josh Stewart a9481ca74b Cleanup some ini defaults and power cycle requirements 2023-05-19 09:29:12 +10:00
Josh Stewart d9edd7a001 Allow use of flex sensor on RPM2 pin
Flex pin is still not user selectable in TS, but maybe added at some point. This also allows use of this on board configs.
Also switch to using div100 in the fuel temp code.
2023-05-18 16:06:16 +10:00
Josh Stewart 6932101254 Add a cranking to running RPM hysteresis (15 rpm) 2023-05-18 15:21:30 +10:00
Josh Stewart 3d3cb3b913 Fix minor VSS issue that could cause speed to read 0 if pulses are greater than 333ms apart
Correct timeout limit for vss is 1 second
2023-05-18 11:02:06 +10:00
Josh Stewart 7e8534c6d0 Allow RPM2 to be used for VSS on all decoders that don't have secondary 2023-05-17 15:39:34 +10:00
Josh Stewart 9bc49d9aa2 Warnings cleanup 2023-05-17 11:36:08 +10:00
Josh Stewart 62e14754bb Don't break VSS if using RPM2 pin and enable tooth or composite log 2023-05-17 11:25:50 +10:00
Josh Stewart 27531d3440 Allow use of RPM2 pin for VSS with Basic Distributor trigger 2023-05-17 08:46:20 +10:00
Josh Stewart b49c6b6ab8 Add option to power stepper motor constantly. Fixes #1031 2023-05-17 08:17:26 +10:00
tx_haggis 18501d4cbd
Additonal schedule initialization unit tests (#1046)
* const

* Add RUN_TEST_P

* Reduce test memory usage.

* More granular fuel tests - better failure reports

* More granular ignition tests - better failure reports

* Add unit tests for no injection timing

* Add fuel schedule oddfire tests

* Unit test ignition odd fire
2023-05-15 15:16:41 +10:00
mike501 805a535238
VVT2 improved logging & setup (#1036)
* adding VVT logging and trigger edge editing


fix missing define (temp fix?)


Revert "fix missing define (temp fix?)"

This reverts commit c6280f38ff69cc41278148a79c888736a71754b1.

fixes

* Create an additional logger screen in tunerstudio

Changes to create a third high speed logger window in tuner studio.

* Change variable name 

Discord discussion requested compositeLogEnabled didn't do a test for false as the type is now a byte. Variable renamed to be compositeTriggerUsed and false replaced with 0. Variable name and values used should now make more logical sense.

* added more logging

Log the primary, secondary and third inputs as well as engine cycle on all composite logs. Still have 3 different logs to allow you to visualise which is the best way to present the information.
2023-05-15 14:15:46 +10:00
Josh Stewart 492d0d2daf Fix for new ign mode on 8 cylinder, single channel output 2023-05-15 13:16:40 +10:00
mike501 d89cd532f9
updated to fix resync and improve sync fail reporting (#1047)
Fixes #801
2023-05-13 15:54:05 +10:00
Vitor Moreno B. Sales 9a1c3e30c3
Cranking add cold advance option (#872)
Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-05-10 10:32:11 +10:00
tx_haggis 424a96d9ea
Test start/end callback assignment (#1044) 2023-05-07 19:42:09 +10:00
Jon Billings bcdd308035
fix check for engine rpm below target (#954)
* fix check for engine rpm below target

code is checking for RPM > target speed, but comment says checking for below target speed.
The comment makes sense, the old code doesn't

* improve idle advance enabling

revert to original (rpm > (target - 200)), to avoid excessive advance in transition from cranking to running with IAC control units.
But add exception if no other idle control mechanism to start it immediately (e.g. ITBs)
2023-05-04 00:24:45 +10:00
Josh Stewart 78bed477f5 Merge branch 'master' of https://github.com/noisymime/speeduino 2023-05-03 15:41:38 +10:00
Pasi Kemppainen a93811c8df
VSS from Aux input (#710)
Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-05-03 15:23:49 +10:00
celso acyr da57378684
Read analog values via CAN BUS (#635)
* Read analog values via CAN BUS

Allows reading of 16 analog signals via CAN-BUS. with selection of Edianness.

* Moved function

Function moved to improve data readability.

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2023-05-03 15:12:29 +10:00
Josh Stewart 65005c0019 Sync SD log with card at 4Hz interval 2023-05-02 13:13:19 +10:00
Josh Stewart 1e66cfc5a6 Fix unit test build errors from last commit 2023-04-30 19:52:02 +10:00
mike501 53d6a6a461
Rover MEMS 4 cylinder decoder (#1032)
Decodes the 5 known Rover MEMS ECU patterns for Rover based engines. Covers A series, T series, O Series, K Series and V8. Doesn't currently cover sequential ignition for v6 or v8.

Co-authored-by: Josh Stewart <josh@noisymime.org>
Resolves #101
2023-04-30 19:01:10 +10:00
mike501 e0dbb38794
Renix 44 tooth decoder (includes 66 tooth code) (#1037)
* Renix 44-2-2 & 66-2-2-2 initial version

coded, not tested yet, saving to secure code

* First working version on ardustim

* updates to trigger setup

* latest changes

* 66 tooth working but occasional short dwell

* staging before major rewrite

updating the primary trigger to look for 12th system tooth to increment toothCurrentCount after this checking

* updated working but with bad dwell/timing

code works but the timing and dwell are not accurate once rpm goes over 400rpm

* Renix code 1st release

updated code to do both 44 and 66 tooth within a single set of functions

* remove support for sequential for 44 tooth

Sequential (via cam) was added for 44 tooth to enable future expansion. This is interfering with the normal code on the first testers car.

* updated cam position

* remove Dev logging

* remove logging

* updates to trigger decoding

fixes to 66 tooth pattern and removal of secondary flag for 44 tooth decoder

* fixes to decoder - rpm double

* updates to support display cam tooth position

added code to display which teeth the cam tooth arrives on as VVT1 & 2 and as Aux0 and Aux1.

* Revert "updates to support display cam tooth position"

This reverts commit d2ace89ea7.

* fixes from update to latest speeduino firmware

* Add 4cyl semi-seq injector pairing option

* Add timestamp field to SD logs

* Fix soft and hard rev limiter (#813)

* Increase dwell limiter in RX-8 type ignition (#820)

Currently the dwell limiter calculation considers rotary ignition to have more than 1 pulse per revolution. This only holds true for FC/FD type ignition which is wasted spark correctly resulting in 2 pulses per revolution. RX-8 type ignition however is fully sequential so there is only 1 pulse per revolution. As a result the dwell limiter is being calculated too low.
This change fixes the issue by correctly assuming 1 pulse per revolution in RX-8 type ignition

* All tapers use byte counters (#746)

Fixes

Update idle.ino

* Correct variable size for MAPlast

* Fix issue with SD RPM threshold not correctly detecting on/off

* Reorganise Engine Protection UI

* Add low/high battery voltage indicator (#824)

Fixes #822

* Remove tacho output flags (#814)

* fix typos in code documentation (#816)

* fix typos in code documentation

* minor reverts

* fix typos in ini

Co-authored-by: Josh Stewart <josh@noisymime.org>

* Added Trigger for the Yamaha Vmax motorcycle, 1990 and up. (#823)

* Test 1

* Added the Vmax decoder option

* Added the Yamaha Vmax decoder

Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org>
Co-authored-by: Josh Stewart <josh@noisymime.org>

* Allow for '?' command through legacy comms.

Fixes #821

* Added idle advance start threshold (#747)

* Added idle advance start threshold

On lower temp and/or on ethanol the engine need to crank more, without this my starter get a kick and the engine backfires.

This enable it only at 200 RPM below the target

* Use define to idle advance RPM threshold

Co-authored-by: Josh Stewart <josh@noisymime.org>

* Remove previousLoopTime - never used (#706)

* Simplify the corrections calculations using div100

* Fix the calculations dash figures when battery correction is applied to open time only

* PWM and on/off idle fixes/cleanup (#806)

* Idle fixes #1

* Idle fixes #2

Co-authored-by: Josh Stewart <josh@noisymime.org>

* Remove duplicate iacClosedLoopTable. Lookup idle target RPM @ 4Hz after CLT reading

* Fix validTrigger assignment in Vmax decoder

* Align TPS_rateOfChange scale. Potential fix for #773

* Enable semi sequential and wasted COP on half sync (#478)

* Semi/Full sequential mode

Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode

Minimal code change at speeduino.ino

Fix RPM reading when in half sync

* Update with latest changes in master

* Less calls to change functions

See #478 chat history for details

* Semi/Full sequential mode

Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode

Minimal code change at speeduino.ino

Fix RPM reading when in half sync

* Update with latest changes in master

* Less calls to change functions

See #478 chat history for details

* Add sync status to log

* Updates

Updated speeduino.ini
Updated updates.ino

* Fix error in half to full sync function

Co-authored-by: Josh Stewart <josh@noisymime.org>

* Fixes after merge with speeduino master

* improved debug on sync loss using VVTangle

* additional debug

uses aux channels for debug  eg currentStatus.canin[2] these need removing from the full version. Also uses VVT1 pin for debug via VVT1_PIN_OFF()  and VVT1_PIN_ON()

* fixes

* remove secondary trigger

* different logging

* Final Version

* added automated tests

* fixed fuel pump always being on

* fix build issues after merge with master

* Change how 44 or 66 tooth selected

Updated to work out 44 or 66 tooth decoder based on the number of cylinders, 4 cylinder = 44 tooth, 6 cylinder = 66 tooth

* Fix typo in ini

* Delete compile_commands.json

* Remove duplicate declarations

* Remove VVT code from other PR

* fix speeduino.ino

Remove unintended additions to speeduino.ino

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
Co-authored-by: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com>
Co-authored-by: theKraid <37898397+theKraid@users.noreply.github.com>
Co-authored-by: Vitor Moreno B. Sales <vitor_boss@yahoo.com.br>
Co-authored-by: Corey-Harding <91717711+Corey-Harding@users.noreply.github.com>
Co-authored-by: Daniel Tobias <dantob@users.noreply.github.com>
Co-authored-by: RempageR1 <103254506+RempageR1@users.noreply.github.com>
Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org>
Co-authored-by: tx_haggis <13982343+adbancroft@users.noreply.github.com>
Co-authored-by: Vitor Moreno B. Sales <vitor.m.benevides@outlook.com>
2023-04-30 18:30:34 +10:00
tx_haggis 6fbf6db752
Fixes for Arduino IDE (#1042) 2023-04-29 14:57:57 +10:00
tx_haggis 4a509d19f2
Unit test fuel and ignition scheduler initialisation (#1039)
* Unit test fuel schedule initialisation

* Move initialisation tests to their own harness
Saves memory

* Rename test_misc to test_tables

* Rename test_misc2 to test_math

* Reduce memory usage

* Fill out remaining ignition init unit tests
2023-04-27 14:43:04 +10:00
Josh Stewart 9ff33f0384 Allow send of partial tooth and composite logs at low rpm/resolution 2023-04-26 16:35:39 +10:00
tx_haggis d1399a0f33
Enable Teensy 3.5 unit testing (#1038)
* 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
2023-04-26 15:54:15 +10:00
Josh Stewart 8c85b0c998 Remove legacy comms option from TunerStudio. Add legacy comms lock 2023-04-26 13:45:22 +10:00
Josh Stewart 76dd7dc1bf Cleanup warnings on non-AVR architectures (scheduler interrupts were not static) 2023-04-24 15:33:02 +10:00
Josh Stewart d0286fe02d Ensure that output port manipulations are done atomically. Fixes #972 2023-04-24 10:30:51 +10:00
Josh Stewart 90530f65a3 Handle 3 cylinder, non-seq, staging with >= 6 fuel channels 2023-04-16 17:20:39 +10:00
Josh Stewart f32efa7aee Fix for cranking and fixed timing not being applied when secondary spark table in use 2023-04-16 17:19:33 +10:00
Josh Stewart 6987c966f6 Fixes for regressions in the new staging code 2023-04-13 16:35:47 +10:00
Josh Stewart b8b9cc2780 Set pin trigger hysteresis on T4.1 2023-04-08 08:36:14 +10:00
tx_haggis 8794f51550
Fix single cylinder staging configuration (#1028) 2023-04-07 10:03:06 +10:00
Josh Stewart a309659b69 Warnings cleanup. Fixes #1026 #1025 2023-03-30 14:29:38 +11:00
Josh Stewart 1c5ae26d7b Revert "Fix for hang on uninitialised Teensy 41 boards under some conditions"
This reverts commit 0cff612b01.
2023-03-27 16:59:50 +11:00
Josh Stewart 31b18b5078 Fix for hang on uninitialised Teensy 41 boards under some conditions 2023-03-27 16:59:44 +11:00
Josh Stewart 0cff612b01 Fix for hang on uninitialised Teensy 41 boards under some conditions 2023-03-27 16:57:56 +11:00
Josh Stewart e5e46b1d73 Add serial compatibility mode option 2023-03-23 11:05:10 +11:00
Josh Stewart 1886eb3861 Honour the Inverted ignition output setting on boards using MC33810. Fixes #1021 2023-03-16 13:49:59 +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 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
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
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
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
DeionSi 647681767e
Scale IAT and CLT calibration to ADC 1023 instead of 992 (#959) 2022-11-30 15:16:49 +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
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
Josh Stewart 2269e688f3 Lower SPI EEPROM write frequency 2022-10-19 12:19:52 +11:00
rafolg dd38d0d7fb
Update board_teensy41.ino (#937)
Auxiliary interrupts should be called after timer flag resets to avoid RPM drops at high engine speed
2022-10-09 13:48:53 +11:00
Josh Stewart c8d51d686b Nissan 360: make sure elapsedTime variable is set. Fixes #705 2022-10-03 15:43:43 +11:00
Josh Stewart 960d713889 Reduce spark duration when dwell limit is exceeded.
Potential fix for #932
2022-09-27 11:55:42 +10:00
Josh Stewart 114e9b2c7d Correct Teensy 4.1 PIT clock scaler 2022-09-16 17:52:59 +10:00
tx_haggis b8278e7ecb
Include CPP files in MISRA script (#925)
* 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
2022-09-15 12:16:14 +10:00
Jon Billings f1a4ff014c
Jeep2000 fix (#912)
* Fix Jeep2000 decoder

getCrankAngle_Jeep2000() sets crankangle = 146 if toothcurrentcount = 0, because last tooth was cam tooth  which is 146 ATDC, however, all the timing and angle calculations are not done on the cam tooth read, so crankangle should be set to 118 for previous crank tooth.

* fix the fix

@jaredsellers4 pointed out that to be consistent with the rest of the crank tooth timings, it should be the leading edge, 114, rather than 118.

* Further improvement to Jeep 2000 decoder

1) filter out secondary signals when primary tooth is not 12 or 13 (because it's noise)
2) scale the trigger filter gap according to whether the next gap is bigger, smaller or the same as the previous/current gap.

* Revert "Further improvement to Jeep 2000 decoder"

This reverts commit 3510aa49c3.

* fix Jeep2000 to address #897

getCrankAngle_Jeep2000() sets crankangle = 146 + triggerAngle when toothCurrentCount = 0, because toothCurrentCount was set to 0 on seeing the Cam tooth, and the cam tooth angle is 146.
However, the tooth timings that are subsequently used in calculations are from the previous crank tooth, which was at 114. Therefore 114 is the correct crankangle to work with.

Co-authored-by: Jon Billings <jon.billings@bbc.co.uk>
2022-09-15 09:59:18 +10:00
rafolg a40971dde1
Configuration of PWM for idle, boost and vvt for Teensy4.1 (Take2) (#929)
* Fix VSS not resetting to zero

Reinstated car stop check to avoid  speed not going back to zero.

* Better logic for gear detection

Previous gear detection logic had gears constantly lagging 1 shift behind.

* Update sensors.h

* Update sensors.ino

* Update sensors.ino

* Update sensors.h

* Update board_teensy41.h

Pit timers implementation for idle, boost and vvt

* Update board_teensy41.ino

Pit timers implementation for idle, boost and vvt

* Update board_teensy41.h

Error in fuel5-8 timer disable now corrected

* Update auxiliaries.ino

Enable vvt PWM for Teensy 4.1

* Update idle.ino

* Update board_teensy41.h

For some reason the PIT_LDVAL compares were not showing on  the previous PR

* Update auxiliaries.ino
2022-09-15 09:58:37 +10:00
ric355 659eb8ec0f
Fix for uninitialised variable in OLCL and CL stepper idle control (#926)
* 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>
2022-09-13 23:16:31 +10:00
Josh Stewart c8b7c18622 Flush serial rx buffer if a CRC error is found 2022-09-13 17:33:04 +10:00
Josh Stewart 3923ecf12f Tweaks to 2560 EEPROM burn during multi page writes 2022-09-12 11:53:18 +10:00
Afroboltski 75d6c2ff61
Air Conditioning Control - Feature Implementation (#665)
* 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>
2022-09-07 10:23:01 +10:00
Josh Stewart a4b00dca90 Prevent potential init lockup on Teensy boards if invalid pin is selected for aux function 2022-08-31 16:19:09 +10:00