Merge remote-tracking branch 'origin/develop' into mueller_5v_stack_cmd_for_devices
This commit is contained in:
commit
8d0448341b
@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
## Fixed
|
||||
|
||||
- PLOC SUPV: Minor adaptions and important bugfix for UART manager
|
||||
|
||||
## Added
|
||||
|
||||
- First version of ACS controller
|
||||
|
@ -152,7 +152,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
||||
* sent and received packets.
|
||||
*/
|
||||
TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount)
|
||||
: ploc::SpTcBase(params, apid, sequenceCount) {
|
||||
: ploc::SpTcBase(params, apid, 0, sequenceCount) {
|
||||
spParams.setFullPayloadLen(INIT_LENGTH);
|
||||
}
|
||||
|
||||
|
@ -730,17 +730,13 @@ class FactoryReset : public TcBase {
|
||||
: TcBase(params, Apid::DATA_LOGGER,
|
||||
static_cast<uint8_t>(tc::DataLoggerServiceId::FACTORY_RESET), 0) {}
|
||||
|
||||
ReturnValue_t buildPacket(std::optional<uint8_t> op) {
|
||||
if (op) {
|
||||
setLenFromPayloadLen(1);
|
||||
}
|
||||
ReturnValue_t buildPacket(uint8_t op) {
|
||||
setLenFromPayloadLen(1);
|
||||
auto res = checkSizeAndSerializeHeader();
|
||||
if (res != returnvalue::OK) {
|
||||
return res;
|
||||
}
|
||||
if (op) {
|
||||
payloadStart[0] = op.value();
|
||||
}
|
||||
payloadStart[0] = op;
|
||||
return calcAndSetCrc();
|
||||
}
|
||||
|
||||
|
@ -184,12 +184,14 @@ void PlocMPSoCHandler::doShutDown() {
|
||||
powerState = PowerState::SHUTDOWN;
|
||||
break;
|
||||
case PowerState::OFF:
|
||||
sequenceCount = 0;
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
sequenceCount = 0;
|
||||
uartIsolatorSwitch.pullLow();
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
powerState = PowerState::OFF;
|
||||
@ -340,7 +342,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
||||
}
|
||||
}
|
||||
|
||||
sequenceCount++;
|
||||
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
||||
if (recvSeqCnt != sequenceCount) {
|
||||
triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt);
|
||||
@ -403,11 +404,9 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount);
|
||||
result = tcMemWrite.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcMemWrite.getFullPacketLen());
|
||||
@ -417,11 +416,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcMemRead tcMemRead(spParams, sequenceCount);
|
||||
result = tcMemRead.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcMemRead.getFullPacketLen());
|
||||
@ -435,12 +432,10 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
||||
return MPSoCReturnValuesIF::NAME_TOO_LONG;
|
||||
}
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
|
||||
result = tcFlashDelete.buildPacket(
|
||||
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcFlashDelete.getFullPacketLen());
|
||||
@ -450,11 +445,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount);
|
||||
result = tcReplayStart.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcReplayStart.getFullPacketLen());
|
||||
@ -463,11 +456,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount);
|
||||
result = tcReplayStop.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcReplayStop.getFullPacketLen());
|
||||
@ -477,11 +468,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount);
|
||||
result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcDownlinkPwrOn.getFullPacketLen());
|
||||
@ -490,11 +479,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandDat
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount);
|
||||
result = tcDownlinkPwrOff.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
|
||||
@ -504,11 +491,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
|
||||
result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcReplayWriteSeq.getFullPacketLen());
|
||||
@ -517,11 +502,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount);
|
||||
result = tcModeReplay.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcModeReplay.getFullPacketLen());
|
||||
@ -530,11 +513,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount);
|
||||
result = tcModeIdle.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcModeIdle.getFullPacketLen());
|
||||
@ -544,11 +525,9 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
sequenceCount++;
|
||||
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
|
||||
result = tcCamCmdSend.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
sequenceCount--;
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcCamCmdSend.getFullPacketLen());
|
||||
@ -560,6 +539,7 @@ void PlocMPSoCHandler::finishTcPrep(size_t packetLen) {
|
||||
nextReplyId = mpsoc::ACK_REPORT;
|
||||
rawPacket = commandBuffer;
|
||||
rawPacketLen = packetLen;
|
||||
sequenceCount++;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||
|
@ -107,10 +107,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
MessageQueueIF* commandActionHelperQueue = nullptr;
|
||||
|
||||
// Initiate the sequence count with the maximum value. It is incremented before
|
||||
// a packet is sent, so the first value will be 0 accordingly using
|
||||
// the wrap around of the counter.
|
||||
SourceSequenceCounter sequenceCount = SourceSequenceCounter(ccsds::LIMIT_SEQUENCE_COUNT - 1);
|
||||
SourceSequenceCounter sequenceCount = SourceSequenceCounter(0);
|
||||
|
||||
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
|
||||
SpacePacketCreator creator;
|
||||
|
@ -136,29 +136,34 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doStartUp() {
|
||||
if (setTimeDuringStartup) {
|
||||
if (startupState == StartupState::OFF) {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::BOOTING;
|
||||
}
|
||||
if (startupState == StartupState::BOOTING) {
|
||||
if (bootTimeout.hasTimedOut()) {
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
uartManager.start();
|
||||
if (startupState == StartupState::OFF) {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::BOOTING;
|
||||
}
|
||||
if (startupState == StartupState::BOOTING) {
|
||||
if (bootTimeout.hasTimedOut()) {
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
uartManager.start();
|
||||
if (SET_TIME_DURING_BOOT) {
|
||||
startupState = StartupState::SET_TIME;
|
||||
} else {
|
||||
startupState = StartupState::ON;
|
||||
}
|
||||
}
|
||||
if (startupState == StartupState::ON) {
|
||||
setMode(_MODE_TO_ON);
|
||||
}
|
||||
} else {
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
}
|
||||
if (startupState == StartupState::SET_TIME_EXECUTING) {
|
||||
startupState = StartupState::ON;
|
||||
}
|
||||
if (startupState == StartupState::ON) {
|
||||
setMode(_MODE_TO_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doShutDown() {
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
shutdownCmdSent = false;
|
||||
packetInBuffer = false;
|
||||
nextReplyId = supv::NONE;
|
||||
uartManager.stop();
|
||||
uartIsolatorSwitch.pullLow();
|
||||
startupState = StartupState::OFF;
|
||||
@ -1467,11 +1472,10 @@ ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandDa
|
||||
ReturnValue_t PlocSupervisorHandler::prepareFactoryResetCmd(const uint8_t* commandData,
|
||||
size_t len) {
|
||||
FactoryReset resetCmd(spParams);
|
||||
std::optional<uint8_t> op;
|
||||
if (len > 0) {
|
||||
op = commandData[0];
|
||||
if (len < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
ReturnValue_t result = resetCmd.buildPacket(op);
|
||||
ReturnValue_t result = resetCmd.buildPacket(commandData[0]);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -1897,9 +1901,8 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionRepor
|
||||
break;
|
||||
}
|
||||
case supv::SET_TIME_REF: {
|
||||
if (startupState == StartupState::SET_TIME_EXECUTING) {
|
||||
startupState = StartupState::ON;
|
||||
}
|
||||
// We could only allow proper bootup when the time was set successfully, but
|
||||
// this makes debugging difficult.
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -97,11 +97,11 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
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;
|
||||
// 4 s
|
||||
static const uint32_t BOOT_TIMEOUT = 4000;
|
||||
enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON };
|
||||
|
||||
bool setTimeDuringStartup = true;
|
||||
static constexpr bool SET_TIME_DURING_BOOT = true;
|
||||
|
||||
StartupState startupState = StartupState::OFF;
|
||||
|
||||
@ -138,8 +138,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
uint32_t receivedMramDumpPackets = 0;
|
||||
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
|
||||
bool packetInBuffer = false;
|
||||
/** Points to the next free position in the space packet buffer */
|
||||
uint16_t bufferTop = 0;
|
||||
|
||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];
|
||||
|
@ -100,6 +100,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
state = InternalState::SLEEPING;
|
||||
lock->unlockMutex();
|
||||
semaphore->acquire();
|
||||
putTaskToSleep = false;
|
||||
while (true) {
|
||||
if (putTaskToSleep) {
|
||||
performUartShutdown();
|
||||
@ -295,11 +296,14 @@ void PlocSupvUartManager::stop() {
|
||||
}
|
||||
|
||||
void PlocSupvUartManager::start() {
|
||||
MutexGuard mg(lock);
|
||||
if (state != InternalState::SLEEPING and state != InternalState::GO_TO_SLEEP) {
|
||||
return;
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
if (state != InternalState::SLEEPING and state != InternalState::GO_TO_SLEEP) {
|
||||
return;
|
||||
}
|
||||
state = InternalState::DEFAULT;
|
||||
}
|
||||
state = InternalState::DEFAULT;
|
||||
|
||||
semaphore->release();
|
||||
}
|
||||
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 9016d3d992bb6c5aa8dd11065ceb913b8ba88491
|
||||
Subproject commit 5c675560eadadfbb5e674d9be87c206df09d1771
|
Loading…
x
Reference in New Issue
Block a user