Variable STR CFG path #824
@ -82,17 +82,13 @@ void StarTrackerHandler::doStartUp() {
|
|||||||
// the device handler's submode to the star tracker's mode
|
// the device handler's submode to the star tracker's mode
|
||||||
return;
|
return;
|
||||||
case StartupState::DONE:
|
case StartupState::DONE:
|
||||||
if (jcfgCountdown.isBusy()) {
|
if (!JCFG_DONE) {
|
||||||
startupState = StartupState::WAIT_JCFG;
|
startupState = StartupState::WAIT_JCFG;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startupState = StartupState::IDLE;
|
startupState = StartupState::IDLE;
|
||||||
break;
|
break;
|
||||||
case StartupState::WAIT_JCFG: {
|
case StartupState::WAIT_JCFG: {
|
||||||
if (jcfgCountdown.hasTimedOut()) {
|
|
||||||
startupState = StartupState::IDLE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -172,6 +168,7 @@ bool StarTrackerHandler::reloadJsonCfgFile() {
|
|||||||
jcfgCountdown.resetTimer();
|
jcfgCountdown.resetTimer();
|
||||||
auto strCfgPath = cfgPathGetter.getCfgPath();
|
auto strCfgPath = cfgPathGetter.getCfgPath();
|
||||||
if (strCfgPath.has_value()) {
|
if (strCfgPath.has_value()) {
|
||||||
|
jcfgPending = true;
|
||||||
jsonCfgTask = std::thread{setUpJsonCfgs, std::ref(jcfgs), strCfgPath.value()};
|
jsonCfgTask = std::thread{setUpJsonCfgs, std::ref(jcfgs), strCfgPath.value()};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -199,13 +196,14 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case (startracker::RELOAD_JSON_CFG_FILE): {
|
case (startracker::RELOAD_JSON_CFG_FILE): {
|
||||||
|
if (jcfgPending) {
|
||||||
|
return HasActionsIF::IS_BUSY;
|
||||||
|
}
|
||||||
// It should be noted that this just reloads the JSON config structure in memory from the
|
// It should be noted that this just reloads the JSON config structure in memory from the
|
||||||
// JSON file. The configuration still needs to be sent to the STR. The easiest way to achieve
|
// JSON file. The configuration still needs to be sent to the STR. The easiest way to achieve
|
||||||
// this is to simply reboot the device after a reload.
|
// this is to simply reboot the device after a reload.
|
||||||
if (reloadJsonCfgFile()) {
|
reloadJsonCfgFile();
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return returnvalue::OK;
|
||||||
}
|
|
||||||
return returnvalue::FAILED;
|
|
||||||
}
|
}
|
||||||
case (startracker::RESET_SECONDARY_TM_SET): {
|
case (startracker::RESET_SECONDARY_TM_SET): {
|
||||||
resetSecondaryTmSet();
|
resetSecondaryTmSet();
|
||||||
@ -355,6 +353,24 @@ void StarTrackerHandler::performOperationHook() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (jcfgPending) {
|
||||||
|
if (JCFG_DONE) {
|
||||||
|
auto iter = deviceCommandMap.find(startracker::RELOAD_JSON_CFG_FILE);
|
||||||
|
if (iter != deviceCommandMap.end()) {
|
||||||
|
if (iter->second.sendReplyTo != MessageQueueIF::NO_QUEUE) {
|
||||||
|
actionHelper.finish(true, iter->second.sendReplyTo, startracker::RELOAD_JSON_CFG_FILE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonCfgTask.join();
|
||||||
|
jcfgPending = false;
|
||||||
|
} else if (jcfgCountdown.hasTimedOut()) {
|
||||||
|
auto iter = deviceCommandMap.find(startracker::RELOAD_JSON_CFG_FILE);
|
||||||
|
if (iter->second.sendReplyTo != MessageQueueIF::NO_QUEUE) {
|
||||||
|
actionHelper.finish(false, iter->second.sendReplyTo, startracker::RELOAD_JSON_CFG_FILE,
|
||||||
|
returnvalue::FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Submode_t StarTrackerHandler::getInitialSubmode() { return startracker::SUBMODE_BOOTLOADER; }
|
Submode_t StarTrackerHandler::getInitialSubmode() { return startracker::SUBMODE_BOOTLOADER; }
|
||||||
|
@ -240,8 +240,9 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
Subscription subscription;
|
Subscription subscription;
|
||||||
AutoThreshold autoThreshold;
|
AutoThreshold autoThreshold;
|
||||||
};
|
};
|
||||||
|
bool jcfgPending = false;
|
||||||
JsonConfigs jcfgs;
|
JsonConfigs jcfgs;
|
||||||
Countdown jcfgCountdown = Countdown(250);
|
Countdown jcfgCountdown = Countdown(1000);
|
||||||
bool commandExecuted = false;
|
bool commandExecuted = false;
|
||||||
std::thread jsonCfgTask;
|
std::thread jsonCfgTask;
|
||||||
static void setUpJsonCfgs(JsonConfigs& cfgs, std::string paramJsonFile);
|
static void setUpJsonCfgs(JsonConfigs& cfgs, std::string paramJsonFile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user