Commit Graph

3149 Commits

Author SHA1 Message Date
tx_haggis 94a28de89d
Reduce table2d memory size (130 bytes) (#1254)
* Use fixed width types

* Improve table construction: automatically deduce length

* Improve 2d table test coverage

* Shrink cache types - save memory

* Remove lastXMin - it's always lastXMax-1: save memory

* Rename lastXMax to lastBinUpperIndex

* Bug Fix: lastBinUpperIndex is always in the range (1:length]

* Reuse - call construct2dTable() instead of custom function

* MISRA fixes

* Elide unecessary local variable (X)

* Separate 2d table cache into it's own struct.

* Use a bin idiom to simplfy the table2d search code

* Add opaque_array_t - captures the concept of an opaque array (void*)

* Reorder the checks on the assumption that we are within axis bounds most of the time.

* Better int16_t support.

* Table 2D - Initialise during constexpr construction.
Saves flash & RAM

* Remove knock tables (unused).

* Limit scope of all table2D instances (none need to be global).
2025-06-04 08:33:12 +10:00
Josh Stewart 4aa8ee8c30 Remove option for voltage correction to apply to whole PW
[BREAKING CHANGE!] This change will result in different behaviour if you currently have the injector open time voltage correction set to apply to 'Whole PW'. In this instance, you may need to retune your open time values.

If you had this setting left to the default (And recommended) value of 'Open time only' then there is no change.
2025-05-30 10:27:49 +10:00
Josh Stewart ae3f1d5564 Add pulsewidth 5-8 to TS and Log. Fixes #1276 2025-05-21 14:06:29 +10:00
Josh Stewart 502b2098ef Additional values added to datalog 2025-05-20 11:29:37 +10:00
Pasi Kemppainen 7e06876dac
Add new temp sensor presets (#1299)
- Remove the two same Bosch calibrations and add better one.
- Add BMW M52/M52TU/M54 temp sensor calibrations
2025-05-18 09:33:45 +10:00
Josh Stewart ad32e47053 Add check for secondary serial pins being reserved on T41 2025-05-15 22:58:48 +10:00
Josh Stewart 4ed7b16ef5 Add curl option to fix firmware uploads through Cloudflare 2025-05-14 13:54:09 +10:00
Josh Stewart a8d4d686e2 Change upload URLs to work with CloudFlare 2025-05-12 20:47:36 +10:00
Pascal Godin 5a201a40b2
Ford TFI Decoder (#1297)
* Added Ford TFI Decoder

Decoder for Ford TFI Distributor mounted wheel with narrower signature tooth for cylinder no 1

* Removed variable

variable tempRevolutionOne was declared but not used.
2025-05-12 17:53:09 +10:00
Josh Stewart e7eb512b0e Fix pinTrigger3 mapping on Dropbear v2 2025-04-18 07:35:53 +10:00
Josh Stewart e3778f9004 Update Calculations.dash 2025-04-17 09:14:18 +10:00
okenagod 392d7fe988
fix stepper driver - unaccessible pinStepperEnable set (#1292)
If user set iacCoolTime to 0, program run will newer get to 'stepper motor enable pin setting' part.
Stepper status have to be STEPPING or COOLING to get into condition on line 300, then there is next condition for STEPPING status and power disable check is in else statement, so only status COOLING can get there. But if iacCoolTime=0, status is set to SOFF and stepper motor remains enabled.
2025-04-03 15:53:11 +11:00
Josh Stewart 3921d0b915 Lower PIT timer interrupt priority on Teensy 4.1 2025-03-04 21:33:10 +11:00
Josh Stewart 97a79872d6 Edge cases Fixes for priming pulse not firing
The injector priming pulse could fail to occur if either of the following conditions were met:
1. The injector priming delay was 0.1s or less
2. Flood clear was set to 100% (ie Disabled) but TPS reading was 100%
2025-02-06 15:18:18 +11:00
Josh Stewart e56c6f0a92 Add Teensy 41 pin hysteresis on all external interrupt functions (Flex, VSS and Knock)
Fixes #1284
2025-01-30 09:40:23 +11:00
Josh Stewart 42ac8c2dcd Only reset cycle and event MAP values when engine is off rather than prior readings
Fixes #1278
2025-01-11 08:53:07 +11:00
tx_haggis fbd1e4fa4f
Bug fixes for getAdvance1, getAdvance2 & secondary tables. (#1155)
* Unit testability: split out definition of statuses struct.

* Separate out getLoad() function

* Bug Fix: getAdvance1() & getAdvance2() should return a signed value.

* secondarytables.cpp - extract duplicate code into functions.

* Bug fix: BIT_STATUS3_FUEL2_ACTIVE not set in 2 cases.

* Performance: secondaryTables call percentage()
(which is optimised)

* Add secondary table tests

* Bug Fix: do not correct secondary spark multiplier

* Unit test no secondary spark with fixed timing.

* MISRA fixes

* Save memory: remove statuses::ignLoad2 & fuelLoad2 (unused)

* Unit testability: split out definition of config page structs.

* Make 3D table interpolation a const operation.

* Unit testability: inject the tune & status.

* Make the advance2 gauge work correctly in multiply mode

* Secondary table tests - no global state

* Secondary table tests: add additional spark multiply tests to cover #1274

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2025-01-09 17:14:25 +11:00
Josh Stewart 784c2ed0bc Signatures for 202504-dev 2025-01-09 14:10:45 +11:00
Josh Stewart 29bdaa32fc Signatures for 202501 release 2025-01-07 08:07:31 +11:00
Josh Stewart 97ee968540 Fix variable name in ini 2025-01-06 09:01:24 +11:00
Josh Stewart bbe0db06f5 Add indicator and log entry for staging 2025-01-06 08:41:12 +11:00
Josh Stewart 379d1fbeca ini file cleanup prior to release 2025-01-06 08:00:09 +11:00
Josh Stewart 1d6f32516f Fix edge case in VSS launch check 2025-01-05 16:26:57 +11:00
Josh Stewart 413e2a1aae Improve hysteresis check to disable the stepper controller 2025-01-05 10:33:56 +11:00
Josh Stewart 0a4e428e4a Faster boot time on Teensy 4.1 2025-01-02 11:24:54 +11:00
Josh Stewart 23cc14e7b7 Fix for stm32 fuel issues below 1000 rpm 2025-01-01 09:57:10 +11:00
Josh Stewart 18c3d7134c Minor cleanup of command button handler 2024-12-31 17:21:23 +11:00
Josh Stewart eafb2232a1 Revert "Hardened pin reassignment (#1248)"
This reverts commit 2fd3640c8a.
2024-12-28 18:28:54 +11:00
Josh Stewart b99c6bfeba Revert "[STM32] Do protection check on all pins (#1268)"
This reverts commit 94b6a0a0ca.
2024-12-28 18:28:37 +11:00
Vitor Moreno B. Sales 81e7cff4d9
[OBDII] Fixed lambda and flex precision (#1269)
Faster TPS math
2024-12-21 09:27:26 +11:00
Josh Stewart 41e54d4389
Fuel schedule improvements (#1272)
* Avoid overflow of timer period between the current and next schedules

Potential fix for #1181

* Remove end compare on fuel schedules. Significant RAM improvement

* Cleanup of new code. Align ignition schedules with new fuel schedules

* Slight tweak to fuel scheduling conditions

* Prevent missed injection pulse under specific timing conditions

* Further work handling when injection start angle passes back and forth between 0 and CRANK_ANGLE_MAX_INJ

* Do not queue next fuel schedule if cycle time exceeds max timer duration

* Fix unit tests based on code path changes
2024-12-19 16:49:34 +11:00
Vitor Moreno B. Sales 94b6a0a0ca
[STM32] Do protection check on all pins (#1268)
* [STM32] Do protection check on all pins

* Fix misspelled word on last commit
2024-12-13 09:24:47 +11:00
Vitor Moreno B. Sales 2fd3640c8a
Hardened pin reassignment (#1248)
* Hardened pin reassignment

Added check as some functions access the pin via registers and had no check.

Added protection for "board default" pin value as it can lock up STM32 board due to wrong board layout.

Added STM32 CAN pins to the `pinIsReserved` check.

* Fixed check for inputs

* Fixed typos on last commit

* Fixed possible problems with some outputs

Fixed first test failed on previous commit

* Correctly init reset pin

---------

Co-authored-by: Josh Stewart <josh@noisymime.org>
2024-11-29 14:53:14 +11:00
Josh Stewart 4ac5b72d9e Adjust init test for reset control output pin 2024-11-29 14:20:07 +11:00
Josh Stewart b99ab35f8b Correct Coolant reading over BMW CAN protocol. Fixes #1218 2024-11-28 18:09:43 +11:00
Josh Stewart abc688bc5d Change ignSoftLaunchValue to signed. Fixes #1188
This was not causing any actual issues that I can see, however best to use the correct type
2024-11-28 17:59:01 +11:00
Josh Stewart 0898043d19 Teensy 4.1 boot speed optimisations 2024-11-22 11:55:09 +11:00
Josh Stewart 95664baee6 Only perform SD card init if SD logging is enabled 2024-11-19 12:36:48 +11:00
Josh Stewart a9dcc597c3 Fix faulty logic for VSS hard launch check 2024-11-15 13:57:16 +11:00
Josh Stewart 9be81a6700 Minor loop count optimisation. 2024-11-07 15:29:05 +11:00
Josh Stewart 4e23e87a34 Correct comment. Fixes #1257 2024-11-07 14:18:01 +11:00
Josh Stewart 095c2ff196 Cleanup warnings 2024-11-07 13:32:12 +11:00
Josh Stewart 43bc13cf40 Fix compilation issue from last commit 2024-11-06 14:58:47 +11:00
Josh Stewart fe31596c9e Add rx timeout checks on secondary and legacy serial code. Reduce rx timeout from 700ms to 400ms 2024-11-06 14:16:41 +11:00
Josh Stewart fcb106f3cc Clear serial buffer after 0xF0 character received 2024-10-25 20:05:23 +11:00
Josh Stewart cb9baca418 Avoid potential tacho out race condition on teensy and stm32 2024-10-25 17:40:17 +11:00
Josh Stewart ba77e36bd7 Check for DTR change on serial line and ignore
Fixes 1112
2024-10-25 12:03:25 +11:00
Josh Stewart 8b97b9802d Increase SD ringbuffer size and add checks for space before writing to ringbuffer
Fixes #1258
2024-10-22 14:27:17 +11:00
Josh Stewart 88e1e951af Add pin reserved check for external interrupt functions
This can prevent a lockup on stm32 boards if a reserved pin is selected on a reserved pin
2024-10-22 13:57:13 +11:00
tx_haggis bf8e651a89
Unit test Pull Requests (#1255)
* Only need a single simulator test environment.
(now that PIO have fixed their SimAVR tooling).

* Run unit tests on PRs using SimAVR.
2024-10-19 00:24:38 +11:00