Update sagittactl to v10.7 #605
@ -1,6 +1,7 @@
|
|||||||
#include "ArcsecDatalinkLayer.h"
|
#include "ArcsecDatalinkLayer.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <wire/common/SLIP.h>
|
||||||
#include <wire/common/misc.h>
|
#include <wire/common/misc.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,35 +16,73 @@ ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedF
|
|||||||
return DEC_IN_PROGRESS;
|
return DEC_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
|
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
|
||||||
|
|
||||||
|
bool startFound = false;
|
||||||
|
size_t startIdx = 0;
|
||||||
for (size_t idx = 0; idx < currentLen; idx++) {
|
for (size_t idx = 0; idx < currentLen; idx++) {
|
||||||
enum arc_dec_result decResult =
|
if (rxAnalysisBuffer[idx] != SLIP_START_AND_END) {
|
||||||
arc_transport_decode_body(rxAnalysisBuffer[idx], &slipInfo, decodedRxFrame, &rxFrameSize);
|
continue;
|
||||||
switch (decResult) {
|
|
||||||
case ARC_DEC_INPROGRESS: {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case ARC_DEC_ERROR: {
|
if (not startFound) {
|
||||||
decodeRingBuf.deleteData(idx);
|
startFound = true;
|
||||||
return returnvalue::FAILED;
|
startIdx = idx;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
case ARC_DEC_ASYNC:
|
// Now we can try decoding the whole frame.
|
||||||
case ARC_DEC_SYNC: {
|
size_t encodedDataSize = 0;
|
||||||
// Reset length of SLIP struct for next frame
|
// TODO: Find SLIP ID
|
||||||
slipInfo.length = 0;
|
slip_error_t slipError = slip_decode_frame(
|
||||||
if (decodedFrame != nullptr) {
|
decodedRxFrame, &rxFrameSize, rxAnalysisBuffer + startIdx,
|
||||||
*decodedFrame = decodedRxFrame;
|
sizeof(rxAnalysisBuffer) - startIdx, &encodedDataSize, ARC_DEF_SAGITTA_SLIP_ID);
|
||||||
}
|
decodeRingBuf.deleteData(idx + 1);
|
||||||
frameLen = rxFrameSize;
|
switch (slipError) {
|
||||||
decodeRingBuf.deleteData(idx);
|
case (SLIP_OK): {
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
default:
|
case (SLIP_BAD_CRC): {
|
||||||
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
return CRC_FAILURE;
|
||||||
break;
|
}
|
||||||
|
case (SLIP_OVERFLOW): {
|
||||||
|
return SLIP_OVERFLOW_RETVAL;
|
||||||
|
}
|
||||||
|
// Should not happen, we searched for start and end marker..
|
||||||
|
case (SLIP_NO_END): {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
case (SLIP_ID_MISMATCH): {
|
||||||
|
return SLIP_ID_MISSMATCH_RETVAL;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
decodeRingBuf.deleteData(currentLen);
|
}
|
||||||
|
// switch (decResult) {
|
||||||
|
// case ARC_DEC_INPROGRESS: {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case ARC_DEC_ERROR: {
|
||||||
|
// decodeRingBuf.deleteData(idx);
|
||||||
|
// return returnvalue::FAILED;
|
||||||
|
// }
|
||||||
|
// case ARC_DEC_ASYNC:
|
||||||
|
// case ARC_DEC_SYNC: {
|
||||||
|
// // Reset length of SLIP struct for next frame
|
||||||
|
// slipInfo.length = 0;
|
||||||
|
// if (decodedFrame != nullptr) {
|
||||||
|
// *decodedFrame = decodedRxFrame;
|
||||||
|
// }
|
||||||
|
// frameLen = rxFrameSize;
|
||||||
|
// decodeRingBuf.deleteData(idx);
|
||||||
|
// return returnvalue::OK;
|
||||||
|
// }
|
||||||
|
// default:
|
||||||
|
// sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
||||||
|
// break;
|
||||||
|
// return returnvalue::FAILED;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// decodeRingBuf.deleteData(currentLen);
|
||||||
return DEC_IN_PROGRESS;
|
return DEC_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,17 +96,17 @@ ReturnValue_t ArcsecDatalinkLayer::feedData(const uint8_t* rawData, size_t rawDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArcsecDatalinkLayer::reset() {
|
void ArcsecDatalinkLayer::reset() {
|
||||||
slipInit();
|
// slipInit();
|
||||||
decodeRingBuf.clear();
|
decodeRingBuf.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArcsecDatalinkLayer::slipInit() {
|
// void ArcsecDatalinkLayer::slipInit() {
|
||||||
slip_decode_init(rxBufferArc, sizeof(rxBufferArc), &slipInfo);
|
// slip_decode_init(rxBufferArc, sizeof(rxBufferArc), &slipInfo);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, size_t length, const uint8_t** txFrame,
|
void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, size_t length, const uint8_t** txFrame,
|
||||||
size_t& size) {
|
size_t& size) {
|
||||||
arc_transport_encode_body(data, length, txEncoded, &size);
|
slip_encode_frame(data, length, txEncoded, &size, ARC_DEF_SAGITTA_SLIP_ID);
|
||||||
if (txFrame != nullptr) {
|
if (txFrame != nullptr) {
|
||||||
*txFrame = txEncoded;
|
*txFrame = txEncoded;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ class ArcsecDatalinkLayer {
|
|||||||
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xA1);
|
||||||
//! [EXPORT] : [COMMENT] Detected CRC failure in received frame
|
//! [EXPORT] : [COMMENT] Detected CRC failure in received frame
|
||||||
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA2);
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||||
|
static const ReturnValue_t SLIP_OVERFLOW_RETVAL = MAKE_RETURN_CODE(0xA3);
|
||||||
|
static const ReturnValue_t SLIP_ID_MISSMATCH_RETVAL = MAKE_RETURN_CODE(0xA4);
|
||||||
|
|
||||||
static const uint8_t STATUS_OK = 0;
|
static const uint8_t STATUS_OK = 0;
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ class ArcsecDatalinkLayer {
|
|||||||
// Decoded frame will be copied to this buffer
|
// Decoded frame will be copied to this buffer
|
||||||
uint8_t decodedRxFrame[startracker::MAX_FRAME_SIZE];
|
uint8_t decodedRxFrame[startracker::MAX_FRAME_SIZE];
|
||||||
// Size of decoded frame
|
// Size of decoded frame
|
||||||
uint32_t rxFrameSize = 0;
|
size_t rxFrameSize = 0;
|
||||||
|
|
||||||
// Buffer where encoded frames will be stored. First byte of encoded frame represents type of
|
// Buffer where encoded frames will be stored. First byte of encoded frame represents type of
|
||||||
// reply
|
// reply
|
||||||
@ -85,7 +87,7 @@ class ArcsecDatalinkLayer {
|
|||||||
// Size of encoded frame
|
// Size of encoded frame
|
||||||
uint32_t txFrameSize = 0;
|
uint32_t txFrameSize = 0;
|
||||||
|
|
||||||
slip_decode_state slipInfo;
|
// slip_decode_state slipInfo;
|
||||||
|
|
||||||
void slipInit();
|
void slipInit();
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
#include <mission/acs/str/strJsonCommands.h>
|
#include <mission/acs/str/strJsonCommands.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <sagitta/client/arc_client.h>
|
#include <sagitta/client/actionreq.h>
|
||||||
|
#include <sagitta/client/client_tm_structs.h>
|
||||||
|
#include <sagitta/client/parameter.h>
|
||||||
|
#include <sagitta/client/telemetry.h>
|
||||||
|
#include <wire/common/genericstructs.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
2
thirdparty/sagittactl
vendored
2
thirdparty/sagittactl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 29e876671a72fcdb0b393e2f692303725f00724f
|
Subproject commit 11829cdacf764f4e5f6bc6755be3096e92f146f1
|
Loading…
Reference in New Issue
Block a user