Commit Graph

32 Commits

Author SHA1 Message Date
Josh Stewart f657fc6293 Add option on secondary serial to use previous generic data list 2023-10-10 15:49:36 +11:00
tx_haggis 977ffa3119
MISRA: clean up logger header (#1108)
* Move log header definitions inside sd_logger.ino
It's the only place they are used.

* Convert to CPP - fixes build error

* Encapsulate fsIntIndex

* MISRA fixes

* Convert logger.ino -> cpp

* Conditonal compile - reclaim memory
2023-10-06 15:07:12 +11:00
Josh Stewart 0c6a89b00d Correct mismatching serial block sizes 2023-09-18 16:02:45 +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
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
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
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
Josh Stewart 2fc29ceef5 MISRA cleanup rule: misra-c2012-8.2 2022-11-06 09:43:29 +11: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 16403b41bc Allow for float values in SD log where supported with FPU 2022-08-10 12:12:42 +10:00
Daniel Tobias 7020705dbe
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>
2022-04-11 10:49:58 +10:00
Josh Stewart 76f6a7f1d5 Use common (and faster) is2ByteEntry() function for programmable IO. This fixes #569 (Though it was likely resolved earlier anyway) 2022-01-05 16:41:12 +11:00
Josh Stewart 8430d50ec4 Fix broken unit tests 2021-12-10 14:44:27 +11:00
Josh Stewart 93aa6f5fd5 Fix Teensy RTC setting bug 2021-12-10 14:26:13 +11:00
Josh Stewart f21a19595f Fix missing header string for Fan duty. Add static assert to try and ID this in future 2021-12-10 13:29:25 +11:00
Pasi Kemppainen e213f2534e
PWM Fan addition (#637)
* Added PWM Fan functionality

PWM Fan output for Teensy and STM32

* Teensy3.5 timer fix for PWM Fan.

* Fix the conflicts with incorporate AFR

* Possibility to use PWM fan on mega too

Not tested at this stage!! Do not merge yet.

* Fix log entry size

* Remove duplicate stuff and use same way off toggling fan

* Fix typo errors

* Move fan pin definitions to globals.h

* Fix problems related to PWM fan.

* Revert previous change.

* Fix problems with idle things

* fix idle duty getting stuck at 100%

* Revert "fix idle duty getting stuck at 100%"

This reverts commit 7e9779483b.

* Revert "Fix problems with idle things"

This reverts commit 8bccb56d9a.

* Revert "Revert previous change."

This reverts commit fcb962864a.

* Remove mega support

* fixes

* more fixes

* moar fixes

* Should be working now

* Update speeduino.ini

* Lots of tweaking

* Update to work better with current FW

* Fix compiler warnings and include update things.

* Minor fixes

* Update logger.ino

* Fan duty working on mega too and fan output will be on/off

Co-authored-by: Pasi Kemppainen <pazi88@users.noreply.github.com>
2021-11-24 12:18:41 +11:00
Josh Stewart 793482a27b Big chunk of SD logging work. 2021-10-13 11:53:46 +11:00
Josh Stewart 93de5eecda Initial work on common SDFat library.
Implements much of the layout and settings from #543
2021-10-04 00:09:53 +11:00
Pasi Kemppainen 1da3fb1304
Add EMAP gauge/logging (#596) 2021-07-04 11:26:57 +10:00
Pasi Kemppainen 982e52db1b
VVT2 addition and closed loop VVT improvement (#551)
* VVT2 and closed loop VVT improvement

* Fix building for latest changes

* Fix CRC error

Co-authored-by: Josh Stewart <josh@noisymime.org>
2021-04-22 08:56:39 +10:00
Josh Stewart fd9fa36c29 Major revamp of unit testing framework 2020-11-19 21:38:00 +11:00
Josh Stewart 494d63d598 Add serial rate gauge and throughput tweaks 2020-09-04 09:19:43 +10:00
Josh Stewart fb15a565ea
Pr/435 (#445). Closes #435
* Add files via upload

* Add files via upload

* Update storage.h

* Update log size

Co-authored-by: DylanRooijakkers <69131866+DylanRooijakkers@users.noreply.github.com>
Co-authored-by: Dylan Rooijakkers <rooijakkersd@gmail.com>
2020-08-23 08:27:44 +10:00
iLeeeZi 8e9b680be6
Flex fuel sensor temperature and temperature correction (#413). Also closes #252
* Fuel temperature correction

* fix negative temperatures

* typo fixed
2020-08-18 12:34:56 +10:00
Vitor Moreno B. Sales b29fa21775
Programmable outputs (#396)
* Programmable outputs

* Prevent array overflow

* Show fullStatus variables names on dialog

* Further fixes

* Update with master

Co-authored-by: Josh Stewart <josh@noisymime.org>
2020-08-12 14:21:36 +10:00
Vitor Moreno B. Sales 31541cca2d
[VVT] PID work (#412)
* [VVT] PID work

Tested on a half  moon CAM pattern as working, it should work on others too.

Added option to reverse the PWM output

Co-Authored-By: pazi88 <48950874+pazi88@users.noreply.github.com>

* Fix typo

Co-Authored-By: diy-efi <diy-efi@users.noreply.github.com>

* Add second VVT pwm on same timer

All precious VVT variables was renamed to VVT1 and added VVT2 stuff.

Tested with logic analyzer.

* Define VVT2 for other boards

Added vvt2Pin

* Just update on first tooth

Co-authored-by: pazi88 <48950874+pazi88@users.noreply.github.com>
Co-authored-by: diy-efi <diy-efi@users.noreply.github.com>
2020-07-27 09:05:02 +10:00
Mateusz Muszyński 5b342d27bd
Water methanol injection (#417). Refer #154
* Add water methanol injection

* Set signature back to default

* Set signature back to default

Co-authored-by: Josh Stewart <josh@noisymime.org>
2020-07-22 11:27:21 +10:00
Josh Stewart fc43f3a479 Allocate memory for fuel/oil pressure inputs 2020-05-29 12:21:28 +10:00
Josh Stewart a826b20307 Most of the remaining VSS parts 2020-05-12 12:14:37 +10:00
Vitor Moreno B. Sales 63b726cf78
[ASE] Transition time to disable (#342)
* [ASE] Transition time to disable

* Real time ASE

* Fix last commit

* Fix variables declaration
2020-03-24 12:36:24 +11:00
Josh Stewart e004a81524 Increase maximum corrections value from 255 to 511 2020-01-21 15:16:54 +11:00
Josh Stewart b3a7ba8eac Some initial ground work for the SD logging 2019-12-19 17:31:02 +11:00