From 4aeff69a7eb2e942d08fec7c70be39535498b1be Mon Sep 17 00:00:00 2001 From: Fisch Date: Mon, 1 Jun 2020 18:08:00 +0200 Subject: [PATCH] change Serial1 to Serial2 and Serial2 to Serial3 because naming changes? --- controller/controller.ino | 8 ++++---- controller/serialControl.ino | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/controller/controller.ino b/controller/controller.ino index 70244e2..4922a63 100644 --- a/controller/controller.ino +++ b/controller/controller.ino @@ -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; diff --git a/controller/serialControl.ino b/controller/serialControl.ino index b55bed0..c840d6d 100644 --- a/controller/serialControl.ino +++ b/controller/serialControl.ino @@ -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 {