Update sagittactl to v10.7 #605
@ -1,10 +1,11 @@
|
|||||||
#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>
|
||||||
}
|
}
|
||||||
|
|
||||||
ArcsecDatalinkLayer::ArcsecDatalinkLayer() : decodeRingBuf(BUFFER_LENGTHS, true) { slipInit(); }
|
ArcsecDatalinkLayer::ArcsecDatalinkLayer() : decodeRingBuf(BUFFER_LENGTHS, true) {}
|
||||||
|
|
||||||
ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
|
ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
|
||||||
|
|
||||||
@ -15,35 +16,50 @@ 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
|
slip_error_t slipError =
|
||||||
slipInfo.length = 0;
|
slip_decode_frame(decodedRxFrame, &rxFrameSize, rxAnalysisBuffer + startIdx,
|
||||||
|
idx - startIdx + 1, &encodedDataSize, ARC_DEF_SAGITTA_SLIP_ID);
|
||||||
|
decodeRingBuf.deleteData(idx + 1);
|
||||||
|
switch (slipError) {
|
||||||
|
case (SLIP_OK): {
|
||||||
if (decodedFrame != nullptr) {
|
if (decodedFrame != nullptr) {
|
||||||
*decodedFrame = decodedRxFrame;
|
*decodedFrame = decodedRxFrame;
|
||||||
}
|
}
|
||||||
frameLen = rxFrameSize;
|
frameLen = rxFrameSize;
|
||||||
decodeRingBuf.deleteData(idx);
|
|
||||||
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);
|
}
|
||||||
return DEC_IN_PROGRESS;
|
return DEC_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,18 +72,11 @@ ReturnValue_t ArcsecDatalinkLayer::feedData(const uint8_t* rawData, size_t rawDa
|
|||||||
return decodeRingBuf.writeData(rawData, rawDataLen);
|
return decodeRingBuf.writeData(rawData, rawDataLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArcsecDatalinkLayer::reset() {
|
void ArcsecDatalinkLayer::reset() { decodeRingBuf.clear(); }
|
||||||
slipInit();
|
|
||||||
decodeRingBuf.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArcsecDatalinkLayer::slipInit() {
|
|
||||||
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>
|
||||||
@ -880,7 +884,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case (startracker::REQ_TIME): {
|
case (startracker::REQ_TIME): {
|
||||||
result = handleTm(packet, timeSet, startracker::TimeSet::SIZE);
|
result = handleTm(packet, timeSet, startracker::TimeSet::SIZE, "REQ_TIME");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::PING_REQUEST): {
|
case (startracker::PING_REQUEST): {
|
||||||
@ -895,7 +899,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_VERSION): {
|
case (startracker::REQ_VERSION): {
|
||||||
result = handleTm(packet, versionSet, startracker::VersionSet::SIZE);
|
result = handleTm(packet, versionSet, startracker::VersionSet::SIZE, "REQ_VERSION");
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -906,23 +910,23 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_INTERFACE): {
|
case (startracker::REQ_INTERFACE): {
|
||||||
result = handleTm(packet, interfaceSet, startracker::InterfaceSet::SIZE);
|
result = handleTm(packet, interfaceSet, startracker::InterfaceSet::SIZE, "REQ_INTERFACE");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_POWER): {
|
case (startracker::REQ_POWER): {
|
||||||
result = handleTm(packet, powerSet, startracker::PowerSet::SIZE);
|
result = handleTm(packet, powerSet, startracker::PowerSet::SIZE, "REQ_POWER");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_SOLUTION): {
|
case (startracker::REQ_SOLUTION): {
|
||||||
result = handleTm(packet, solutionSet, startracker::SolutionSet::SIZE);
|
result = handleTm(packet, solutionSet, startracker::SolutionSet::SIZE, "REQ_SOLUTION");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_TEMPERATURE): {
|
case (startracker::REQ_TEMPERATURE): {
|
||||||
result = handleTm(packet, temperatureSet, startracker::TemperatureSet::SIZE);
|
result = handleTm(packet, temperatureSet, startracker::TemperatureSet::SIZE, "REQ_TEMP");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_HISTOGRAM): {
|
case (startracker::REQ_HISTOGRAM): {
|
||||||
result = handleTm(packet, histogramSet, startracker::HistogramSet::SIZE);
|
result = handleTm(packet, histogramSet, startracker::HistogramSet::SIZE, "REQ_HISTO");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (startracker::SUBSCRIPTION):
|
case (startracker::SUBSCRIPTION):
|
||||||
@ -1972,7 +1976,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
|
ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
|
||||||
size_t size) {
|
size_t size, const char* context) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t status = startracker::getStatusField(rawFrame);
|
uint8_t status = startracker::getStatusField(rawFrame);
|
||||||
if (status != startracker::STATUS_OK) {
|
if (status != startracker::STATUS_OK) {
|
||||||
@ -1988,7 +1992,8 @@ ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDat
|
|||||||
dataset.setValidityBufferGeneration(false);
|
dataset.setValidityBufferGeneration(false);
|
||||||
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed" << std::endl;
|
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed for " << context
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
dataset.setValidityBufferGeneration(true);
|
dataset.setValidityBufferGeneration(true);
|
||||||
dataset.setValidity(true, true);
|
dataset.setValidity(true, true);
|
||||||
|
@ -481,7 +481,8 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
*
|
*
|
||||||
* @return returnvalue::OK if successful, otherwise error return value
|
* @return returnvalue::OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size);
|
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size,
|
||||||
|
const char* context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks if star tracker is in valid mode for executing the received command.
|
* @brief Checks if star tracker is in valid mode for executing the received command.
|
||||||
|
@ -641,7 +641,7 @@ class TimeSet : public StaticLocalDataSet<TIME_SET_ENTRIES> {
|
|||||||
*/
|
*/
|
||||||
class SolutionSet : public StaticLocalDataSet<SOLUTION_SET_ENTRIES> {
|
class SolutionSet : public StaticLocalDataSet<SOLUTION_SET_ENTRIES> {
|
||||||
public:
|
public:
|
||||||
static const size_t SIZE = 78;
|
static const size_t SIZE = 79;
|
||||||
|
|
||||||
SolutionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SOLUTION_SET_ID) {}
|
SolutionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SOLUTION_SET_ID) {}
|
||||||
|
|
||||||
|
2
thirdparty/sagittactl
vendored
2
thirdparty/sagittactl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 29e876671a72fcdb0b393e2f692303725f00724f
|
Subproject commit 2c066bfbe9ef8d6b00e142b8f48d45988a469618
|
Loading…
Reference in New Issue
Block a user