Commit Graph

15 Commits

Author SHA1 Message Date
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
Josh Stewart 770158a5fe Show all log files on SD card, not just the first page 2021-12-24 15:30:37 +11:00
Josh Stewart 13c2f953c0 Add button to format SD card 2021-12-24 13:30:14 +11:00
Josh Stewart 89e49d2c00 Faster VSS reads and gear detection 2021-09-14 21:45:44 +10:00
Daniel Tobias e4909f441d
couple of signed overflow fixes (#519)
* the TS_CMD_VSS_RATIO* id values overflow signed 16 bit int on avr

switch to unsigned 16 bit value

define TS_CMD_VSS_60KMH  39168 //0x99x00
define TS_CMD_VSS_RATIO1 39169
define TS_CMD_VSS_RATIO2 39170
define TS_CMD_VSS_RATIO3 39171
define TS_CMD_VSS_RATIO4 39172
define TS_CMD_VSS_RATIO5 39173
define TS_CMD_VSS_RATIO6 39174

* make sure we don't overflow and accidentally set negative timing

currentStatus.advance can only hold a signed 8 bit value

* make sure we can't have a negative multiplier
2021-02-04 13:10:35 +11:00
Vitor Moreno B. Sales 0760fa65d0
STM32 jump to DFU bootloader (#485)
* STM32 jump to DFU

This enable jumping to hardware bootloader with software command.
Based on @iLeeeZi previous work.

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

* lowercase functions fixes

Co-authored-by: iLeeeZi <3372213+iLeeeZi@users.noreply.github.com>
Co-authored-by: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com>
2020-12-03 09:24:15 +11:00
Josh Stewart 4825f573b2 Further work unifying the MC33810 build. Complete but needs testing 2020-12-01 18:12:39 +11:00
Josh Stewart e783d15138 Add tx buffer check for tooth and composite logs 2020-08-22 20:53:42 +10:00
Josh Stewart 899831bdad MISRA cleanup 2020-07-30 09:15:24 +10:00
Josh Stewart c3291e8768 Minor corrections on HW test modes 2020-06-05 09:30:06 +10:00
Josh Stewart f51a43f768 Remove channel checks from the hardware test outputs 2020-05-21 22:20:37 +10:00
Josh Stewart a826b20307 Most of the remaining VSS parts 2020-05-12 12:14:37 +10:00
Josh Stewart a335820b46 Enable the use of the 50% hardware test modes 2020-05-04 15:08:45 +10:00
Josh Stewart ccad3d258f VSS calibration routines (untested) 2020-04-23 20:34:31 +10:00
Josh Stewart e5f2193abe Introduce command button handler and expand the hardware testing to 8 channels 2020-04-22 11:02:35 +10:00