save before using prepareDataLessCmd
This commit is contained in:
parent
f583fc1d99
commit
e89719e398
@ -7,7 +7,7 @@
|
|||||||
RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
|
RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
|
||||||
LinuxLibgpioIF* gpioComIF, gpioId_t enableGpio) :
|
LinuxLibgpioIF* gpioComIF, gpioId_t enableGpio) :
|
||||||
DeviceHandlerBase(objectId, comIF, comCookie), gpioComIF(gpioComIF), enableGpio(enableGpio),
|
DeviceHandlerBase(objectId, comIF, comCookie), gpioComIF(gpioComIF), enableGpio(enableGpio),
|
||||||
temperatureSet(this), statusSet(this), lastResetStatusSet(this) {
|
temperatureSet(this), statusSet(this), lastResetStatusSet(this), tmDataset(this) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "RwHandler: Invalid com cookie" << std::endl;
|
sif::error << "RwHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
@ -113,6 +113,10 @@ ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand
|
|||||||
prepareGetTemperatureCmd();
|
prepareGetTemperatureCmd();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case (RwDefinitions::GET_TM): {
|
||||||
|
prepareGetTelemetryCmd();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -246,6 +250,29 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP
|
|||||||
localDataPoolMap.emplace(RwDefinitions::LAST_RESET_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
localDataPoolMap.emplace(RwDefinitions::LAST_RESET_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
||||||
localDataPoolMap.emplace(RwDefinitions::CURRRENT_RESET_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
localDataPoolMap.emplace(RwDefinitions::CURRRENT_RESET_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
||||||
|
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_LAST_RESET_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_MCU_TEMPERATURE, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_RW_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_CLC_MODE, new PoolEntry<uint8_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_RW_CURR_SPEED, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::TM_RW_REF_SPEED, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::INVALID_CRC_PACKETS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::INVALID_LEN_PACKETS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::INVALID_CMD_PACKETS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::EXECUTED_REPLIES, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::COMMAND_REPLIES, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_BYTES_WRITTEN, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_BYTES_READ, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_PARITY_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_NOISE_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_FRAME_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::UART_TOTAL_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_WRITTEN, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,15 +339,6 @@ void RwHandler::prepareInitRwCommand() {
|
|||||||
rawPacketLen = 3;
|
rawPacketLen = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RwHandler::prepareGetTemperatureCmd() {
|
|
||||||
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::GET_TEMPERATURE);
|
|
||||||
uint16_t crc = CRC::crc16ccitt(commandBuffer, 1, 0xFFFF);
|
|
||||||
commandBuffer[1] = static_cast<uint8_t>(crc & 0xFF);
|
|
||||||
commandBuffer[2] = static_cast<uint8_t>(crc >> 8 & 0xFF);
|
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDataLen) {
|
void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDataLen) {
|
||||||
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::SET_SPEED);
|
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::SET_SPEED);
|
||||||
|
|
||||||
@ -340,6 +358,24 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDa
|
|||||||
rawPacketLen = 9;
|
rawPacketLen = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RwHandler::prepareGetTemperatureCmd() {
|
||||||
|
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::GET_TEMPERATURE);
|
||||||
|
uint16_t crc = CRC::crc16ccitt(commandBuffer, 1, 0xFFFF);
|
||||||
|
commandBuffer[1] = static_cast<uint8_t>(crc & 0xFF);
|
||||||
|
commandBuffer[2] = static_cast<uint8_t>(crc >> 8 & 0xFF);
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rawPacketLen = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RwHandler::prepareGetTelemetryCmd() {
|
||||||
|
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::GET_TM);
|
||||||
|
uint16_t crc = CRC::crc16ccitt(commandBuffer, 1, 0xFFFF);
|
||||||
|
commandBuffer[1] = static_cast<uint8_t>(crc & 0xFF);
|
||||||
|
commandBuffer[2] = static_cast<uint8_t>(crc >> 8 & 0xFF);
|
||||||
|
rawPacket = commandBuffer;
|
||||||
|
rawPacketLen = 3;
|
||||||
|
}
|
||||||
|
|
||||||
void RwHandler::handleResetStatusReply(const uint8_t* packet) {
|
void RwHandler::handleResetStatusReply(const uint8_t* packet) {
|
||||||
PoolReadGuard rg(&lastResetStatusSet);
|
PoolReadGuard rg(&lastResetStatusSet);
|
||||||
uint8_t offset = 2;
|
uint8_t offset = 2;
|
||||||
|
@ -88,6 +88,7 @@ private:
|
|||||||
RwDefinitions::TemperatureSet temperatureSet;
|
RwDefinitions::TemperatureSet temperatureSet;
|
||||||
RwDefinitions::StatusSet statusSet;
|
RwDefinitions::StatusSet statusSet;
|
||||||
RwDefinitions::LastResetSatus lastResetStatusSet;
|
RwDefinitions::LastResetSatus lastResetStatusSet;
|
||||||
|
RwDefinitions::TmDataset tmDataset;
|
||||||
|
|
||||||
|
|
||||||
uint8_t commandBuffer[RwDefinitions::MAX_CMD_SIZE];
|
uint8_t commandBuffer[RwDefinitions::MAX_CMD_SIZE];
|
||||||
|
@ -17,7 +17,30 @@ enum PoolIds: lp_id_t {
|
|||||||
STATE,
|
STATE,
|
||||||
CLC_MODE,
|
CLC_MODE,
|
||||||
LAST_RESET_STATUS,
|
LAST_RESET_STATUS,
|
||||||
CURRRENT_RESET_STATUS
|
CURRRENT_RESET_STATUS,
|
||||||
|
TM_LAST_RESET_STATUS,
|
||||||
|
TM_MCU_TEMPERATURE,
|
||||||
|
TM_RW_STATE,
|
||||||
|
TM_CLC_MODE,
|
||||||
|
TM_RW_CURR_SPEED,
|
||||||
|
TM_RW_REF_SPEED,
|
||||||
|
INVALID_CRC_PACKETS,
|
||||||
|
INVALID_LEN_PACKETS,
|
||||||
|
INVALID_CMD_PACKETS,
|
||||||
|
EXECUTED_REPLIES,
|
||||||
|
COMMAND_REPLIES,
|
||||||
|
UART_BYTES_WRITTEN,
|
||||||
|
UART_BYTES_READ,
|
||||||
|
UART_PARITY_ERRORS,
|
||||||
|
UART_NOISE_ERRORS,
|
||||||
|
UART_FRAME_ERRORS,
|
||||||
|
UART_REG_OVERRUN_ERRORS,
|
||||||
|
UART_TOTAL_ERRORS,
|
||||||
|
TOTAL_ERRORS,
|
||||||
|
SPI_BYTES_WRITTEN,
|
||||||
|
SPI_BYTES_READ,
|
||||||
|
SPI_REG_OVERRUN_ERRORS,
|
||||||
|
SPI_TOTAL_ERRORS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum States: uint8_t {
|
enum States: uint8_t {
|
||||||
@ -46,10 +69,12 @@ static const DeviceCommandId_t GET_RW_STATUS = 4;
|
|||||||
static const DeviceCommandId_t INIT_RW_CONTROLLER = 5;
|
static const DeviceCommandId_t INIT_RW_CONTROLLER = 5;
|
||||||
static const DeviceCommandId_t SET_SPEED = 6;
|
static const DeviceCommandId_t SET_SPEED = 6;
|
||||||
static const DeviceCommandId_t GET_TEMPERATURE = 8;
|
static const DeviceCommandId_t GET_TEMPERATURE = 8;
|
||||||
|
static const DeviceCommandId_t GET_TM = 9;
|
||||||
|
|
||||||
static const uint32_t TEMPERATURE_SET_ID = GET_TEMPERATURE;
|
static const uint32_t TEMPERATURE_SET_ID = GET_TEMPERATURE;
|
||||||
static const uint32_t STATUS_SET_ID = GET_RW_STATUS;
|
static const uint32_t STATUS_SET_ID = GET_RW_STATUS;
|
||||||
static const uint32_t LAST_RESET_ID = GET_LAST_RESET_STATUS;
|
static const uint32_t LAST_RESET_ID = GET_LAST_RESET_STATUS;
|
||||||
|
static const uint32_t TM_SET_ID = GET_TM;
|
||||||
|
|
||||||
static const size_t SIZE_GET_RESET_STATUS = 5;
|
static const size_t SIZE_GET_RESET_STATUS = 5;
|
||||||
static const size_t SIZE_CLEAR_RESET_STATUS = 4;
|
static const size_t SIZE_CLEAR_RESET_STATUS = 4;
|
||||||
@ -67,6 +92,7 @@ static const size_t MAX_REPLY_SIZE = SIZE_GET_TELEMETRY_REPLY;
|
|||||||
static const uint8_t LAST_RESET_ENTRIES = 2;
|
static const uint8_t LAST_RESET_ENTRIES = 2;
|
||||||
static const uint8_t TEMPERATURE_SET_ENTRIES = 1;
|
static const uint8_t TEMPERATURE_SET_ENTRIES = 1;
|
||||||
static const uint8_t STATUS_SET_ENTRIES = 4;
|
static const uint8_t STATUS_SET_ENTRIES = 4;
|
||||||
|
static const uint8_t TM_SET_ENTRIES = 22;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This dataset can be used to store the temperature of a reaction wheel.
|
* @brief This dataset can be used to store the temperature of a reaction wheel.
|
||||||
@ -133,6 +159,69 @@ public:
|
|||||||
PoolIds::CURRRENT_RESET_STATUS, this);
|
PoolIds::CURRRENT_RESET_STATUS, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This dataset stores telemetry data as specified in the datasheet of the nano avionics
|
||||||
|
* reaction wheels. https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/
|
||||||
|
* EIVE_IRS/Arbeitsdaten/08_Used%20Components/Nanoavionics_Reactionwheels&fileid=181622
|
||||||
|
*/
|
||||||
|
class TmDataset:
|
||||||
|
public StaticLocalDataSet<TM_SET_ENTRIES> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
TmDataset(HasLocalDataPoolIF* owner):
|
||||||
|
StaticLocalDataSet(owner, TM_SET_ID) {
|
||||||
|
}
|
||||||
|
|
||||||
|
TmDataset(object_id_t objectId):
|
||||||
|
StaticLocalDataSet(sid_t(objectId, TM_SET_ID)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
lp_var_t<uint8_t> lastResetStatus = lp_var_t<uint8_t>(sid.objectId,
|
||||||
|
PoolIds::TM_LAST_RESET_STATUS, this);
|
||||||
|
lp_var_t<uint32_t> mcuTemperature = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::TM_MCU_TEMPERATURE, this);
|
||||||
|
lp_var_t<uint8_t> rwState = lp_var_t<uint8_t>(sid.objectId,
|
||||||
|
PoolIds::TM_RW_STATE, this);
|
||||||
|
lp_var_t<uint8_t> rwClcMode = lp_var_t<uint8_t>(sid.objectId,
|
||||||
|
PoolIds::TM_CLC_MODE, this);
|
||||||
|
lp_var_t<int32_t> rwCurrSpeed = lp_var_t<int32_t>(sid.objectId,
|
||||||
|
PoolIds::TM_RW_CURR_SPEED, this);
|
||||||
|
lp_var_t<int32_t> rwRefSpeed = lp_var_t<int32_t>(sid.objectId,
|
||||||
|
PoolIds::TM_RW_REF_SPEED, this);
|
||||||
|
lp_var_t<uint32_t> numOfInvalidCrcPackets = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::INVALID_CRC_PACKETS, this);
|
||||||
|
lp_var_t<uint32_t> numOfInvalidLenPackets = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::INVALID_LEN_PACKETS, this);
|
||||||
|
lp_var_t<uint32_t> numOfInvalidCmdPackets = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::INVALID_CMD_PACKETS, this);
|
||||||
|
lp_var_t<uint32_t> numOfCmdExecutedReplies = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::EXECUTED_REPLIES, this);
|
||||||
|
lp_var_t<uint32_t> numOfCmdeplies = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::COMMAND_REPLIES, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfBytesWritten = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_BYTES_WRITTEN, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfBytesRead = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_BYTES_READ, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfParityErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_PARITY_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfNoiseErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_NOISE_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfFrameErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_FRAME_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> uartNumOfRegisterOverrunErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_REG_OVERRUN_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> uartTotalNumOfErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::UART_TOTAL_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> spiNumOfBytesWritten = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::SPI_BYTES_WRITTEN, this);
|
||||||
|
lp_var_t<uint32_t> spiNumOfBytesRead = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::SPI_BYTES_READ, this);
|
||||||
|
lp_var_t<uint32_t> spiNumOfRegisterOverrunErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::SPI_REG_OVERRUN_ERRORS, this);
|
||||||
|
lp_var_t<uint32_t> spiTotalNumOfErrors = lp_var_t<uint32_t>(sid.objectId,
|
||||||
|
PoolIds::SPI_TOTAL_ERRORS, this);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_ */
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_ */
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 09cab1941fad0bbe8fa54234f7513c61e22038ca
|
Subproject commit 78b68307825754b468404ee4ff006ee87e0bdd5f
|
Loading…
Reference in New Issue
Block a user