Remove legacy comms option from TunerStudio. Add legacy comms lock
This commit is contained in:
parent
97a8ea78b0
commit
8c85b0c998
|
@ -1,7 +1,6 @@
|
|||
;-------------------------------------------------------------------------------
|
||||
#unset CAN_COMMANDS
|
||||
#unset enablehardware_test
|
||||
#set NEW_COMMS
|
||||
|
||||
[MegaTune]
|
||||
MTversion = 2.25
|
||||
|
@ -42,8 +41,6 @@
|
|||
settingOption = mcu_teensy, "Teensy"
|
||||
settingOption = mcu_stm32, "STM32"
|
||||
|
||||
settingGroup = NEW_COMMS, "Use new comms protocol"
|
||||
|
||||
settingGroup = COMMS_COMPAT_GROUP, "Serial Mode"
|
||||
settingOption = COMMS_COMPAT, "Compatibility Mode"
|
||||
settingOption = DEFAULT, "Normal"
|
||||
|
@ -257,7 +254,6 @@
|
|||
#if COMMS_COMPAT
|
||||
blockingFactor = 121
|
||||
#endif
|
||||
tableBlockingFactor = 244 ; Serial buffer is 257 bytes. There are 7 bytes overhead for the M command + 2 bytes for the size + 4 bytes for the CRC. 257 - 7 - 2 - 4 = 244 bytes.
|
||||
delayAfterPortOpen=1000
|
||||
;validateArrayBounds = true
|
||||
blockReadTimeout = 2000
|
||||
|
@ -265,10 +261,8 @@
|
|||
interWriteDelay = 10 ;Ignored when tsWriteBlocks is on
|
||||
pageActivationDelay = 10
|
||||
restrictSquirtRelationship = false ;This requires TS 3.1 or above
|
||||
#if NEW_COMMS
|
||||
messageEnvelopeFormat = msEnvelope_1.0 ;New and testing only
|
||||
tableCrcCommand = "k\$tsCanId%2i%2o%2c" ;TS can only use this command in new mode
|
||||
#endif
|
||||
readSdCompressed = false
|
||||
|
||||
;New for TS 3.0.08ish upwards, define lists of standard I/O options
|
||||
|
@ -5521,7 +5515,6 @@ cmdVSSratio6 = "E\x99\x06"
|
|||
calcField = time, "Time", "ms", { refTime }
|
||||
|
||||
[ReferenceTables]
|
||||
#if NEW_COMMS
|
||||
tableWriteCommand = "t\$tsCanId%2i%2o%2c%v"; "t%2i%2o%2c%v"; "t\x01\xFC\x00\x01\xFC" "t\%2i%2o%2c%v"
|
||||
#if mcu_stm32
|
||||
tableBlockingFactor = 64
|
||||
|
@ -5531,7 +5524,7 @@ cmdVSSratio6 = "E\x99\x06"
|
|||
#if COMMS_COMPAT
|
||||
tableBlockingFactor = 64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
referenceTable = std_ms2gentherm, "Calibrate Thermistor Tables."
|
||||
topicHelp = "https://wiki.speeduino.com/en/configuration/Sensor_Calibration"
|
||||
tableIdentifier = 000, "Coolant Temperature Sensor", 001, "Air Temperature Sensor"
|
||||
|
|
|
@ -460,7 +460,13 @@ void serialReceive(void)
|
|||
byte highByte = (byte)Serial.peek();
|
||||
|
||||
//Check if the command is legacy using the call/response mechanism
|
||||
if( ((highByte >= 'A') && (highByte <= 'z')) || (highByte == '?') )
|
||||
if(highByte == 'F')
|
||||
{
|
||||
//F command is always allowed as it provides the initial serial protocol version.
|
||||
legacySerialCommand();
|
||||
return;
|
||||
}
|
||||
else if( ((highByte >= 'A') && (highByte <= 'z')) || (highByte == '?') && (BIT_CHECK(currentStatus.status4, BIT_STATUS4_ALLOW_LEGACY_COMMS)) )
|
||||
{
|
||||
//Handle legacy cases here
|
||||
legacySerialCommand();
|
||||
|
@ -497,6 +503,7 @@ void serialReceive(void)
|
|||
{
|
||||
//CRC is correct. Process the command
|
||||
processSerialCommand();
|
||||
BIT_CLEAR(currentStatus.status4, BIT_STATUS4_ALLOW_LEGACY_COMMS); //Lock out legacy commands until next power cycle
|
||||
}
|
||||
else {
|
||||
//CRC Error. Need to send an error message
|
||||
|
@ -515,6 +522,7 @@ void serialReceive(void)
|
|||
|
||||
flushRXbuffer();
|
||||
sendReturnCodeMsg(SERIAL_RC_TIMEOUT);
|
||||
|
||||
} //Timeout
|
||||
}
|
||||
|
||||
|
@ -593,6 +601,17 @@ void processSerialCommand(void)
|
|||
sendReturnCodeMsg(SERIAL_RC_OK);
|
||||
break;
|
||||
|
||||
case 'f': //Send serial capability details
|
||||
serialPayload[0] = SERIAL_RC_OK;
|
||||
serialPayload[1] = 2; //Serial protocol version
|
||||
serialPayload[2] = highByte(BLOCKING_FACTOR);
|
||||
serialPayload[3] = lowByte(BLOCKING_FACTOR);
|
||||
serialPayload[4] = highByte(TABLE_BLOCKING_FACTOR);
|
||||
serialPayload[5] = lowByte(TABLE_BLOCKING_FACTOR);
|
||||
|
||||
sendSerialPayloadNonBlocking(6);
|
||||
break;
|
||||
|
||||
case 'F': // send serial protocol version
|
||||
(void)memcpy_P(serialPayload, serialVersion, sizeof(serialVersion) );
|
||||
sendSerialPayloadNonBlocking(sizeof(serialVersion));
|
||||
|
@ -691,6 +710,12 @@ void processSerialCommand(void)
|
|||
generateLiveValues(offset, length);
|
||||
sendSerialPayloadNonBlocking(length + 1U);
|
||||
}
|
||||
else if(cmd == 0x0f)
|
||||
{
|
||||
//Request for signature
|
||||
(void)memcpy_P(serialPayload, codeVersion, sizeof(codeVersion) );
|
||||
sendSerialPayloadNonBlocking(sizeof(codeVersion));
|
||||
}
|
||||
#ifdef RTC_ENABLED
|
||||
else if(cmd == SD_RTC_PAGE) //Request to read SD card RTC
|
||||
{
|
||||
|
|
|
@ -10,6 +10,17 @@
|
|||
#ifndef NEW_COMMS_H
|
||||
#define NEW_COMMS_H
|
||||
|
||||
#if defined(CORE_TEENSY)
|
||||
#define BLOCKING_FACTOR 251
|
||||
#define TABLE_BLOCKING_FACTOR 256
|
||||
#elif defined(CORE_STM32)
|
||||
#define BLOCKING_FACTOR 121
|
||||
#define TABLE_BLOCKING_FACTOR 64
|
||||
#elif defined(CORE_AVR)
|
||||
#define BLOCKING_FACTOR 121
|
||||
#define TABLE_BLOCKING_FACTOR 64
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The serial receive pump. Should be called whenever the serial port
|
||||
* has data available to read.
|
||||
|
|
|
@ -131,7 +131,7 @@ void legacySerialCommand(void)
|
|||
break;
|
||||
|
||||
case 'F': // send serial protocol version
|
||||
Serial.print(F("001"));
|
||||
Serial.print(F("002"));
|
||||
break;
|
||||
|
||||
//The G/g commands are used for bulk reading and writing to the EEPROM directly. This is typically a non-user feature but will be incorporated into SpeedyLoader for anyone programming many boards at once
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
#define BIT_STATUS4_BURNPENDING 4
|
||||
#define BIT_STATUS4_STAGING_ACTIVE 5
|
||||
#define BIT_STATUS4_COMMS_COMPAT 6
|
||||
#define BIT_STATUS4_UNUSED8 7
|
||||
#define BIT_STATUS4_ALLOW_LEGACY_COMMS 7
|
||||
|
||||
#define BIT_AIRCON_REQUEST 0 //Indicates whether the A/C button is pressed
|
||||
#define BIT_AIRCON_COMPRESSOR 1 //Indicates whether the A/C compressor is running
|
||||
|
|
|
@ -110,6 +110,7 @@ void initialiseAll(void)
|
|||
#endif
|
||||
|
||||
Serial.begin(115200);
|
||||
BIT_SET(currentStatus.status4, BIT_STATUS4_ALLOW_LEGACY_COMMS); //Flag legacy comms as being allowed on startip
|
||||
#if defined(CANSerial_AVAILABLE)
|
||||
if (configPage9.enable_secondarySerial == 1) { CANSerial.begin(115200); }
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue