some more improvements for DLL
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...

This commit is contained in:
2023-03-22 10:38:41 +01:00
parent 57f5a22b04
commit d824f8ba9e
5 changed files with 46 additions and 54 deletions

View File

@ -25,6 +25,8 @@ class ArcsecDatalinkLayer {
static const uint8_t STATUS_OK = 0;
static constexpr size_t BUFFER_LENGTHS = 4096;
ArcsecDatalinkLayer();
virtual ~ArcsecDatalinkLayer();
@ -36,16 +38,17 @@ class ArcsecDatalinkLayer {
*/
ReturnValue_t feedData(const uint8_t* rawData, size_t rawDataLen);
ReturnValue_t checkRingBufForFrame(const uint8_t** decodedFrame, size_t& frameLen);
/**
* @brief Applies decoding to data referenced by rawData pointer
* TODO: To be deleted soon, replaced by proper buffering.
* @param rawData Pointer to raw data received from star tracker
* @param rawDataSize Size of raw data stream
* @param remainingBytes Number of bytes left
* Runs the arcsec datalink layer decoding algorithm on the data in the ring buffer, decoding
* frames in the process.
* @param decodedFrame
* @param frameLen
* @return
* - returnvalue::OK if a frame was found
* - DEC_IN_PROGRESS if frame decoding is in progress
* - Anything else is a decoding error
*/
// ReturnValue_t decodeFrame(const uint8_t* rawData, size_t rawDataSize, size_t* bytesLeft);
ReturnValue_t checkRingBufForFrame(const uint8_t** decodedFrame, size_t& frameLen);
/**
* @brief SLIP encodes data pointed to by data pointer.
@ -55,15 +58,19 @@ class ArcsecDatalinkLayer {
*/
void encodeFrame(const uint8_t* data, size_t length, const uint8_t** txFrame, size_t& frameLen);
void reset();
private:
static const uint8_t ID_OFFSET = 1;
static const uint8_t STATUS_OFFSET = 2;
// Used by arcsec slip decoding function process received data
uint8_t rxBuffer[startracker::MAX_FRAME_SIZE];
// User to buffer and analyse data and allow feeding and checking for frames asychronously.
SimpleRingBuffer decodeRingBuf;
uint8_t rxAnalysisBuffer[4096];
uint8_t rxAnalysisBuffer[BUFFER_LENGTHS];
// Used by arcsec slip decoding function to process received data. This should only be written
// to or read from by arcsec functions!
uint8_t rxBufferArc[startracker::MAX_FRAME_SIZE];
// Decoded frame will be copied to this buffer
uint8_t decodedRxFrame[startracker::MAX_FRAME_SIZE];
// Size of decoded frame