somethings wrong
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
bb20def961
commit
2563432171
@ -385,9 +385,6 @@ void scheduling::initTasks() {
|
|||||||
|
|
||||||
FixedTimeslotTaskIF* plTask = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* plTask = factory->createFixedTimeslotTask(
|
||||||
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc, &RR_SCHEDULING);
|
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc, &RR_SCHEDULING);
|
||||||
// plTask->addComponent(objects::CAM_SWITCHER);
|
|
||||||
// scheduling::addMpsocSupvHandlers(plTask);
|
|
||||||
// scheduling::scheduleScexDev(plTask);
|
|
||||||
pst::pstPayload(plTask);
|
pst::pstPayload(plTask);
|
||||||
|
|
||||||
#if OBSW_ADD_SCEX_DEVICE == 1
|
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||||
|
@ -31,6 +31,8 @@ FreshSupvHandler::FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uart
|
|||||||
latchupStatusReport(this),
|
latchupStatusReport(this),
|
||||||
countersReport(this),
|
countersReport(this),
|
||||||
adcReport(this) {
|
adcReport(this) {
|
||||||
|
spParams.buf = commandBuffer.data();
|
||||||
|
spParams.maxSize = commandBuffer.size();
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +85,6 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (opCode == OpCode::PARSE_TM) {
|
} else if (opCode == OpCode::PARSE_TM) {
|
||||||
std::vector<ActionId_t> cmdsToRemove;
|
|
||||||
for (auto& activeCmd : activeActionCmds) {
|
for (auto& activeCmd : activeActionCmds) {
|
||||||
if (activeCmd.second.cmdCountdown.hasTimedOut()) {
|
if (activeCmd.second.cmdCountdown.hasTimedOut()) {
|
||||||
if (activeCmd.second.commandedBy != MessageQueueIF::NO_QUEUE) {
|
if (activeCmd.second.commandedBy != MessageQueueIF::NO_QUEUE) {
|
||||||
@ -452,6 +453,7 @@ void FreshSupvHandler::startTransition(Mode_t newMode, Submode_t newSubmode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FreshSupvHandler::handleTransitionToOn() {
|
void FreshSupvHandler::handleTransitionToOn() {
|
||||||
|
sif::debug << "psupv: trans to on" << std::endl;
|
||||||
if (startupState == StartupState::IDLE) {
|
if (startupState == StartupState::IDLE) {
|
||||||
bootTimeout.resetTimer();
|
bootTimeout.resetTimer();
|
||||||
startupState = StartupState::POWER_SWITCHING;
|
startupState = StartupState::POWER_SWITCHING;
|
||||||
@ -473,24 +475,31 @@ void FreshSupvHandler::handleTransitionToOn() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (startupState == StartupState::BOOTING) {
|
if (startupState == StartupState::BOOTING and bootTimeout.hasTimedOut()) {
|
||||||
if (bootTimeout.hasTimedOut()) {
|
uartIsolatorSwitch.pullHigh();
|
||||||
uartIsolatorSwitch.pullHigh();
|
uartManager.start();
|
||||||
uartManager.start();
|
if (SET_TIME_DURING_BOOT) {
|
||||||
if (SET_TIME_DURING_BOOT) {
|
startupState = StartupState::SET_TIME;
|
||||||
// TODO: Send command ,add command to command map.
|
} else {
|
||||||
startupState = StartupState::SET_TIME;
|
startupState = StartupState::ON;
|
||||||
} else {
|
|
||||||
startupState = StartupState::ON;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (startupState == StartupState::SET_TIME) {
|
||||||
|
ReturnValue_t result = prepareSetTimeRefCmd();
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::error << "FreshSupvHandler: Setting time command prepration failed" << std::endl;
|
||||||
|
startupState = StartupState::ON;
|
||||||
|
}
|
||||||
|
startupState = StartupState::WAIT_FOR_TIME_REPLY;
|
||||||
|
}
|
||||||
if (startupState == StartupState::TIME_WAS_SET) {
|
if (startupState == StartupState::TIME_WAS_SET) {
|
||||||
startupState = StartupState::ON;
|
startupState = StartupState::ON;
|
||||||
}
|
}
|
||||||
if (startupState == StartupState::ON) {
|
if (startupState == StartupState::ON) {
|
||||||
hkSet.setReportingEnabled(true);
|
hkSet.setReportingEnabled(true);
|
||||||
supv::SUPV_ON = true;
|
supv::SUPV_ON = true;
|
||||||
|
sif::debug << "psupv: going on" << std::endl;
|
||||||
|
transitionActive = false;
|
||||||
setMode(targetMode);
|
setMode(targetMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -506,7 +515,9 @@ void FreshSupvHandler::handleTransitionToOff() {
|
|||||||
}
|
}
|
||||||
if (shutdownState == ShutdownState::POWER_SWITCHING) {
|
if (shutdownState == ShutdownState::POWER_SWITCHING) {
|
||||||
if (switchIF.getSwitchState(switchId) == PowerSwitchIF::SWITCH_OFF or modeHelper.isTimedOut()) {
|
if (switchIF.getSwitchState(switchId) == PowerSwitchIF::SWITCH_OFF or modeHelper.isTimedOut()) {
|
||||||
|
sif::debug << "psupv: going off" << std::endl;
|
||||||
supv::SUPV_ON = false;
|
supv::SUPV_ON = false;
|
||||||
|
transitionActive = false;
|
||||||
setMode(MODE_OFF);
|
setMode(MODE_OFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1115,11 +1126,13 @@ ReturnValue_t FreshSupvHandler::handleAckReport(const uint8_t* data) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
info.ackRecv = true;
|
info.ackRecv = true;
|
||||||
performCommandCompletionHandling(info);
|
performCommandCompletionHandling(static_cast<supv::Apid>((infoIter->first >> 16) & 0xffff),
|
||||||
|
infoIter->first & 0xff, info);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreshSupvHandler::performCommandCompletionHandling(ActiveCmdInfo& info) {
|
void FreshSupvHandler::performCommandCompletionHandling(supv::Apid apid, uint8_t serviceId,
|
||||||
|
ActiveCmdInfo& info) {
|
||||||
if (info.ackRecv and info.ackExeRecv and
|
if (info.ackRecv and info.ackExeRecv and
|
||||||
(not info.replyPacketExpected or info.replyPacketReceived)) {
|
(not info.replyPacketExpected or info.replyPacketReceived)) {
|
||||||
actionHelper.finish(true, info.commandedBy, info.commandId, returnvalue::OK);
|
actionHelper.finish(true, info.commandedBy, info.commandId, returnvalue::OK);
|
||||||
@ -1170,7 +1183,9 @@ ReturnValue_t FreshSupvHandler::handleExecutionReport(const uint8_t* data) {
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
info.ackExeRecv = true;
|
info.ackExeRecv = true;
|
||||||
performCommandCompletionHandling(info);
|
performCommandCompletionHandling(static_cast<supv::Apid>((infoIter->first >> 16) & 0xffff),
|
||||||
|
infoIter->first & 0xff, info);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,9 +1212,6 @@ ReturnValue_t FreshSupvHandler::handleExecutionSuccessReport(ActiveCmdInfo& info
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case supv::SET_TIME_REF: {
|
case supv::SET_TIME_REF: {
|
||||||
// We could only allow proper bootup when the time was set successfully, but
|
|
||||||
// this makes debugging difficult.
|
|
||||||
|
|
||||||
if (startupState == StartupState::WAIT_FOR_TIME_REPLY) {
|
if (startupState == StartupState::WAIT_FOR_TIME_REPLY) {
|
||||||
startupState = StartupState::TIME_WAS_SET;
|
startupState = StartupState::TIME_WAS_SET;
|
||||||
}
|
}
|
||||||
@ -1229,7 +1241,8 @@ void FreshSupvHandler::confirmReplyPacketReceived(supv::Apid apid, uint8_t servi
|
|||||||
if (infoIter != activeActionCmds.end()) {
|
if (infoIter != activeActionCmds.end()) {
|
||||||
ActiveCmdInfo& info = infoIter->second;
|
ActiveCmdInfo& info = infoIter->second;
|
||||||
info.replyPacketReceived = true;
|
info.replyPacketReceived = true;
|
||||||
performCommandCompletionHandling(info);
|
performCommandCompletionHandling(static_cast<supv::Apid>((infoIter->first >> 16) & 0xffff),
|
||||||
|
infoIter->first & 0xff, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
using supv::TcBase;
|
using supv::TcBase;
|
||||||
|
|
||||||
static constexpr bool DEBUG_PLOC_SUPV = true;
|
static constexpr bool DEBUG_PLOC_SUPV = true;
|
||||||
static constexpr bool REDUCE_NORMAL_MODE_PRINTOUT = true;
|
static constexpr bool REDUCE_NORMAL_MODE_PRINTOUT = false;
|
||||||
|
|
||||||
class FreshSupvHandler : public FreshDeviceHandlerBase {
|
class FreshSupvHandler : public FreshDeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
@ -176,7 +176,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
|
|||||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||||
void confirmReplyPacketReceived(supv::Apid apid, uint8_t serviceId);
|
void confirmReplyPacketReceived(supv::Apid apid, uint8_t serviceId);
|
||||||
void performCommandCompletionHandling(ActiveCmdInfo& info);
|
void performCommandCompletionHandling(supv::Apid apid, uint8_t serviceId, ActiveCmdInfo& info);
|
||||||
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
||||||
ReturnValue_t genericHandleTm(const char* contextString, const uint8_t* data,
|
ReturnValue_t genericHandleTm(const char* contextString, const uint8_t* data,
|
||||||
LocalPoolDataSetBase& set, supv::Apid apid, uint8_t serviceId);
|
LocalPoolDataSetBase& set, supv::Apid apid, uint8_t serviceId);
|
||||||
|
@ -45,10 +45,12 @@ PlocSupvUartManager::PlocSupvUartManager(object_id_t objectId)
|
|||||||
PlocSupvUartManager::~PlocSupvUartManager() = default;
|
PlocSupvUartManager::~PlocSupvUartManager() = default;
|
||||||
|
|
||||||
ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
||||||
|
sif::debug << "init ploc supv uart IF" << std::endl;
|
||||||
auto* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
auto* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
return FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
sif::debug << "hello blub" << std::endl;
|
||||||
std::string devname = uartCookie->getDeviceFile();
|
std::string devname = uartCookie->getDeviceFile();
|
||||||
/* Get file descriptor */
|
/* Get file descriptor */
|
||||||
serialPort = open(devname.c_str(), O_RDWR);
|
serialPort = open(devname.c_str(), O_RDWR);
|
||||||
@ -70,7 +72,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
|||||||
tty.c_lflag &= ~(ICANON | ECHO);
|
tty.c_lflag &= ~(ICANON | ECHO);
|
||||||
|
|
||||||
// Blocking mode, 0.2 seconds timeout
|
// Blocking mode, 0.2 seconds timeout
|
||||||
tty.c_cc[VTIME] = 2;
|
tty.c_cc[VTIME] = 0;
|
||||||
tty.c_cc[VMIN] = 0;
|
tty.c_cc[VMIN] = 0;
|
||||||
|
|
||||||
serial::setBaudrate(tty, uartCookie->getBaudrate());
|
serial::setBaudrate(tty, uartCookie->getBaudrate());
|
||||||
@ -80,6 +82,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
|||||||
}
|
}
|
||||||
// Flush received and unread data
|
// Flush received and unread data
|
||||||
tcflush(serialPort, TCIOFLUSH);
|
tcflush(serialPort, TCIOFLUSH);
|
||||||
|
sif::debug << "ploc supv cfg complete" << std::endl;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +117,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
|||||||
lock->lockMutex();
|
lock->lockMutex();
|
||||||
InternalState currentState = state;
|
InternalState currentState = state;
|
||||||
lock->unlockMutex();
|
lock->unlockMutex();
|
||||||
|
sif::debug << "supv uart man post-lock" << std::endl;
|
||||||
switch (currentState) {
|
switch (currentState) {
|
||||||
case InternalState::SLEEPING:
|
case InternalState::SLEEPING:
|
||||||
case InternalState::GO_TO_SLEEP: {
|
case InternalState::GO_TO_SLEEP: {
|
||||||
@ -139,6 +143,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
|||||||
ReturnValue_t PlocSupvUartManager::handleUartReception() {
|
ReturnValue_t PlocSupvUartManager::handleUartReception() {
|
||||||
ReturnValue_t result = OK;
|
ReturnValue_t result = OK;
|
||||||
ReturnValue_t status = OK;
|
ReturnValue_t status = OK;
|
||||||
|
sif::debug << "handling uart reception" << std::endl;
|
||||||
ssize_t bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
|
ssize_t bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
|
||||||
static_cast<unsigned int>(recBuf.size()));
|
static_cast<unsigned int>(recBuf.size()));
|
||||||
if (bytesRead == 0) {
|
if (bytesRead == 0) {
|
||||||
|
@ -282,8 +282,8 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
|||||||
|
|
||||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
||||||
|
|
||||||
bool printTc = false;
|
bool printTc = true;
|
||||||
bool debugMode = false;
|
bool debugMode = true;
|
||||||
bool timestamping = true;
|
bool timestamping = true;
|
||||||
|
|
||||||
// Remembers APID to know at which command a procedure failed
|
// Remembers APID to know at which command a procedure failed
|
||||||
|
@ -45,7 +45,7 @@ static const Event SUPV_EXE_ACK_UNKNOWN_COMMAND = MAKE_EVENT(10, severity::LOW);
|
|||||||
|
|
||||||
extern std::atomic_bool SUPV_ON;
|
extern std::atomic_bool SUPV_ON;
|
||||||
static constexpr uint32_t BOOT_TIMEOUT_MS = 4000;
|
static constexpr uint32_t BOOT_TIMEOUT_MS = 4000;
|
||||||
static constexpr uint32_t MAX_TRANSITION_TIME_TO_ON_MS = 6000;
|
static constexpr uint32_t MAX_TRANSITION_TIME_TO_ON_MS = BOOT_TIMEOUT_MS + 2000;
|
||||||
static constexpr uint32_t MAX_TRANSITION_TIME_TO_OFF_MS = 1000;
|
static constexpr uint32_t MAX_TRANSITION_TIME_TO_OFF_MS = 1000;
|
||||||
|
|
||||||
namespace result {
|
namespace result {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user