Variable STR CFG path #824

Merged
muellerr merged 7 commits from str-variable-cfg-path-q7s into main 2023-11-29 14:09:10 +01:00
4 changed files with 39 additions and 11 deletions
Showing only changes of commit 9010d1d202 - Show all commits

View File

@ -16,6 +16,18 @@ will consitute of a breaking change warranting a new major release:
# [unreleased]
## Fixed
- STR config path was previously hardcoded to `/mnt/sd0/startracker/flight-config.json`.
A new abstraction was introduces which now uses the active SD card to build the correct
config path when initializing the star tracker.
## Added
- Introduced a new `RELOAD_JSON_CFG_FILE` command for the STR to reload the JSON configuration
data based on the current output of the config file path getter function. A reboot of the
device is still necessary to load the configuration to the STR.
# [v7.3.0] 2023-11-07
## Changed

View File

@ -139,14 +139,7 @@ ReturnValue_t StarTrackerHandler::initialize() {
// Spin up a thread to do the JSON initialization, takes 200-250 ms which would
// delay whole satellite boot process.
jcfgCountdown.resetTimer();
auto strCfgPath = cfgPathGetter.getCfgPath();
if (strCfgPath.has_value()) {
jsonCfgTask = std::thread{setUpJsonCfgs, std::ref(jcfgs), strCfgPath.value()};
} else {
// Simplified FDIR: Just continue as usual..
JCFG_DONE = true;
}
reloadJsonCfgFile();
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (manager == nullptr) {
@ -175,6 +168,18 @@ ReturnValue_t StarTrackerHandler::initialize() {
return returnvalue::OK;
}
bool StarTrackerHandler::reloadJsonCfgFile() {
jcfgCountdown.resetTimer();
auto strCfgPath = cfgPathGetter.getCfgPath();
if (strCfgPath.has_value()) {
jsonCfgTask = std::thread{setUpJsonCfgs, std::ref(jcfgs), strCfgPath.value()};
return true;
}
// Simplified FDIR: Just continue as usual..
JCFG_DONE = true;
return false;
}
ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = returnvalue::OK;
@ -193,6 +198,15 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
addSecondaryTmForNormalMode(idToAdd);
return EXECUTION_FINISHED;
}
case (startracker::RELOAD_JSON_CFG_FILE): {
// 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
// this is to simply reboot the device after a reload.
if (reloadJsonCfgFile()) {
return HasActionsIF::EXECUTION_FINISHED;
}
return returnvalue::FAILED;
}
case (startracker::RESET_SECONDARY_TM_SET): {
resetSecondaryTmSet();
return EXECUTION_FINISHED;

View File

@ -544,6 +544,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
void doNormalTransition(Mode_t modeFrom, Submode_t subModeFrom);
void bootFirmware(Mode_t toMode);
void bootBootloader();
bool reloadJsonCfgFile();
};
#endif /* MISSION_DEVICES_STARTRACKERHANDLER_H_ */

View File

@ -387,6 +387,7 @@ static constexpr DeviceCommandId_t REQ_CENTROIDS = 94;
static constexpr DeviceCommandId_t ADD_SECONDARY_TM_TO_NORMAL_MODE = 95;
static constexpr DeviceCommandId_t RESET_SECONDARY_TM_SET = 96;
static constexpr DeviceCommandId_t READ_SECONDARY_TM_SET = 97;
static constexpr DeviceCommandId_t RELOAD_JSON_CFG_FILE = 100;
static const DeviceCommandId_t NONE = 0xFFFFFFFF;
static const uint32_t VERSION_SET_ID = REQ_VERSION;