diff --git a/Arduino/Debugging Arduino Sketches/test_serial/test_serial.ino b/Arduino/Debugging Arduino Sketches/test_serial/test_serial.ino index c1cb465..b0982da 100644 --- a/Arduino/Debugging Arduino Sketches/test_serial/test_serial.ino +++ b/Arduino/Debugging Arduino Sketches/test_serial/test_serial.ino @@ -12,6 +12,10 @@ void setup() void loop() { + while (Serial.available()) { + char v = Serial.read(); + SerialB.print("RX"); + } /* Press S to send messages from the arduino to the control panel. * // listen to the main com port 6 and echo to the serialb. @@ -57,6 +61,7 @@ void loop() sprintf(&(hexStr[0]), "%02x", (uint8_t)c); Serial.print(hexStr); }*/ + /* while (SerialB.available() > 0) { char c = SerialB.read(); @@ -65,5 +70,5 @@ void loop() //char hexStr[2]; //sprintf(&(hexStr[0]), "%02x\r\n", (uint8_t)c); Serial.print(c); - } + }*/ } diff --git a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/DatagramEncoder/GroundStation/GroundStation_DatagramEncoder.cpp b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/DatagramEncoder/GroundStation/GroundStation_DatagramEncoder.cpp index 44fbeb4..151e9c3 100644 --- a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/DatagramEncoder/GroundStation/GroundStation_DatagramEncoder.cpp +++ b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/DatagramEncoder/GroundStation/GroundStation_DatagramEncoder.cpp @@ -43,7 +43,7 @@ Datagram GroundStation::DatagramEncoder::Encode(OperationID operationId, std::ve Datagram GroundStation::DatagramEncoder::Handshake() { std::vector msgData; - msgData.push_back(FCPI_DIR_FROM_GROUND_STATION); + msgData.push_back(FCPI_DIR_TO_GROUND_STATION); msgData.push_back(OperationID::HANDSHAKE); return Datagram(SatVersion::V_NA, "NA", msgData, false); diff --git a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.cpp b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.cpp index 91cf9b9..48878e7 100644 --- a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.cpp +++ b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.cpp @@ -24,8 +24,8 @@ #include "Frame.h" -Frame::Frame() { - +Frame::Frame() + : hasFunctionId(false), hasOptionalData(false), encrypted(false) { } Frame::~Frame() { @@ -85,7 +85,10 @@ uint8_t Frame::GetByteAt(uint32_t index) std::vector Frame::Serialize() { std::vector data; - data.insert(data.end(), this->optionalData.begin(), this->optionalData.end()); + if (this->hasOptionalData) + { + data.insert(data.end(), this->optionalData.begin(), this->optionalData.end()); + } return data; } @@ -93,18 +96,26 @@ std::string Frame::ToHexString() { std::string frameStr; - char hexChar[5]; - hexChar[4] = '\0'; - sprintf(&(hexChar[0]), "%02x, ", this->functionId); - frameStr.append(hexChar); - - for (uint8_t value : this->optionalData) { + if (this->hasFunctionId) + { char hexChar[5]; hexChar[4] = '\0'; - sprintf(&(hexChar[0]), "%02x, ", value); + sprintf(&(hexChar[0]), "%02x, ", this->functionId); frameStr.append(hexChar); } + if (this->hasOptionalData) + { + for (uint8_t value : this->optionalData) + { + char hexChar[5]; + hexChar[4] = '\0'; + sprintf(&(hexChar[0]), "%02x, ", value); + frameStr.append(hexChar); + } + } + + return frameStr; } diff --git a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.h b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.h index 5f6fa39..3f36c1f 100644 --- a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.h +++ b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Frame.h @@ -50,7 +50,9 @@ class Frame { SatVersion satVersion; int16_t functionId; std::vector optionalData; + bool hasOptionalData; + bool hasFunctionId; }; diff --git a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/mainwindow.ui b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/mainwindow.ui index bfce46a..56e3d02 100644 --- a/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/mainwindow.ui +++ b/Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/mainwindow.ui @@ -33,7 +33,7 @@ QTabWidget::Triangular - 0 + 2 Qt::ElideRight @@ -3838,28 +3838,28 @@ Sleep Interval (mV): - - + + - - + + + + - - - - + + - - + - - + + + + + + - + - - -