added init command
This commit is contained in:
parent
034f07ebba
commit
3193d007c7
@ -55,7 +55,8 @@ ReturnValue_t RwHandler::buildNormalDeviceCommand(DeviceCommandId_t * id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RwHandler::buildTransitionDeviceCommand(DeviceCommandId_t * id) {
|
ReturnValue_t RwHandler::buildTransitionDeviceCommand(DeviceCommandId_t * id) {
|
||||||
return RETURN_OK;
|
*id = RwDefinitions::INIT_RW_CONTROLLER;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
@ -73,6 +74,10 @@ ReturnValue_t RwHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand
|
|||||||
prepareGetStatusCmd(commandData, commandDataLen);
|
prepareGetStatusCmd(commandData, commandDataLen);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
case (RwDefinitions::INIT_RW_CONTROLLER): {
|
||||||
|
prepareInitRwCommand();
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
case (RwDefinitions::SET_SPEED): {
|
case (RwDefinitions::SET_SPEED): {
|
||||||
if (commandDataLen != 6) {
|
if (commandDataLen != 6) {
|
||||||
sif::error << "RwHandler::buildCommandFromCommand: Received set speed command with"
|
sif::error << "RwHandler::buildCommandFromCommand: Received set speed command with"
|
||||||
@ -100,6 +105,7 @@ void RwHandler::fillCommandAndReplyMap() {
|
|||||||
this->insertInCommandMap(RwDefinitions::RESET_MCU);
|
this->insertInCommandMap(RwDefinitions::RESET_MCU);
|
||||||
this->insertInCommandAndReplyMap(RwDefinitions::GET_RW_STATUS, 1, &statusSet,
|
this->insertInCommandAndReplyMap(RwDefinitions::GET_RW_STATUS, 1, &statusSet,
|
||||||
RwDefinitions::SIZE_GET_RW_STATUS);
|
RwDefinitions::SIZE_GET_RW_STATUS);
|
||||||
|
this->insertInCommandMap(RwDefinitions::INIT_RW_CONTROLLER);
|
||||||
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, &temperatureSet,
|
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, &temperatureSet,
|
||||||
RwDefinitions::SIZE_GET_TEMPERATURE_REPLY);
|
RwDefinitions::SIZE_GET_TEMPERATURE_REPLY);
|
||||||
this->insertInCommandAndReplyMap(RwDefinitions::SET_SPEED, 1, nullptr,
|
this->insertInCommandAndReplyMap(RwDefinitions::SET_SPEED, 1, nullptr,
|
||||||
@ -228,6 +234,15 @@ void RwHandler::prepareGetTemperatureCmd() {
|
|||||||
rawPacketLen = 3;
|
rawPacketLen = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RwHandler::prepareInitRwCommand() {
|
||||||
|
commandBuffer[0] = static_cast<uint8_t>(RwDefinitions::INIT_RW_CONTROLLER);
|
||||||
|
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);
|
||||||
|
@ -121,6 +121,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
void prepareGetTemperatureCmd();
|
void prepareGetTemperatureCmd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function fills the commandBuffer with the data to request initialize the
|
||||||
|
* reaction wheel controller. This command must be sent as soon as the state of a
|
||||||
|
* reaction wheel is equal to 1 which indicates an error.
|
||||||
|
*/
|
||||||
|
void prepareInitRwCommand();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles the reply of the get temperature command.
|
* @brief This function handles the reply of the get temperature command.
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,7 @@ static const DeviceCommandId_t RESET_MCU = 1;
|
|||||||
static const DeviceCommandId_t GET_LAST_RESET_STATUS = 2;
|
static const DeviceCommandId_t GET_LAST_RESET_STATUS = 2;
|
||||||
static const DeviceCommandId_t CLEAR_LAST_RESET_STATUS = 3;
|
static const DeviceCommandId_t CLEAR_LAST_RESET_STATUS = 3;
|
||||||
static const DeviceCommandId_t GET_RW_STATUS = 4;
|
static const DeviceCommandId_t GET_RW_STATUS = 4;
|
||||||
|
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;
|
||||||
|
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 19b76d961c61966a0093d3768f62d99196e1c9b2
|
Subproject commit 899cd942ce7136f371e93d270a6c6c149c0698cb
|
Loading…
Reference in New Issue
Block a user