gpio state sent with execution report

This commit is contained in:
Jakob Meier 2022-04-29 22:55:01 +02:00
parent cf20d8e94d
commit cedc6bec23
5 changed files with 32 additions and 13 deletions

View File

@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() {
}
std::string fileName = currMntPrefix + TIME_FILE;
std::ofstream timeFile(fileName);
if (not timeFile.good()) {
sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
<< std::endl;
return RETURN_FAILED;
}
// if (not timeFile.good()) {
// sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
// << std::endl;
// return RETURN_FAILED;
// }
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
}
return RETURN_OK;

View File

@ -29,6 +29,9 @@ static const DeviceCommandId_t TC_MODE_REPLAY = 16;
static const DeviceCommandId_t TC_CAM_CMD_SEND = 17;
static const DeviceCommandId_t TC_MODE_IDLE = 18;
static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
static const DeviceCommandId_t SET_UART_TX_TRISTATE = 20;
static const DeviceCommandId_t RELEASE_UART_TX = 21;
// Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;

View File

@ -99,6 +99,20 @@ void PlocMPSoCHandler::performOperationHook() {
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = RETURN_OK;
switch(actionId) {
case mpsoc::SET_UART_TX_TRISTATE: {
uartIsolatorSwitch.pullLow();
return EXECUTION_FINISHED;
break;
}
case mpsoc::RELEASE_UART_TX: {
uartIsolatorSwitch.pullHigh();
return EXECUTION_FINISHED;
break;
default:
break;
}
}
if (plocMPSoCHelperExecuting) {
return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING;
@ -267,6 +281,8 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInCommandMap(mpsoc::TC_MODE_IDLE);
this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND);
this->insertInCommandMap(mpsoc::RELEASE_UART_TX);
this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE);
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);

View File

@ -859,7 +859,6 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
}
case supv::APID_ACK_SUCCESS: {
setNextReplyId();
handleSpecialAcknowledgments(data);
break;
}
default: {
@ -887,6 +886,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
switch (apid) {
case (supv::APID_EXE_SUCCESS): {
handleSpecialExecutionReport(data);
break;
}
case (supv::APID_EXE_FAILURE): {
@ -1813,17 +1813,17 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
return result;
}
void PlocSupervisorHandler::handleSpecialAcknowledgments(const uint8_t* data) {
void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
DeviceCommandId_t commandId = getPendingCommand();
switch(commandId) {
case supv::READ_GPIO: {
supv::AcknowledgmentReport ack;
ack.addWholeData(data, supv::SIZE_ACK_REPORT);
uint16_t gpioState = ack.getStatusCode();
supv::ExecutionReport exe;
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
uint16_t gpioState = exe.getStatusCode();
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocsupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::ACK_REPORT);
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
break;
}
default:

View File

@ -351,9 +351,9 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t eventSubscription();
/**
* @brief Handles acknowledgment reports which contains additional informations in the data field
* @brief Handles execution reports which contains additional information in the data field
*/
void handleSpecialAcknowledgments(const uint8_t* data);
void handleSpecialExecutionReport(const uint8_t* data);
};
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */