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(
|
||||
"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);
|
||||
|
||||
#if OBSW_ADD_SCEX_DEVICE == 1
|
||||
|
@ -31,6 +31,8 @@ FreshSupvHandler::FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uart
|
||||
latchupStatusReport(this),
|
||||
countersReport(this),
|
||||
adcReport(this) {
|
||||
spParams.buf = commandBuffer.data();
|
||||
spParams.maxSize = commandBuffer.size();
|
||||
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) {
|
||||
std::vector<ActionId_t> cmdsToRemove;
|
||||
for (auto& activeCmd : activeActionCmds) {
|
||||
if (activeCmd.second.cmdCountdown.hasTimedOut()) {
|
||||
if (activeCmd.second.commandedBy != MessageQueueIF::NO_QUEUE) {
|
||||
@ -452,6 +453,7 @@ void FreshSupvHandler::startTransition(Mode_t newMode, Submode_t newSubmode) {
|
||||
}
|
||||
|
||||
void FreshSupvHandler::handleTransitionToOn() {
|
||||
sif::debug << "psupv: trans to on" << std::endl;
|
||||
if (startupState == StartupState::IDLE) {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::POWER_SWITCHING;
|
||||
@ -473,17 +475,22 @@ void FreshSupvHandler::handleTransitionToOn() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (startupState == StartupState::BOOTING) {
|
||||
if (bootTimeout.hasTimedOut()) {
|
||||
if (startupState == StartupState::BOOTING and bootTimeout.hasTimedOut()) {
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
uartManager.start();
|
||||
if (SET_TIME_DURING_BOOT) {
|
||||
// TODO: Send command ,add command to command map.
|
||||
startupState = StartupState::SET_TIME;
|
||||
} 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) {
|
||||
startupState = StartupState::ON;
|
||||
@ -491,6 +498,8 @@ void FreshSupvHandler::handleTransitionToOn() {
|
||||
if (startupState == StartupState::ON) {
|
||||
hkSet.setReportingEnabled(true);
|
||||
supv::SUPV_ON = true;
|
||||
sif::debug << "psupv: going on" << std::endl;
|
||||
transitionActive = false;
|
||||
setMode(targetMode);
|
||||
}
|
||||
}
|
||||
@ -506,7 +515,9 @@ void FreshSupvHandler::handleTransitionToOff() {
|
||||
}
|
||||
if (shutdownState == ShutdownState::POWER_SWITCHING) {
|
||||
if (switchIF.getSwitchState(switchId) == PowerSwitchIF::SWITCH_OFF or modeHelper.isTimedOut()) {
|
||||
sif::debug << "psupv: going off" << std::endl;
|
||||
supv::SUPV_ON = false;
|
||||
transitionActive = false;
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
}
|
||||
@ -1115,11 +1126,13 @@ ReturnValue_t FreshSupvHandler::handleAckReport(const uint8_t* data) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
info.ackRecv = true;
|
||||
performCommandCompletionHandling(info);
|
||||
performCommandCompletionHandling(static_cast<supv::Apid>((infoIter->first >> 16) & 0xffff),
|
||||
infoIter->first & 0xff, info);
|
||||
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
|
||||
(not info.replyPacketExpected or info.replyPacketReceived)) {
|
||||
actionHelper.finish(true, info.commandedBy, info.commandId, returnvalue::OK);
|
||||
@ -1170,7 +1183,9 @@ ReturnValue_t FreshSupvHandler::handleExecutionReport(const uint8_t* data) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
info.ackExeRecv = true;
|
||||
performCommandCompletionHandling(info);
|
||||
performCommandCompletionHandling(static_cast<supv::Apid>((infoIter->first >> 16) & 0xffff),
|
||||
infoIter->first & 0xff, info);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1197,9 +1212,6 @@ ReturnValue_t FreshSupvHandler::handleExecutionSuccessReport(ActiveCmdInfo& info
|
||||
break;
|
||||
}
|
||||
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) {
|
||||
startupState = StartupState::TIME_WAS_SET;
|
||||
}
|
||||
@ -1229,7 +1241,8 @@ void FreshSupvHandler::confirmReplyPacketReceived(supv::Apid apid, uint8_t servi
|
||||
if (infoIter != activeActionCmds.end()) {
|
||||
ActiveCmdInfo& info = infoIter->second;
|
||||
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;
|
||||
|
||||
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 {
|
||||
public:
|
||||
@ -176,7 +176,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
|
||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||
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 genericHandleTm(const char* contextString, const uint8_t* data,
|
||||
LocalPoolDataSetBase& set, supv::Apid apid, uint8_t serviceId);
|
||||
|
@ -45,10 +45,12 @@ PlocSupvUartManager::PlocSupvUartManager(object_id_t objectId)
|
||||
PlocSupvUartManager::~PlocSupvUartManager() = default;
|
||||
|
||||
ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
||||
sif::debug << "init ploc supv uart IF" << std::endl;
|
||||
auto* uartCookie = dynamic_cast<SerialCookie*>(cookie);
|
||||
if (uartCookie == nullptr) {
|
||||
return FAILED;
|
||||
}
|
||||
sif::debug << "hello blub" << std::endl;
|
||||
std::string devname = uartCookie->getDeviceFile();
|
||||
/* Get file descriptor */
|
||||
serialPort = open(devname.c_str(), O_RDWR);
|
||||
@ -70,7 +72,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
||||
tty.c_lflag &= ~(ICANON | ECHO);
|
||||
|
||||
// Blocking mode, 0.2 seconds timeout
|
||||
tty.c_cc[VTIME] = 2;
|
||||
tty.c_cc[VTIME] = 0;
|
||||
tty.c_cc[VMIN] = 0;
|
||||
|
||||
serial::setBaudrate(tty, uartCookie->getBaudrate());
|
||||
@ -80,6 +82,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
|
||||
}
|
||||
// Flush received and unread data
|
||||
tcflush(serialPort, TCIOFLUSH);
|
||||
sif::debug << "ploc supv cfg complete" << std::endl;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -114,6 +117,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
lock->lockMutex();
|
||||
InternalState currentState = state;
|
||||
lock->unlockMutex();
|
||||
sif::debug << "supv uart man post-lock" << std::endl;
|
||||
switch (currentState) {
|
||||
case InternalState::SLEEPING:
|
||||
case InternalState::GO_TO_SLEEP: {
|
||||
@ -139,6 +143,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
ReturnValue_t PlocSupvUartManager::handleUartReception() {
|
||||
ReturnValue_t result = OK;
|
||||
ReturnValue_t status = OK;
|
||||
sif::debug << "handling uart reception" << std::endl;
|
||||
ssize_t bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
|
||||
static_cast<unsigned int>(recBuf.size()));
|
||||
if (bytesRead == 0) {
|
||||
|
@ -282,8 +282,8 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
|
||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
||||
|
||||
bool printTc = false;
|
||||
bool debugMode = false;
|
||||
bool printTc = true;
|
||||
bool debugMode = true;
|
||||
bool timestamping = true;
|
||||
|
||||
// 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;
|
||||
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;
|
||||
|
||||
namespace result {
|
||||
|
Loading…
x
Reference in New Issue
Block a user