speeduino/speeduino/TS_CommandButtonHandler.h

75 lines
2.2 KiB
C
Raw Permalink Normal View History

/** \file
* Header file for the TunerStudio command handler
* The command handler manages all the inputs FROM TS which are issued when a command button is clicked by the user
*/
#define TS_CMD_TEST_DSBL 256
#define TS_CMD_TEST_ENBL 257
#define TS_CMD_INJ1_ON 513
#define TS_CMD_INJ1_OFF 514
#define TS_CMD_INJ1_PULSED 515
#define TS_CMD_INJ2_ON 516
#define TS_CMD_INJ2_OFF 517
#define TS_CMD_INJ2_PULSED 518
#define TS_CMD_INJ3_ON 519
#define TS_CMD_INJ3_OFF 520
#define TS_CMD_INJ3_PULSED 521
#define TS_CMD_INJ4_ON 522
#define TS_CMD_INJ4_OFF 523
#define TS_CMD_INJ4_PULSED 524
#define TS_CMD_INJ5_ON 525
#define TS_CMD_INJ5_OFF 526
#define TS_CMD_INJ5_PULSED 527
#define TS_CMD_INJ6_ON 528
#define TS_CMD_INJ6_OFF 529
#define TS_CMD_INJ6_PULSED 530
#define TS_CMD_INJ7_ON 531
#define TS_CMD_INJ7_OFF 532
#define TS_CMD_INJ7_PULSED 533
#define TS_CMD_INJ8_ON 534
#define TS_CMD_INJ8_OFF 535
#define TS_CMD_INJ8_PULSED 536
#define TS_CMD_IGN1_ON 769
#define TS_CMD_IGN1_OFF 770
#define TS_CMD_IGN1_PULSED 771
#define TS_CMD_IGN2_ON 772
#define TS_CMD_IGN2_OFF 773
#define TS_CMD_IGN2_PULSED 774
#define TS_CMD_IGN3_ON 775
#define TS_CMD_IGN3_OFF 776
#define TS_CMD_IGN3_PULSED 777
#define TS_CMD_IGN4_ON 778
#define TS_CMD_IGN4_OFF 779
#define TS_CMD_IGN4_PULSED 780
#define TS_CMD_IGN5_ON 781
#define TS_CMD_IGN5_OFF 782
#define TS_CMD_IGN5_PULSED 783
#define TS_CMD_IGN6_ON 784
#define TS_CMD_IGN6_OFF 785
#define TS_CMD_IGN6_PULSED 786
#define TS_CMD_IGN7_ON 787
#define TS_CMD_IGN7_OFF 788
#define TS_CMD_IGN7_PULSED 789
#define TS_CMD_IGN8_ON 790
#define TS_CMD_IGN8_OFF 791
#define TS_CMD_IGN8_PULSED 792
#define TS_CMD_STM32_REBOOT 12800
#define TS_CMD_STM32_BOOTLOADER 12801
2021-12-23 18:30:14 -08:00
#define TS_CMD_SD_FORMAT 13057
2020-04-23 03:34:31 -07:00
#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
/* the maximum id number is 65,535 */
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-20 17:55:54 -08:00
bool TS_CommandButtonsHandler(uint16_t buttonCommand);