it appears to work well now
This commit is contained in:
@ -53,6 +53,8 @@ static const ReturnValue_t MISSING_END_SIGN = MAKE_RETURN_CODE(0xB4);
|
||||
static const ReturnValue_t NO_REPLY = MAKE_RETURN_CODE(0xB5);
|
||||
//! [EXPORT] : [COMMENT] Expected a start marker as first byte
|
||||
static const ReturnValue_t NO_START_MARKER = MAKE_RETURN_CODE(0xB6);
|
||||
//! [EXPORT] : [COMMENT] Timeout when reading reply
|
||||
static const ReturnValue_t SPI_READ_TIMEOUT = MAKE_RETURN_CODE(0xB7);
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::RW_HANDLER;
|
||||
|
||||
@ -62,7 +64,7 @@ static constexpr Event ERROR_STATE = MAKE_EVENT(1, severity::HIGH);
|
||||
static constexpr Event RESET_OCCURED = event::makeEvent(SUBSYSTEM_ID, 2, severity::LOW);
|
||||
|
||||
//! Minimal delay as specified by the datasheet.
|
||||
static const uint32_t SPI_REPLY_DELAY = 70000; // us
|
||||
static const uint32_t SPI_REPLY_DELAY = 20000; // us
|
||||
|
||||
enum PoolIds : lp_id_t {
|
||||
TEMPERATURE_C,
|
||||
@ -272,40 +274,55 @@ class RwSpeedActuationSet : public StaticLocalDataSet<2> {
|
||||
|
||||
} // namespace rws
|
||||
|
||||
/**
|
||||
* Raw pointer overlay to hold the different frames received from the reaction
|
||||
* wheel in a raw buffer and send them to the device handler.
|
||||
*/
|
||||
struct RwReplies {
|
||||
friend class RwPollingTask;
|
||||
|
||||
public:
|
||||
RwReplies(const uint8_t* rawData) : rawData(const_cast<uint8_t*>(rawData)) { initPointers(); }
|
||||
|
||||
const uint8_t* getClearLastResetStatusReply() const { return clearLastResetStatusReply; }
|
||||
const uint8_t* getClearLastResetStatusReply() const { return clearLastResetStatusReply + 1; }
|
||||
bool wasClearLastRsetStatusReplyRead() const { return clearLastResetStatusReply[0]; }
|
||||
|
||||
const uint8_t* getGetLastResetStatusReply() const { return getLastResetStatusReply; }
|
||||
const uint8_t* getGetLastResetStatusReply() const { return getLastResetStatusReply + 1; }
|
||||
bool wasGetLastStatusReplyRead() const { return getLastResetStatusReply[0]; }
|
||||
|
||||
const uint8_t* getHkDataReply() const { return hkDataReply; }
|
||||
const uint8_t* getHkDataReply() const { return hkDataReply + 1; }
|
||||
bool wasHkDataReplyRead() const { return hkDataReply[0]; }
|
||||
|
||||
const uint8_t* getInitRwControllerReply() const { return initRwControllerReply; }
|
||||
const uint8_t* getInitRwControllerReply() const { return initRwControllerReply + 1; }
|
||||
bool wasInitRwControllerReplyRead() const { return initRwControllerReply[0]; }
|
||||
|
||||
const uint8_t* getRawData() const { return rawData; }
|
||||
|
||||
const uint8_t* getReadTemperatureReply() const { return readTemperatureReply; }
|
||||
const uint8_t* getReadTemperatureReply() const { return readTemperatureReply + 1; }
|
||||
bool wasReadTemperatureReplySet() const { return readTemperatureReply[0]; }
|
||||
|
||||
const uint8_t* getRwStatusReply() const { return rwStatusReply; }
|
||||
const uint8_t* getRwStatusReply() const { return rwStatusReply + 1; }
|
||||
bool wasRwStatusRead() const { return rwStatusReply[0]; }
|
||||
|
||||
const uint8_t* getSetSpeedReply() const { return setSpeedReply; }
|
||||
const uint8_t* getSetSpeedReply() const { return setSpeedReply + 1; }
|
||||
bool wasSetSpeedReplyRead() const { return setSpeedReply[0]; }
|
||||
|
||||
private:
|
||||
RwReplies(uint8_t* rwData) : rawData(rwData) { initPointers(); }
|
||||
|
||||
/**
|
||||
* The first byte of the reply buffers contains a flag which shows whether that
|
||||
* frame was read from the reaction wheel at least once.
|
||||
*/
|
||||
void initPointers() {
|
||||
rwStatusReply = rawData;
|
||||
setSpeedReply = rawData + rws::SIZE_GET_RW_STATUS;
|
||||
getLastResetStatusReply = setSpeedReply + rws::SIZE_SET_SPEED_REPLY;
|
||||
clearLastResetStatusReply = getLastResetStatusReply + rws::SIZE_GET_RESET_STATUS;
|
||||
readTemperatureReply = clearLastResetStatusReply + rws::SIZE_CLEAR_RESET_STATUS;
|
||||
hkDataReply = readTemperatureReply + rws::SIZE_GET_TEMPERATURE_REPLY;
|
||||
initRwControllerReply = hkDataReply + rws::SIZE_GET_TELEMETRY_REPLY;
|
||||
dummyPointer = initRwControllerReply + rws::SIZE_INIT_RW;
|
||||
setSpeedReply = rawData + rws::SIZE_GET_RW_STATUS + 1;
|
||||
getLastResetStatusReply = setSpeedReply + rws::SIZE_SET_SPEED_REPLY + 1;
|
||||
clearLastResetStatusReply = getLastResetStatusReply + rws::SIZE_GET_RESET_STATUS + 1;
|
||||
readTemperatureReply = clearLastResetStatusReply + rws::SIZE_CLEAR_RESET_STATUS + 1;
|
||||
hkDataReply = readTemperatureReply + rws::SIZE_GET_TEMPERATURE_REPLY + 1;
|
||||
initRwControllerReply = hkDataReply + rws::SIZE_GET_TELEMETRY_REPLY + 1;
|
||||
dummyPointer = initRwControllerReply + rws::SIZE_INIT_RW + 1;
|
||||
}
|
||||
uint8_t* rawData;
|
||||
uint8_t* rwStatusReply;
|
||||
|
Reference in New Issue
Block a user