v1.12.0 #269

Merged
muellerr merged 493 commits from develop into main 2022-07-04 11:19:05 +02:00
6 changed files with 66 additions and 42 deletions
Showing only changes of commit 132751893b - Show all commits

View File

@ -46,7 +46,7 @@ void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
new UartComIF(objects::UART_COM_IF);
new UartComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
@ -67,10 +67,9 @@ new UartComIF(objects::UART_COM_IF);
supervisorCookie->setNoFixedSizeReply();
auto supvGpioIF = new DummyGpioIF();
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
auto plocSupervisor = new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, supvGpioIF),
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
plocSupervisor->setStartUpImmediately();
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
#endif

2
fsfw

@ -1 +1 @@
Subproject commit 789668ae50a26cda299cfd125011f9fb345824d9
Subproject commit 19bd26d9983d97c8daf010649e9142afac7e2650

View File

@ -121,7 +121,10 @@ void PlocMemoryDumper::doStateMachine() {
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) {}
ReturnValue_t returnCode) {
triggerEvent(MRAM_DUMP_FAILED);
state = State::IDLE;
}
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}

View File

@ -137,7 +137,6 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
}
void PlocSupervisorHandler::doStartUp() {
#ifdef XIPHOS_Q7S
switch (startupState) {
case StartupState::OFF: {
bootTimeout.resetTimer();
@ -159,9 +158,6 @@ void PlocSupervisorHandler::doStartUp() {
default:
break;
}
#else
setMode(_MODE_TO_ON);
#endif
}
void PlocSupervisorHandler::doShutDown() {
@ -178,7 +174,7 @@ ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandI
if (startupState == StartupState::SET_TIME) {
*id = supv::SET_TIME_REF;
startupState = StartupState::SET_TIME_EXECUTING;
return RETURN_OK;
return buildCommandFromCommand(*id, nullptr, 0);
}
return NOTHING_TO_SEND;
}
@ -436,8 +432,10 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(LOGGING_SET_TOPIC);
this->insertInCommandMap(RESET_PL);
this->insertInCommandMap(ENABLE_NVMS);
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 0, nullptr, 0, false, false, FIRST_MRAM_DUMP,
&mramDumpTimeout);
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 0, nullptr, 0, false, false,
CONSECUTIVE_MRAM_DUMP, &mramDumpTimeout);
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
this->insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionTimeout);
this->insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
@ -1316,6 +1314,10 @@ ReturnValue_t PlocSupervisorHandler::doSendReadHook() {
return RETURN_OK;
}
void PlocSupervisorHandler::doOffActivity() {
startupState = StartupState::OFF;
}
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId) {
ReturnValue_t result = RETURN_OK;
@ -1548,10 +1550,11 @@ ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* com
}
void PlocSupervisorHandler::disableAllReplies() {
using namespace supv;
DeviceReplyMap::iterator iter;
/* Disable ack reply */
iter = deviceReplyMap.find(supv::ACK_REPORT);
iter = deviceReplyMap.find(ACK_REPORT);
DeviceReplyInfo* info = &(iter->second);
info->delayCycles = 0;
info->command = deviceCommandMap.end();
@ -1560,21 +1563,29 @@ void PlocSupervisorHandler::disableAllReplies() {
/* If the command expects a telemetry packet the appropriate tm reply will be disabled here */
switch (commandId) {
case supv::GET_HK_REPORT: {
iter = deviceReplyMap.find(supv::GET_HK_REPORT);
info = &(iter->second);
info->delayCycles = 0;
info->active = false;
info->command = deviceCommandMap.end();
case GET_HK_REPORT: {
disableReply(GET_HK_REPORT);
break;
}
case supv::FIRST_MRAM_DUMP:
case supv::CONSECUTIVE_MRAM_DUMP: {
iter = deviceReplyMap.find(commandId);
info = &(iter->second);
info->delayCycles = 0;
info->active = false;
info->command = deviceCommandMap.end();
case FIRST_MRAM_DUMP:
case CONSECUTIVE_MRAM_DUMP: {
disableReply(commandId);
break;
}
case REQUEST_ADC_REPORT: {
disableReply(ADC_REPORT);
break;
}
case GET_BOOT_STATUS_REPORT: {
disableReply(BOOT_STATUS_REPORT);
break;
}
case GET_LATCHUP_STATUS_REPORT: {
disableReply(LATCHUP_REPORT);
break;
}
case LOGGING_REQUEST_COUNTERS: {
disableReply(LOGGING_REPORT);
break;
}
default: {
@ -1586,6 +1597,14 @@ void PlocSupervisorHandler::disableAllReplies() {
disableExeReportReply();
}
void PlocSupervisorHandler::disableReply(DeviceCommandId_t replyId) {
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
DeviceReplyInfo* info = &(iter->second);
info->delayCycles = 0;
info->active = false;
info->command = deviceCommandMap.end();
}
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
DeviceReplyIter iter = deviceReplyMap.find(replyId);
@ -1663,9 +1682,13 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl;
return result;
}
handleMramDumpFile(id);
if (downlinkMramDump == true) {
handleDeviceTM(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
result = handleMramDumpFile(id);
if (result != RETURN_OK) {
DeviceCommandMap::iterator iter = deviceCommandMap.find(id);
actionHelper.finish(false, iter->second.sendReplyTo, id, result);
disableAllReplies();
nextReplyId = supv::NONE;
return result;
}
packetInBuffer = false;
receivedMramDumpPackets++;
@ -1714,23 +1737,19 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
(sequenceFlags != static_cast<uint8_t>(supv::SequenceFlags::STANDALONE_PKT))) {
// Command expects at least one MRAM packet more and the execution report
info->expectedReplies = 2;
// Wait maximum of 2 cycles for next MRAM packet
mramReplyInfo->delayCycles = 2;
// Also adapting delay cycles for execution report
exeReplyInfo->delayCycles = 3;
mramReplyInfo->countdown->resetTimer();
} else {
// Command expects the execution report
info->expectedReplies = 1;
mramReplyInfo->delayCycles = 0;
mramReplyInfo->active = false;
}
exeReplyInfo->countdown->resetTimer();
return;
}
ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
uint16_t apid = (spacePacketBuffer[0] << 8 | spacePacketBuffer[1]) & supv::APID_MASK;
if (apid != supv::APID_MRAM_DUMP_TM) {
sif::warning << "PlocSupervisorHandler::checkMramPacketApid: 0x" << std::hex << apid
<< std::endl;
return SupvReturnValuesIF::NO_MRAM_PACKET;
}
return APERIODIC_REPLY;
@ -1803,7 +1822,7 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
Clock::TimeOfDay_t time;
ReturnValue_t result = Clock::getDateAndTime(&time);
if (result != RETURN_OK) {
sif::warning << "PlocSupervisorHandler::createMramDumpFile: Failed to get current time"
sif::warning << "PlocSupervisorHandler::getTimeStampString: Failed to get current time"
<< std::endl;
return SupvReturnValuesIF::GET_TIME_FAILURE;
}

View File

@ -56,7 +56,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
virtual ReturnValue_t doSendReadHook() override;
ReturnValue_t doSendReadHook() override;
void doOffActivity() override;
private:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
@ -86,6 +87,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
// 70 s
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
// 60 s
static const uint32_t MRAM_DUMP_TIMEOUT = 60000;
// 2 s
static const uint32_t BOOT_TIMEOUT = 2000;
enum class StartupState: uint8_t {
@ -141,15 +144,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
std::string supervisorFilePath = "ploc/supervisor";
std::string activeMramFile;
// Setting this variable to true will enable direct downlink of MRAM packets
bool downlinkMramDump = false;
// Supervisor helper class currently executing a command
bool plocSupvHelperExecuting = false;
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
// Vorago nees some time to boot properly
Countdown bootTimeout = Countdown(BOOT_TIMEOUT);
Countdown mramDumpTimeout = Countdown(MRAM_DUMP_TIMEOUT);
/**
* @brief Adjusts the timeout of the execution report dependent on command
@ -294,6 +295,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*/
void disableAllReplies();
void disableReply(DeviceCommandId_t replyId);
/**
* @brief This function sends a failure report if the active action was commanded by an other
* object.

2
tmtc

@ -1 +1 @@
Subproject commit 50a20cfdc27734305e3687b58546ff76b4411ee3
Subproject commit 2e24f764a65042fda2ea12e2b13cfab49ccc7b55