meier/deviceHandlerUpdate #192

Merged
muellerr merged 16 commits from meier/deviceHandlerUpdate into develop 2022-04-01 14:05:05 +02:00
4 changed files with 86 additions and 33 deletions
Showing only changes of commit e9b2def10e - Show all commits

2
fsfw

@ -1 +1 @@
Subproject commit d8450c45a7693f1d0f69da0d793e90c59f977be6 Subproject commit 29cf8c9009d1bbdc67512c35b2d161fe13659c34

View File

@ -87,8 +87,8 @@ void PlocMPSoCHandler::performOperationHook() {
} }
} }
CommandMessage message; CommandMessage message;
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&event); result == RETURN_OK; for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK;
result = commandActionHelperQueue->receiveMessage(&event)) { result = commandActionHelperQueue->receiveMessage(&message)) {
result = commandActionHelper.handleReply(&message); result = commandActionHelper.handleReply(&message);
if (result == RETURN_OK) { if (result == RETURN_OK) {
continue; continue;
@ -158,7 +158,6 @@ void PlocMPSoCHandler::doShutDown() {
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
break; break;
default: default:
sif::debug << "PlocMPSoCHandler::doShutDown: This should never happen" << std::endl;
break; break;
} }
} }
@ -168,7 +167,7 @@ ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
} }
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
return HasReturnvaluesIF::RETURN_OK; return NOTHING_TO_SEND;
} }
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
@ -313,7 +312,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {} void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
@ -713,8 +712,26 @@ void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step)
} }
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step, void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) { ReturnValue_t returnCode) {
handleActionCommandFailure(actionId); switch (actionId) {
case supv::START_MPSOC:
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC"
<< std::endl;
powerState = PowerState::OFF;
break;
case supv::SHUTDOWN_MPSOC:
triggerEvent(MPSOC_SHUTDOWN_FAILED);
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC"
<< std::endl;
// TODO: Setting state to on or off here?
powerState = PowerState::ON;
break;
default:
sif::debug
<< "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
<< std::endl;
break;
}
} }
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
@ -722,18 +739,21 @@ void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, ui
} }
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) { void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
switch(actionId) { if (actionId != supv::EXE_REPORT) {
case supv::START_MPSOC: { sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
<< "ID" << std::endl;
return;
}
switch(powerState) {
case PowerState::BOOTING: {
powerState = PowerState::ON; powerState = PowerState::ON;
break; break;
} }
case supv::SHUTDOWN_MPSOC: { case PowerState::SHUTDOWN: {
powerState = PowerState::OFF; powerState = PowerState::OFF;
break; break;
default: }
sif::debug default: {
<< "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action reply"
<< std::endl;
break; break;
} }
} }
@ -798,7 +818,7 @@ void PlocMPSoCHandler::disableAllReplies() {
} }
} }
/* We must always disable the execution report reply here */ /* We always need to disable the execution report reply here */
disableExeReportReply(); disableExeReportReply();
nextReplyId = mpsoc::NONE; nextReplyId = mpsoc::NONE;
} }
@ -840,17 +860,29 @@ uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) { void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
switch (actionId) { switch (actionId) {
case supv::START_MPSOC: case supv::ACK_REPORT:
powerState = PowerState::ON; case supv::EXE_REPORT:
break; break;
case supv::SHUTDOWN_MPSOC:
triggerEvent(MPSOC_SHUTDOWN_FAILED);
// TODO: Setting state to on or off here?
powerState = PowerState::OFF;
break;
default: default:
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Received unexpected action reply" sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
<< std::endl; << std::endl;
break; return;
} }
switch(powerState) {
case PowerState::BOOTING: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
<< std::endl;
powerState = PowerState::OFF;
break;
}
case PowerState::SHUTDOWN: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
<< std::endl;
powerState = PowerState::ON;
break;
}
default:
break;
}
return;
} }

View File

@ -45,6 +45,22 @@ ReturnValue_t SyrlinksHkHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
break; break;
case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE): case (SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE):
*id = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE; *id = SYRLINKS::READ_TX_AGC_VALUE_LOW_BYTE;
nextCommand = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
break;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
*id = SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE;
nextCommand = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
break;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
*id = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
nextCommand = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
break;
case (SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE):
*id = SYRLINKS::TEMP_BASEBAND_BOARD_HIGH_BYTE;
nextCommand = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
break;
case (SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE):
*id = SYRLINKS::TEMP_BASEBAND_BOARD_LOW_BYTE;
nextCommand = SYRLINKS::READ_RX_STATUS_REGISTERS; nextCommand = SYRLINKS::READ_RX_STATUS_REGISTERS;
break; break;
default: default:
@ -144,9 +160,9 @@ ReturnValue_t SyrlinksHkHandler::buildCommandFromCommand(DeviceCommandId_t devic
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE):
tempBasebandBoardHighByte.copy(reinterpret_cast<char*>(commandBuffer), tempBasebandBoardHighByte.size(), tempPowerAmpBoardLowByte.copy(reinterpret_cast<char*>(commandBuffer), tempPowerAmpBoardLowByte.size(),
0); 0);
rawPacketLen = tempBasebandBoardHighByte.size(); rawPacketLen = tempPowerAmpBoardLowByte.size();
rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE; rememberCommandId = SYRLINKS::TEMP_POWER_AMPLIFIER_LOW_BYTE;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
@ -336,6 +352,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
rawTempBasebandBoard |= convertHexStringToUint8( rawTempBasebandBoard |= convertHexStringToUint8(
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
tempBasebandBoard = calcTempVal(rawTempBasebandBoard); tempBasebandBoard = calcTempVal(rawTempBasebandBoard);
sif::info << "Syrlinks temperature baseband board: " << tempBasebandBoard << " °C"
<< std::endl;
break; break;
case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE): case (SYRLINKS::TEMP_POWER_AMPLIFIER_HIGH_BYTE):
result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE); result = verifyReply(packet, SYRLINKS::READ_ONE_REGISTER_REPLY_SIE);
@ -344,7 +362,8 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
<< "board high byte reply has invalid crc" << std::endl; << "board high byte reply has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempBasebandBoard = convertHexStringToUint8(reinterpret_cast<const char*>( rawTempPowerAmplifier = 0;
rawTempPowerAmplifier = convertHexStringToUint8(reinterpret_cast<const char*>(
packet + SYRLINKS::MESSAGE_HEADER_SIZE)) packet + SYRLINKS::MESSAGE_HEADER_SIZE))
<< 8; << 8;
break; break;
@ -355,9 +374,11 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
<< " board low byte reply has invalid crc" << std::endl; << " board low byte reply has invalid crc" << std::endl;
return CRC_FAILURE; return CRC_FAILURE;
} }
rawTempBasebandBoard |= convertHexStringToUint8( rawTempPowerAmplifier |= convertHexStringToUint8(
reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE)); reinterpret_cast<const char*>(packet + SYRLINKS::MESSAGE_HEADER_SIZE));
rawTempPowerAmplifier = calcTempVal(rawTempPowerAmplifier); tempPowerAmplifier = calcTempVal(rawTempPowerAmplifier);
sif::info << "Syrlinks temperature power amplifier board: " << tempPowerAmplifier << " °C"
<< std::endl;
break; break;
default: { default: {
sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl; sif::debug << "SyrlinksHkHandler::interpretDeviceReply: Unknown device reply id" << std::endl;

2
tmtc

@ -1 +1 @@
Subproject commit f7a3ad9981c2792d9d6bda335cb22e540c8f9b1a Subproject commit 5ac8912dd2b47f01f66093187f15a9f9824ffd66