move countdown reset
EIVE/eive-obsw/pipeline/head This commit looks good Details

This commit is contained in:
Robin Müller 2022-07-08 16:57:40 +02:00
parent 57f97de58e
commit fc639a3e3f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 21 additions and 6 deletions

View File

@ -52,36 +52,57 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
switch (deviceCommand) {
case (PING): {
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
tempCheck);
break;
}
case (EXP_STATUS_CMD): {
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
tempCheck);
break;
}
case (ION_CMD): {
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
tempCheck);
break;
}
case (TEMP_CMD): {
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen, {nullptr, 0},
tempCheck);
break;
}
case (FRAM): {
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
break;
}
case (ONE_CELL): {
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
break;
}
case (ALL_CELLS_CMD): {
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
break;
@ -130,9 +151,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
ReturnValue_t status = RETURN_OK;
auto oneFileHandler = [&](std::string cmdName) {
fileId = random_string(6);
finishCountdown.setTimeout(SHORT_CD);
// countdown starten
finishCountdown.resetTimer();
std::ostringstream oss("/tmp/scex-");
oss << cmdName << fileId << ".bin";
fileName = oss.str();
@ -149,9 +167,6 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
};
auto multiFileHandler = [&](std::string cmdName) {
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
fileId = random_string(6);
std::ostringstream oss("/tmp/scex-");