change Serial1 to Serial2 and Serial2 to Serial3 because naming changes?

This commit is contained in:
interfisch 2020-06-01 18:08:00 +02:00
parent f64f910f50
commit 4aeff69a7e
2 changed files with 10 additions and 10 deletions

View File

@ -168,8 +168,8 @@ void setup()
Serial.begin(SERIAL_BAUD); //Debug and Program. A9=TX1, A10=RX1 (3v3 level)
Serial1.begin(SERIAL_CONTROL_BAUD); //control. A2=TX2, A3=RX2 (Serial1 is Usart 2). Marked with "1" on connector (Rear)
Serial2.begin(SERIAL_CONTROL_BAUD); //control. B10=TX3, B11=RX3 (Serial2 is Usart 3). Marked with "II" on connector (Front)
Serial2.begin(SERIAL_CONTROL_BAUD); //control. A2=TX2, A3=RX2 (Serial1 is Usart 2). Marked with "1" on connector (Rear)
Serial3.begin(SERIAL_CONTROL_BAUD); //control. B10=TX3, B11=RX3 (Serial2 is Usart 3). Marked with "II" on connector (Front)
// Pin Setup
pinMode(PIN_STARTLED, OUTPUT); //MODE=PWM (needs testing, mcu locks up when using writePWM()
@ -185,8 +185,8 @@ void setup()
pinMode(PIN_BRAKE, INPUT);
Serial.println("Initialized Serial");
Serial1.println("Initialized Serial1");
Serial2.println("Initialized Serial2");
Serial2.println("Initialized Serial1");
Serial3.println("Initialized Serial2");
currentmode = booting; //start in idle mode
requestmode = currentmode;

View File

@ -7,7 +7,7 @@ void SendSerial1(int16_t uSpeedLeft, int16_t uSpeedRight)
Command1.speedLeft = (int16_t)uSpeedLeft;
Command1.speedRight = (int16_t)uSpeedRight;
Command1.checksum = (uint16_t)(Command1.start ^ Command1.speedLeft ^ Command1.speedRight);
Serial1.write((uint8_t *) &Command1, sizeof(Command1));
Serial2.write((uint8_t *) &Command1, sizeof(Command1));
}
void SendSerial2(int16_t uSpeedLeft, int16_t uSpeedRight)
{
@ -16,15 +16,15 @@ void SendSerial2(int16_t uSpeedLeft, int16_t uSpeedRight)
Command2.speedLeft = (int16_t)uSpeedLeft;
Command2.speedRight = (int16_t)uSpeedRight;
Command2.checksum = (uint16_t)(Command2.start ^ Command2.speedLeft ^ Command2.speedRight);
Serial2.write((uint8_t *) &Command2, sizeof(Command2));
Serial3.write((uint8_t *) &Command2, sizeof(Command2));
}
// ########################## RECEIVE ##########################
void ReceiveSerial1()
{
// Check for new data availability in the Serial buffer
if ( Serial1.available() ) {
incomingByte1 = Serial1.read(); // Read the incoming byte
if ( Serial2.available() ) {
incomingByte1 = Serial2.read(); // Read the incoming byte
bufStartFrame1 = ((uint16_t)(incomingBytePrev1) << 8) + incomingByte1; // Construct the start frame
}
else {
@ -84,8 +84,8 @@ void ReceiveSerial1()
void ReceiveSerial2()
{
// Check for new data availability in the Serial buffer
if ( Serial2.available() ) {
incomingByte2 = Serial2.read(); // Read the incoming byte
if ( Serial3.available() ) {
incomingByte2 = Serial3.read(); // Read the incoming byte
bufStartFrame2 = ((uint16_t)(incomingBytePrev2) << 8) + incomingByte2; // Construct the start frame
}
else {