mpsoc shutdown after running update procedure
This commit is contained in:
parent
6876952bbd
commit
311ec7b194
@ -115,11 +115,13 @@ void initmission::initTasks() {
|
||||
|
||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
||||
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.4, missedDeadlineFunc);
|
||||
#if OBSW_ADD_GPS == 1
|
||||
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
||||
}
|
||||
#endif /* OBSW_ADD_GPS == 1 */
|
||||
|
||||
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
|
||||
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||
|
@ -531,7 +531,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
||||
#if OBSW_DEBUG_ACS == 1
|
||||
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
|
||||
#endif
|
||||
|
||||
bool debugGps = false;
|
||||
#if OBSW_DEBUG_GPS == 1
|
||||
debugGps = true;
|
||||
@ -545,7 +544,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
||||
auto gpsHandler0 =
|
||||
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
||||
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
|
||||
|
||||
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
|
||||
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
|
||||
objects::MGM_3_RM3100_HANDLER, objects::GYRO_0_ADIS_HANDLER, objects::GYRO_1_L3G_HANDLER,
|
||||
|
@ -26,7 +26,7 @@ GPSHyperionLinuxController::~GPSHyperionLinuxController() {}
|
||||
|
||||
void GPSHyperionLinuxController::performControlOperation() {
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
readGpsDataFromGpsd();
|
||||
// readGpsDataFromGpsd();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -266,10 +266,10 @@ static const uint32_t LOGGING_RPT_ID = LOGGING_REQUEST_COUNTERS;
|
||||
static const uint32_t ADC_REPORT_SET_ID = REQUEST_ADC_REPORT;
|
||||
|
||||
namespace recv_timeout {
|
||||
// Erase memory can require up to 60 seconds for execution
|
||||
static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 60000;
|
||||
}
|
||||
// Erase memory can require up to 60 seconds for execution
|
||||
static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 60000;
|
||||
} // namespace recv_timeout
|
||||
|
||||
/**
|
||||
* @brief This class creates a space packet containing only the header data and the CRC.
|
||||
@ -1245,7 +1245,6 @@ class DisableAutoTm : public SupvTcSpacePacket {
|
||||
*/
|
||||
class RequestLoggingData : public SupvTcSpacePacket {
|
||||
public:
|
||||
|
||||
enum class Sa : uint8_t {
|
||||
REQUEST_COUNTERS = 1,
|
||||
REQUEST_EVENT_BUFFERS = 2,
|
||||
@ -1278,9 +1277,7 @@ class TmPacket : public SpacePacket {
|
||||
/**
|
||||
* @brief Returns the payload data length (data field length without CRC)
|
||||
*/
|
||||
uint16_t getPayloadDataLength() {
|
||||
return this->getPacketDataLength() - 1;
|
||||
}
|
||||
uint16_t getPayloadDataLength() { return this->getPacketDataLength() - 1; }
|
||||
|
||||
ReturnValue_t checkCrc() {
|
||||
uint8_t* crcPtr = this->getPacketData() + this->getPayloadDataLength();
|
||||
@ -1294,6 +1291,257 @@ class TmPacket : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
class VerificationReport : public TmPacket {
|
||||
public:
|
||||
VerificationReport() : TmPacket() {}
|
||||
|
||||
/**
|
||||
* @brief Gets the APID of command which caused the transmission of this verification report.
|
||||
*/
|
||||
uint16_t getRefApid() {
|
||||
uint16_t refApid = 0;
|
||||
size_t size = 0;
|
||||
uint8_t* refApidPtr = this->getPacketData();
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&refApid, refApidPtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return refApid;
|
||||
}
|
||||
|
||||
uint16_t getStatusCode() {
|
||||
uint16_t statusCode = 0;
|
||||
size_t size = 0;
|
||||
uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
virtual ReturnValue_t checkApid() { return HasReturnvaluesIF::RETURN_FAILED; }
|
||||
|
||||
private:
|
||||
static const uint8_t OFFSET_STATUS_CODE = 4;
|
||||
};
|
||||
|
||||
class AcknowledgmentReport : public VerificationReport {
|
||||
public:
|
||||
AcknowledgmentReport() : VerificationReport() {}
|
||||
|
||||
ReturnValue_t checkApid() {
|
||||
uint16_t apid = this->getAPID();
|
||||
if (apid == APID_ACK_SUCCESS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else if (apid == APID_ACK_FAILURE) {
|
||||
printStatusInformation();
|
||||
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
|
||||
} else {
|
||||
sif::warning << "AcknowledgmentReport::checkApid: Invalid apid: 0x" << std::hex << apid
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::INVALID_APID;
|
||||
}
|
||||
}
|
||||
|
||||
void printStatusInformation() {
|
||||
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
|
||||
switch (statusCode) {
|
||||
case StatusCode::OK: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Ok" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PARAM: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Bad param" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TIMEOUT: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Timeout" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::RX_ERROR: {
|
||||
sif::warning << "Supervisor acknowledgment report status: RX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TX_ERROR: {
|
||||
sif::warning << "Supervisor acknowledgment report status: TX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::HEADER_EMPTY: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Header empty" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::DEFAULT_NAK: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Default code for nak" <<
|
||||
std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ROUTE_PACKET: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Route packet error" << std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::warning << "AcknowledgmentReport::printStatusInformation: Invalid status code: 0x"
|
||||
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum class StatusCode : uint16_t {
|
||||
OK = 0x0,
|
||||
BAD_PARAM = 0x1,
|
||||
TIMEOUT = 0x2,
|
||||
RX_ERROR = 0x3,
|
||||
TX_ERROR = 0x4,
|
||||
HEADER_EMPTY = 0x5,
|
||||
DEFAULT_NAK = 0x6,
|
||||
ROUTE_PACKET = 0x7
|
||||
};
|
||||
};
|
||||
|
||||
class ExecutionReport : public VerificationReport {
|
||||
public:
|
||||
ExecutionReport() : VerificationReport() {}
|
||||
|
||||
ReturnValue_t checkApid() {
|
||||
uint16_t apid = this->getAPID();
|
||||
if (apid == APID_EXE_SUCCESS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else if (apid == APID_EXE_FAILURE) {
|
||||
printStatusInformation();
|
||||
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
|
||||
} else {
|
||||
sif::warning << "ExecutionReport::checkApid: Invalid apid: 0x" << std::hex << apid
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::INVALID_APID;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum class StatusCode : uint16_t {
|
||||
OK = 0x0,
|
||||
INIT_ERROR = 0x1,
|
||||
BAD_PARAM = 0x2,
|
||||
NOT_INITIALIZED = 0x3,
|
||||
BAD_PERIPH_ID = 0x4,
|
||||
TIMEOUT = 0x5,
|
||||
RX_ERROR = 0x6,
|
||||
TX_ERROR = 0x7,
|
||||
BUF_EMPTY = 0x8,
|
||||
BUF_FULL = 0x9,
|
||||
NAK = 0xA,
|
||||
ARB_LOST = 0xB,
|
||||
BUSY = 0xC,
|
||||
NOT_IMPLEMENTED = 0xD,
|
||||
ALIGNEMENT_ERROR = 0xE,
|
||||
PERIPH_ERR = 0xF,
|
||||
FAILED_LATCH = 0x10,
|
||||
GPIO_HIGH = 0x11,
|
||||
GPIO_LOW = 0x12,
|
||||
TEST_PASSED = 0x13,
|
||||
TEST_FAILED = 0x14
|
||||
};
|
||||
|
||||
void printStatusInformation() {
|
||||
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
|
||||
switch (statusCode) {
|
||||
case StatusCode::OK: {
|
||||
sif::warning << "Supervisor execution report status: Ok" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::INIT_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: Init error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PARAM: {
|
||||
sif::warning << "Supervisor execution report status: Bad param" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NOT_INITIALIZED: {
|
||||
sif::warning << "Supervisor execution report status: Not initialized" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PERIPH_ID: {
|
||||
sif::warning << "Supervisor execution report status: Bad periph ID" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TIMEOUT: {
|
||||
sif::warning << "Supervisor execution report status: Timeout" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::RX_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: RX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TX_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: TX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUF_EMPTY: {
|
||||
sif::warning << "Supervisor execution report status: Buf empty" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUF_FULL: {
|
||||
sif::warning << "Supervisor execution report status: Buf full" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NAK: {
|
||||
sif::warning << "Supervisor execution report status: Nak, default error code" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ARB_LOST: {
|
||||
sif::warning << "Supervisor execution report status: Arb lost" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUSY: {
|
||||
sif::warning << "Supervisor execution report status: Busy" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NOT_IMPLEMENTED: {
|
||||
sif::warning << "Supervisor execution report status: Not implemented" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ALIGNEMENT_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: Alignment error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::PERIPH_ERR: {
|
||||
sif::warning << "Supervisor execution report status: Periph error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::FAILED_LATCH: {
|
||||
sif::warning << "Supervisor execution report status: Failed latch" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::GPIO_HIGH: {
|
||||
sif::warning << "Supervisor execution report status: GPIO high" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::GPIO_LOW: {
|
||||
sif::warning << "Supervisor execution report status: GPIO low" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TEST_PASSED: {
|
||||
sif::warning << "Supervisor execution report status: Test passed" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TEST_FAILED: {
|
||||
sif::warning << "Supervisor execution report status: Test failed" << std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x"
|
||||
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
@ -1409,31 +1657,36 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::TM_AVAILABLE_CNT, this);
|
||||
lp_var_t<uint32_t> supervisorBoots =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::SUPERVISOR_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBoots =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBoots = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBootFailedAttempts =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOT_FAILED_ATTEMPTS, this);
|
||||
lp_var_t<uint32_t> mpsocPowerup =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
|
||||
lp_var_t<uint32_t> mpsocUpdates =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
|
||||
lp_var_t<uint32_t> lastRecvdTc =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
|
||||
lp_var_t<uint32_t> mpsocPowerup = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
|
||||
lp_var_t<uint32_t> mpsocUpdates = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
|
||||
lp_var_t<uint32_t> lastRecvdTc = lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
|
||||
|
||||
void printSet() {
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: TC received count: " << this->tcReceivedCnt << std::endl;
|
||||
sif::info << "LoggingReport: TM available count: " << this->tmAvailableCnt << std::endl;
|
||||
sif::info << "LoggingReport: Supervisor boots: " << this->supervisorBoots << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boots: " << this->mpsocBoots << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boot failed attempts: " << this->mpsocBootFailedAttempts << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boot failed attempts: " << this->mpsocBootFailedAttempts
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: MPSoC power up: " << this->mpsocPowerup << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC updates: " << this->mpsocUpdates << std::endl;
|
||||
sif::info << "LoggingReport: Last received TC: " << this->lastRecvdTc << std::endl;
|
||||
|
@ -769,10 +769,24 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
object_id_t objectId = eventMessage->getReporter();
|
||||
Event event = eventMessage->getEvent();
|
||||
switch (objectId) {
|
||||
case objects::PLOC_SUPERVISOR_HELPER: {
|
||||
plocSupvHelperExecuting = false;
|
||||
// After execution of update procedure, PLOC is in a state where it draws approx. 700 mA of
|
||||
// current. To leave this state the shutdown MPSoC command must be sent here.
|
||||
if (event == PlocSupvHelper::SUPV_UPDATE_FAILED ||
|
||||
event == PlocSupvHelper::SUPV_UPDATE_SUCCESSFUL) {
|
||||
result = this->executeAction(supv::SHUTDOWN_MPSOC, NO_COMMANDER, nullptr, 0);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(SUPV_MPSOC_SHUWDOWN_BUILD_FAILED);
|
||||
sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown "
|
||||
"command" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -71,6 +71,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor helper currently executing a command
|
||||
static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(5, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC
|
||||
static const Event SUPV_MPSOC_SHUWDOWN_BUILD_FAILED = MAKE_EVENT(5, severity::LOW);
|
||||
|
||||
static const uint16_t APID_MASK = 0x7FF;
|
||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||
|
@ -149,7 +149,8 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
return result;
|
||||
}
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length, ProgressPrinter::ONE_PERCENT);
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length,
|
||||
ProgressPrinter::HALF_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
@ -172,9 +173,9 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
file.read(reinterpret_cast<char*>(tempData), dataLength);
|
||||
if (!file) {
|
||||
sif::warning << "PlocSupvHelper::performUpdate: Read only " << file.gcount() << " of "
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
sif::info << "PlocSupvHelper::performUpdate: Failed when trying to read byte "
|
||||
<< bytesWritten << std::endl;
|
||||
<< bytesWritten << std::endl;
|
||||
}
|
||||
remainingSize -= dataLength;
|
||||
} else {
|
||||
@ -280,64 +281,48 @@ ReturnValue_t PlocSupvHelper::sendCommand(SpacePacket& packet) {
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_ACK_REPORT);
|
||||
supv::AcknowledgmentReport ackReport;
|
||||
result = handleTmReception(&ackReport, supv::SIZE_ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_ACK_SUCCESS) {
|
||||
handleAckApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = ackReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleAckApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Received acknowledgement failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Expected acknowledgement report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_EXE_REPORT, timeout);
|
||||
supv::ExecutionReport exeReport;
|
||||
result = handleTmReception(&exeReport, supv::SIZE_EXE_REPORT, timeout);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_EXE_SUCCESS) {
|
||||
handleExeApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = exeReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleExeApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Received execution failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
||||
uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
@ -404,7 +389,8 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
||||
uint16_t remainder = CRC16_INIT;
|
||||
uint8_t input;
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length);
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length,
|
||||
ProgressPrinter::ONE_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint32_t byteCount = 0;
|
||||
for (byteCount = 0; byteCount < update.length; byteCount++) {
|
||||
@ -442,7 +428,7 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleExe();
|
||||
result = handleExe(CRC_EXECUTION_TIMEOUT);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
//! [EXPORT] : [COMMENT] Supervisor received acknowledgment failure report
|
||||
//! P1: Internal state of supervisor helper
|
||||
static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(11, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor received execution failure report
|
||||
//! P1: Internal state of supervisor
|
||||
//! [EXPORT] : [COMMENT] Execution report failure
|
||||
//! P1:
|
||||
static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(12, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor expected acknowledgment report but received space packet with other apid
|
||||
//! P1: Apid of received space packet
|
||||
@ -129,6 +129,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
static const uint8_t NUM_EVENT_BUFFER_PACKETS = 25;
|
||||
static const size_t SIZE_EVENT_BUFFER_FULL_PACKET = 1024;
|
||||
static const size_t SIZE_EVENT_BUFFER_LAST_PACKET = 200;
|
||||
static const uint32_t CRC_EXECUTION_TIMEOUT = 60000;
|
||||
|
||||
struct Update {
|
||||
uint8_t memoryId;
|
||||
@ -190,8 +191,6 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
|
||||
ReturnValue_t handleAck();
|
||||
ReturnValue_t handleExe(uint32_t timeout = 1000);
|
||||
void handleAckApidFailure(uint16_t apid);
|
||||
void handleExeApidFailure(uint16_t apid);
|
||||
/**
|
||||
* @brief Handles reading of TM packets from the communication interface
|
||||
*
|
||||
|
@ -41,8 +41,8 @@ debugging. */
|
||||
#define OBSW_ADD_MGT 1
|
||||
#define OBSW_ADD_BPX_BATTERY_HANDLER 1
|
||||
#define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@
|
||||
#define OBSW_ADD_PLOC_SUPERVISOR 0
|
||||
#define OBSW_ADD_PLOC_MPSOC 0
|
||||
#define OBSW_ADD_PLOC_SUPERVISOR 1
|
||||
#define OBSW_ADD_PLOC_MPSOC 1
|
||||
#define OBSW_ADD_SUN_SENSORS 1
|
||||
#define OBSW_ADD_SUS_BOARD_ASS 1
|
||||
#define OBSW_ADD_ACS_BOARD 1
|
||||
@ -53,6 +53,7 @@ debugging. */
|
||||
#define OBSW_ADD_RAD_SENSORS 1
|
||||
#define OBSW_ADD_PL_PCDU 1
|
||||
#define OBSW_ADD_SYRLINKS 0
|
||||
#define OBSW_ADD_GPS 1
|
||||
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
#include <iomanip>
|
||||
#include "ProgressPrinter.h"
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps, uint32_t percentageResolution)
|
||||
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps, float percentageResolution)
|
||||
: name(name), numSteps(numSteps), percentageResolution(percentageResolution) {}
|
||||
|
||||
ProgressPrinter::~ProgressPrinter() {}
|
||||
|
||||
void ProgressPrinter::print(uint32_t currentStep) {
|
||||
float progressInPercent = static_cast<float>(currentStep) / static_cast<float>(numSteps) * 100;
|
||||
if (static_cast<uint32_t>(progressInPercent) >= nextProgressPrint) {
|
||||
sif::info << name << " progress: " << progressInPercent << " %" << std::endl;
|
||||
if (progressInPercent >= nextProgressPrint) {
|
||||
sif::info << name << " progress: " << std::setprecision(4) << progressInPercent << " %"
|
||||
<< std::endl;
|
||||
nextProgressPrint += percentageResolution;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,9 @@
|
||||
class ProgressPrinter {
|
||||
public:
|
||||
|
||||
static const uint32_t ONE_PERCENT = 1;
|
||||
static constexpr float HALF_PERCENT = 0.5;
|
||||
static constexpr float ONE_PERCENT = 1;
|
||||
static constexpr float FIVE_PERCENT = 5;
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -21,7 +23,7 @@ class ProgressPrinter {
|
||||
* @param percentageResolution Distance between printed percentage steps. E.g. 5 means that
|
||||
* a printout will be generated after 0%, 5%, 10% etc.
|
||||
*/
|
||||
ProgressPrinter(std::string name, uint32_t numSteps, uint32_t percentageResolution = FIVE_PERCENT);
|
||||
ProgressPrinter(std::string name, uint32_t numSteps, float percentageResolution = FIVE_PERCENT);
|
||||
virtual ~ProgressPrinter();
|
||||
|
||||
/**
|
||||
@ -32,12 +34,11 @@ class ProgressPrinter {
|
||||
void print(uint32_t step);
|
||||
|
||||
private:
|
||||
static constexpr uint32_t FIVE_PERCENT = 5;
|
||||
|
||||
std::string name = "";
|
||||
uint32_t numSteps = 0;
|
||||
uint32_t nextProgressPrint = 0;
|
||||
uint32_t percentageResolution = 0;
|
||||
float nextProgressPrint = 0;
|
||||
float percentageResolution = 0;
|
||||
};
|
||||
|
||||
#endif /* MISSION_UTILITY_PROGRESSPRINTER_H_ */
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit ad53f3e9bb526bf030905d24781af57ae6ac5b01
|
||||
Subproject commit af4e3ea5747e381ac2dfc164223dbaa361257acd
|
Loading…
x
Reference in New Issue
Block a user