bug fixes in ImtqHandler

This commit is contained in:
Jakob Meier 2021-06-09 12:00:41 +02:00
parent 427e36ed15
commit 95a3882fa1
2 changed files with 20 additions and 4 deletions

View File

@ -18,13 +18,13 @@ IMTQHandler::~IMTQHandler() {
void IMTQHandler::doStartUp(){ void IMTQHandler::doStartUp(){
if(selfTestSuccess == true){ if(selfTestPerformed == true){
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
setMode(MODE_NORMAL); setMode(MODE_NORMAL);
#else #else
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
#endif #endif
selfTestSuccess = false; selfTestPerformed = false;
} }
} }
@ -65,9 +65,11 @@ ReturnValue_t IMTQHandler::buildTransitionDeviceCommand(
switch (startupStep) { switch (startupStep) {
case StartupStep::COMMAND_SELF_TEST: case StartupStep::COMMAND_SELF_TEST:
*id = IMTQ::SELF_TEST_CMD; *id = IMTQ::SELF_TEST_CMD;
startupStep = StartupStep::GET_SELF_TEST_RESULT;
break; break;
case StartupStep::GET_SELF_TEST_RESULT: case StartupStep::GET_SELF_TEST_RESULT:
*id = IMTQ::GET_SELF_TEST_RESULT; *id = IMTQ::GET_SELF_TEST_RESULT;
startupStep = StartupStep::NONE;
break; break;
default: default:
sif::debug << "IMTQHandler::buildTransitionDeviceCommand: Unknown startup step" sif::debug << "IMTQHandler::buildTransitionDeviceCommand: Unknown startup step"
@ -148,6 +150,8 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
void IMTQHandler::fillCommandAndReplyMap() { void IMTQHandler::fillCommandAndReplyMap() {
this->insertInCommandAndReplyMap(IMTQ::SELF_TEST_CMD, 1, nullptr, this->insertInCommandAndReplyMap(IMTQ::SELF_TEST_CMD, 1, nullptr,
IMTQ::SIZE_STATUS_REPLY); IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_SELF_TEST_RESULT, 1, nullptr,
IMTQ::SIZE_SELF_TEST_RESULTS);
this->insertInCommandAndReplyMap(IMTQ::START_ACTUATION_DIPOLE, 1, nullptr, this->insertInCommandAndReplyMap(IMTQ::START_ACTUATION_DIPOLE, 1, nullptr,
IMTQ::SIZE_STATUS_REPLY); IMTQ::SIZE_STATUS_REPLY);
this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset, this->insertInCommandAndReplyMap(IMTQ::GET_ENG_HK_DATA, 1, &engHkDataset,
@ -192,6 +196,14 @@ ReturnValue_t IMTQHandler::scanForReply(const uint8_t *start,
*foundLen = IMTQ::SIZE_GET_RAW_MTM_MEASUREMENT; *foundLen = IMTQ::SIZE_GET_RAW_MTM_MEASUREMENT;
*foundId = IMTQ::GET_RAW_MTM_MEASUREMENT; *foundId = IMTQ::GET_RAW_MTM_MEASUREMENT;
break; break;
case(IMTQ::CC::SELF_TEST_CMD):
*foundLen = IMTQ::SIZE_STATUS_REPLY;
*foundId = IMTQ::SELF_TEST_CMD;
break;
case(IMTQ::CC::GET_SELF_TEST_RESULT):
*foundLen = IMTQ::SIZE_SELF_TEST_RESULTS;
*foundId = IMTQ::GET_SELF_TEST_RESULT;
break;
default: default:
sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl; sif::debug << "IMTQHandler::scanForReply: Reply contains invalid command code" << std::endl;
result = IGNORE_REPLY_DATA; result = IGNORE_REPLY_DATA;
@ -247,7 +259,7 @@ void IMTQHandler::setNormalDatapoolEntriesInvalid(){
} }
uint32_t IMTQHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){ uint32_t IMTQHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
return 1000; return 5000;
} }
ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
@ -1060,6 +1072,9 @@ void IMTQHandler::handleSelfTestReply(const uint8_t* packet) {
sif::info << "IMTQ self test (FINA) coil Z temperature: " sif::info << "IMTQ self test (FINA) coil Z temperature: "
<< selfTestDataset.finaCoilZTemperature << " °C" << std::endl; << selfTestDataset.finaCoilZTemperature << " °C" << std::endl;
#endif #endif
if (mode == _MODE_START_UP) {
selfTestPerformed = true;
}
} }
void IMTQHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) { void IMTQHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) {

View File

@ -91,13 +91,14 @@ private:
CommunicationStep communicationStep = CommunicationStep::GET_ENG_HK_DATA; CommunicationStep communicationStep = CommunicationStep::GET_ENG_HK_DATA;
enum class StartupStep { enum class StartupStep {
NONE,
COMMAND_SELF_TEST, COMMAND_SELF_TEST,
GET_SELF_TEST_RESULT GET_SELF_TEST_RESULT
}; };
StartupStep startupStep = StartupStep::COMMAND_SELF_TEST; StartupStep startupStep = StartupStep::COMMAND_SELF_TEST;
bool selfTestSuccess = false; bool selfTestPerformed = false;
/** /**
* @brief Each reply contains a status byte giving information about a request. This function * @brief Each reply contains a status byte giving information about a request. This function