Fix for build failure on mega2561 with last commit

This commit is contained in:
Josh Stewart 2023-10-05 22:38:57 +11:00
parent 5140b31829
commit 6c16f552a5
4 changed files with 17 additions and 24 deletions

View File

@ -58,7 +58,7 @@ void secondserial_Command(void)
case 'A':
// sends a fixed 75 bytes of data. Used by Real Dash (Among others)
//sendcanValues(0, CAN_PACKET_SIZE, 0x31, 1); //send values to serial3
sendValues(0, CAN_PACKET_SIZE, 0x31, CANSerial); //send values to serial3
sendValues(0, CAN_PACKET_SIZE, 0x31, CANSerial, serialSecondaryStatusFlag); //send values to serial3
break;
case 'b': // New EEPROM burn command to only burn a single page at a time
@ -137,7 +137,7 @@ void secondserial_Command(void)
break;
case 'n': // sends the bytes of realtime values from the NEW CAN list
sendValues(0, NEW_CAN_PACKET_SIZE, 0x32, CANSerial); //send values to serial3
sendValues(0, NEW_CAN_PACKET_SIZE, 0x32, CANSerial, serialSecondaryStatusFlag); //send values to serial3
break;
case 'p':

View File

@ -527,7 +527,7 @@ void serialTransmit(void)
switch (serialStatusFlag)
{
case SERIAL_TRANSMIT_INPROGRESS_LEGACY:
sendValues(logItemsTransmitted, inProgressLength, SEND_OUTPUT_CHANNELS, Serial);
sendValues(logItemsTransmitted, inProgressLength, SEND_OUTPUT_CHANNELS, Serial, serialStatusFlag);
break;
case SERIAL_TRANSMIT_TOOTH_INPROGRESS:

View File

@ -67,7 +67,7 @@ void legacySerialCommand(void)
break;
case 'A': // send x bytes of realtime values
sendValues(0, LOG_ENTRY_SIZE, 0x31, Serial); //send values to serial0
sendValues(0, LOG_ENTRY_SIZE, 0x31, Serial, serialStatusFlag); //send values to serial0
firstCommsRequest = false;
break;
@ -294,7 +294,7 @@ void legacySerialCommand(void)
if(cmd == 0x30) //Send output channels command 0x30 is 48dec
{
sendValues(offset, length, cmd, Serial);
sendValues(offset, length, cmd, Serial, serialStatusFlag);
}
else
{
@ -640,7 +640,7 @@ void legacySerialHandler(byte cmd, Stream &targetPort, SerialStatus &targetStatu
if(cmd == 0x30) //Send output channels command 0x30 is 48dec
{
sendValues(offset, length, cmd, targetPort);
sendValues(offset, length, cmd, targetPort, targetStatusFlag);
}
else
{
@ -660,19 +660,19 @@ void legacySerialHandler(byte cmd, Stream &targetPort, SerialStatus &targetStatu
* @param offset - Start field number
* @param packetLength - Length of actual message (after possible ack/confirm headers)
* @param cmd - ??? - Will be used as some kind of ack on CANSerial
* @param portNum - Port number (0=Serial, 3=CANSerial)
* @param targetPort - The HardwareSerial device that will be transmitted to
* @param targetStatusFlag - The status flag that will be set to indicate the status of the transmission
* E.g. tuning sw command 'A' (Send all values) will send data from field number 0, LOG_ENTRY_SIZE fields.
* @return the current values of a fixed group of variables
*/
void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort)
void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag)
{
#if defined(CANSerial_AVAILABLE)
if (&targetPort == &CANSerial)
{
serialSecondaryStatusFlag = SERIAL_TRANSMIT_INPROGRESS_LEGACY;
//CAN serial
if( (configPage9.secondarySerialProtocol == SECONDARY_SERIAL_PROTO_GENERIC) || (configPage9.secondarySerialProtocol == SECONDARY_SERIAL_PROTO_REALDASH))
{
#if defined(CANSerial_AVAILABLE)
if (cmd == 0x30)
{
CANSerial.write("r"); //confirm cmd type
@ -688,12 +688,11 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &target
CANSerial.write(cmd); // send command type , 0x32 (dec50) is ascii '0'
CANSerial.write(NEW_CAN_PACKET_SIZE); // send the packet size the receiving device should expect.
}
#endif
}
}
else
#endif
{
serialStatusFlag = SERIAL_TRANSMIT_INPROGRESS_LEGACY;
if(firstCommsRequest)
{
firstCommsRequest = false;
@ -702,6 +701,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &target
}
//
targetStatusFlag = SERIAL_TRANSMIT_INPROGRESS_LEGACY;
currentStatus.spark ^= (-currentStatus.hasSync ^ currentStatus.spark) & (1U << BIT_SPARK_SYNC); //Set the sync bit of the Spark variable to match the hasSync variable
for(byte x=0; x<packetLength; x++)
@ -727,17 +727,10 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &target
}
if (&targetPort == &Serial)
{
serialStatusFlag = SERIAL_INACTIVE;
while(Serial.available()) { Serial.read(); }
// Reset any flags that are being used to trigger page refreshes
BIT_CLEAR(currentStatus.status3, BIT_STATUS3_VSS_REFRESH);
}
else if(&targetPort == &CANSerial)
{
serialSecondaryStatusFlag = SERIAL_INACTIVE;
}
targetStatusFlag = SERIAL_INACTIVE;
while(targetPort.available()) { targetPort.read(); }
// Reset any flags that are being used to trigger page refreshes
BIT_CLEAR(currentStatus.status3, BIT_STATUS3_VSS_REFRESH);
}

View File

@ -75,7 +75,7 @@ extern byte inProgressLength;
void legacySerialCommand(void);//This is the heart of the Command Line Interpreter. All that needed to be done was to make it human readable.
void legacySerialHandler(byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag);
void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort);
void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &targetPort, SerialStatus &targetStatusFlag);
void sendValuesLegacy(void);
void sendPage(void);
void sendPageASCII(void);