diff --git a/bsp_q7s/devices/startracker/StarTrackerDefinitions.h b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h index dda013b2..0c04e1c5 100644 --- a/bsp_q7s/devices/startracker/StarTrackerDefinitions.h +++ b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h @@ -9,7 +9,7 @@ #include "objects/systemObjectList.h" -namespace StarTracker { +namespace startracker { /** This is the address of the star tracker */ static const uint8_t ADDRESS = 33; @@ -373,6 +373,56 @@ static const uint8_t BOOTLOADER = 1; static const uint8_t FIRMWARE = 2; } // namespace Program +namespace region_secrets { + static const uint32_t REGION_0_SECRET = 0xd1a220d3; + static const uint32_t REGION_1_SECRET = 0xdc770fa8; + static const uint32_t REGION_2_SECRET = 0xdf9066b0; + static const uint32_t REGION_3_SECRET = 0x5f6a0423; + static const uint32_t REGION_4_SECRET = 0xbbaad5d8; + static const uint32_t REGION_5_SECRET = 0xa81c3678; + static const uint32_t REGION_6_SECRET = 0xe10f76f8; + static const uint32_t REGION_7_SECRET = 0x83220919; + static const uint32_t REGION_8_SECRET = 0xec37289d; + static const uint32_t REGION_9_SECRET = 0x27ac0ef8; + static const uint32_t REGION_10_SECRET = 0xf017e43d; + static const uint32_t REGION_11_SECRET = 0xbc7f7f49; + static const uint32_t REGION_12_SECRET = 0x42fedef6; + static const uint32_t REGION_13_SECRET = 0xe53cf10d; + static const uint32_t REGION_14_SECRET = 0xe862b70b; + static const uint32_t REGION_15_SECRET = 0x79b537ca; + uint32_t secret[16] { + REGION_0_SECRET, + REGION_1_SECRET, + REGION_2_SECRET, + REGION_3_SECRET, + REGION_4_SECRET, + REGION_5_SECRET, + REGION_6_SECRET, + REGION_7_SECRET, + REGION_8_SECRET, + REGION_9_SECRET, + REGION_10_SECRET, + REGION_11_SECRET, + REGION_12_SECRET, + REGION_13_SECRET, + REGION_14_SECRET, + REGION_15_SECRET + }; +} + +enum class FlashSections: uint8_t { + BOOTLOADER_SECTION = 0, + MAIN_FIRMWARE_SECTION = 1, + ARC_CONFIG_SECTION = 2 +}; + +enum class FirmwareRegions: uint32_t { + START = 1, + END = 8 +}; + +static const uint32_t FLASH_REGION_SIZE = 0x20000; + /** * @brief This dataset can be used to store the temperature of a reaction wheel. */ diff --git a/bsp_q7s/devices/startracker/StarTrackerHandler.cpp b/bsp_q7s/devices/startracker/StarTrackerHandler.cpp index c0db5089..95cf4d21 100644 --- a/bsp_q7s/devices/startracker/StarTrackerHandler.cpp +++ b/bsp_q7s/devices/startracker/StarTrackerHandler.cpp @@ -91,11 +91,11 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu ReturnValue_t result = RETURN_OK; switch (actionId) { - case (StarTracker::STOP_IMAGE_LOADER): { + case (startracker::STOP_IMAGE_LOADER): { strHelper->stopProcess(); return EXECUTION_FINISHED; } - case (StarTracker::SET_JSON_FILE_NAME): { + case (startracker::SET_JSON_FILE_NAME): { if (size > MAX_PATH_SIZE) { return FILE_PATH_TOO_LONG; } @@ -117,7 +117,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu // Intercept image loader commands which do not follow the common DHB communication flow switch (actionId) { - case (StarTracker::UPLOAD_IMAGE): { + case (startracker::UPLOAD_IMAGE): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -132,7 +132,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu strHelperExecuting = true; return EXECUTION_FINISHED; } - case (StarTracker::DOWNLOAD_IMAGE): { + case (startracker::DOWNLOAD_IMAGE): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -148,7 +148,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu strHelperExecuting = true; return EXECUTION_FINISHED; } - case (StarTracker::WRITE): { + case (startracker::WRITE): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -161,7 +161,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu strHelperExecuting = true; return EXECUTION_FINISHED; } - case (StarTracker::READ): { + case (startracker::READ): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -173,28 +173,28 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu strHelperExecuting = true; return EXECUTION_FINISHED; } - case (StarTracker::CHANGE_DOWNLOAD_FILE): { + case (startracker::CHANGE_DOWNLOAD_FILE): { if (size > MAX_FILE_NAME) { return FILENAME_TOO_LONG; } strHelper->setDownloadImageName(std::string(reinterpret_cast(data), size)); return EXECUTION_FINISHED; } - case (StarTracker::CHANGE_FPGA_DOWNLOAD_FILE): { + case (startracker::CHANGE_FPGA_DOWNLOAD_FILE): { if (size > MAX_FILE_NAME) { return FILENAME_TOO_LONG; } strHelper->setDownloadFpgaImage(std::string(reinterpret_cast(data), size)); return EXECUTION_FINISHED; } - case (StarTracker::SET_READ_FILENAME): { + case (startracker::SET_READ_FILENAME): { if (size > MAX_FILE_NAME) { return FILENAME_TOO_LONG; } strHelper->setDownloadImageName(std::string(reinterpret_cast(data), size)); return EXECUTION_FINISHED; } - case (StarTracker::DOWNLOAD_FPGA_IMAGE): { + case (startracker::DOWNLOAD_FPGA_IMAGE): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -209,7 +209,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu strHelperExecuting = true; return EXECUTION_FINISHED; } - case (StarTracker::UPLOAD_FPGA_IMAGE): { + case (startracker::UPLOAD_FPGA_IMAGE): { result = DeviceHandlerBase::acceptExternalDeviceCommands(); if (result != RETURN_OK) { return result; @@ -275,7 +275,7 @@ void StarTrackerHandler::doOffActivity() { startupState = StartupState::IDLE; } ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { switch (internalState) { case InternalState::TEMPERATURE_REQUEST: - *id = StarTracker::REQ_TEMPERATURE; + *id = startracker::REQ_TEMPERATURE; break; default: sif::debug << "StarTrackerHandler::buildNormalDeviceCommand: Invalid internal step" @@ -291,62 +291,62 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t } switch (startupState) { case StartupState::CHECK_BOOT_STATE: - *id = StarTracker::REQ_VERSION; + *id = startracker::REQ_VERSION; startupState = StartupState::WAIT_FOR_EXECUTION; return buildCommandFromCommand(*id, nullptr, 0); case StartupState::BOOT: - *id = StarTracker::BOOT; + *id = startracker::BOOT; bootCountdown.setTimeout(BOOT_TIMEOUT); startupState = StartupState::BOOT_DELAY; return buildCommandFromCommand(*id, nullptr, 0); case StartupState::LIMITS: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::LIMITS; + *id = startracker::LIMITS; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::TRACKING: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::TRACKING; + *id = startracker::TRACKING; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::MOUNTING: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::MOUNTING; + *id = startracker::MOUNTING; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::IMAGE_PROCESSOR: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::IMAGE_PROCESSOR; + *id = startracker::IMAGE_PROCESSOR; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::CAMERA: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::CAMERA; + *id = startracker::CAMERA; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::CENTROIDING: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::CENTROIDING; + *id = startracker::CENTROIDING; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::LISA: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::LISA; + *id = startracker::LISA; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::MATCHING: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::MATCHING; + *id = startracker::MATCHING; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::VALIDATION: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::VALIDATION; + *id = startracker::VALIDATION; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); case StartupState::ALGO: startupState = StartupState::WAIT_FOR_EXECUTION; - *id = StarTracker::ALGO; + *id = startracker::ALGO; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); default: @@ -360,157 +360,157 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi size_t commandDataLen) { ReturnValue_t result = RETURN_OK; switch (deviceCommand) { - case (StarTracker::PING_REQUEST): { + case (startracker::PING_REQUEST): { preparePingRequest(); return RETURN_OK; } - case (StarTracker::REQ_TIME): { + case (startracker::REQ_TIME): { prepareTimeRequest(); return RETURN_OK; } - case (StarTracker::BOOT): { + case (startracker::BOOT): { prepareBootCommand(); return RETURN_OK; } - case (StarTracker::REQ_VERSION): { + case (startracker::REQ_VERSION): { prepareVersionRequest(); return RETURN_OK; } - case (StarTracker::REQ_INTERFACE): { + case (startracker::REQ_INTERFACE): { prepareInterfaceRequest(); return RETURN_OK; } - case (StarTracker::REQ_POWER): { + case (startracker::REQ_POWER): { preparePowerRequest(); return RETURN_OK; } - case (StarTracker::SWITCH_TO_BOOTLOADER_PROGRAM): { + case (startracker::SWITCH_TO_BOOTLOADER_PROGRAM): { prepareRebootCommand(); return RETURN_OK; } - case (StarTracker::TAKE_IMAGE): { + case (startracker::TAKE_IMAGE): { prepareTakeImageCommand(commandData); return RETURN_OK; } - case (StarTracker::SUBSCRIBE_TO_TM): { + case (startracker::SUBSCRIBE_TO_TM): { prepareSubscriptionCommand(commandData); return RETURN_OK; } - case (StarTracker::REQ_SOLUTION): { + case (startracker::REQ_SOLUTION): { prepareSolutionRequest(); return RETURN_OK; } - case (StarTracker::REQ_TEMPERATURE): { + case (startracker::REQ_TEMPERATURE): { prepareTemperatureRequest(); return RETURN_OK; } - case (StarTracker::REQ_HISTOGRAM): { + case (startracker::REQ_HISTOGRAM): { prepareHistogramRequest(); return RETURN_OK; } - case (StarTracker::REQ_CONTRAST): { + case (startracker::REQ_CONTRAST): { prepareContrastRequest(); return RETURN_OK; } - case (StarTracker::RESET_ERROR): { + case (startracker::RESET_ERROR): { prepareErrorResetRequest(); return RETURN_OK; } - case (StarTracker::LIMITS): { + case (startracker::LIMITS): { Limits limits; result = prepareParamCommand(commandData, commandDataLen, limits); return result; } - case (StarTracker::MOUNTING): { + case (startracker::MOUNTING): { Mounting mounting; result = prepareParamCommand(commandData, commandDataLen, mounting); return result; } - case (StarTracker::IMAGE_PROCESSOR): { + case (startracker::IMAGE_PROCESSOR): { ImageProcessor imageProcessor; result = prepareParamCommand(commandData, commandDataLen, imageProcessor); return result; } - case (StarTracker::CAMERA): { + case (startracker::CAMERA): { Camera camera; result = prepareParamCommand(commandData, commandDataLen, camera); return result; } - case (StarTracker::CENTROIDING): { + case (startracker::CENTROIDING): { Centroiding centroiding; result = prepareParamCommand(commandData, commandDataLen, centroiding); return result; } - case (StarTracker::LISA): { + case (startracker::LISA): { Lisa lisa; result = prepareParamCommand(commandData, commandDataLen, lisa); return result; } - case (StarTracker::MATCHING): { + case (startracker::MATCHING): { Matching matching; result = prepareParamCommand(commandData, commandDataLen, matching); return result; } - case (StarTracker::VALIDATION): { + case (startracker::VALIDATION): { Validation validation; result = prepareParamCommand(commandData, commandDataLen, validation); return result; } - case (StarTracker::ALGO): { + case (startracker::ALGO): { Algo algo; result = prepareParamCommand(commandData, commandDataLen, algo); return result; } - case (StarTracker::TRACKING): { + case (startracker::TRACKING): { Tracking tracking; result = prepareParamCommand(commandData, commandDataLen, tracking); return result; } - case (StarTracker::ERASE): { + case (startracker::ERASE): { result = prepareEraseCommand(commandData, commandDataLen); return result; } - case (StarTracker::UNLOCK): { + case (startracker::UNLOCK): { result = prepareUnlockCommand(commandData, commandDataLen); return result; } - case (StarTracker::CHECKSUM): { + case (startracker::CHECKSUM): { result = prepareChecksumCommand(commandData, commandDataLen); return result; } - case (StarTracker::SET_TIME): { + case (startracker::SET_TIME): { result = prepareSetTimeCommand(commandData, commandDataLen); return result; } - case (StarTracker::DOWNLOAD_CENTROID): { + case (startracker::DOWNLOAD_CENTROID): { result = prepareDownloadCentroidCommand(commandData, commandDataLen); return result; } - case (StarTracker::UPLOAD_CENTROID): { + case (startracker::UPLOAD_CENTROID): { result = prepareUploadCentroidCommand(commandData, commandDataLen); return result; } - case (StarTracker::DOWNLOAD_MATCHED_STAR): { + case (startracker::DOWNLOAD_MATCHED_STAR): { result = prepareDownloadMatchedStarCommand(commandData, commandDataLen); return result; } - case (StarTracker::DOWNLOAD_DBIMAGE): { + case (startracker::DOWNLOAD_DBIMAGE): { result = prepareDownloadDbImageCommand(commandData, commandDataLen); return result; } - case (StarTracker::DOWNLOAD_BLOBPIXEL): { + case (startracker::DOWNLOAD_BLOBPIXEL): { result = prepareDownloadBlobPixelCommand(commandData, commandDataLen); return result; } - case (StarTracker::FPGA_ACTION): { + case (startracker::FPGA_ACTION): { result = prepareFpgaActionCommand(commandData, commandDataLen); return result; } - case (StarTracker::REQ_CAMERA): { + case (startracker::REQ_CAMERA): { result = prepareRequestCameraParams(); return result; } - case (StarTracker::REQ_LIMITS): { + case (startracker::REQ_LIMITS): { result = prepareRequestLimitsParams(); return result; } @@ -523,81 +523,81 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi void StarTrackerHandler::fillCommandAndReplyMap() { /** Reply lengths are unknown because of the slip encoding. Thus always maximum reply size * is specified */ - this->insertInCommandAndReplyMap(StarTracker::PING_REQUEST, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandMap(StarTracker::BOOT); - this->insertInCommandAndReplyMap(StarTracker::REQ_VERSION, 3, &versionSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_TIME, 3, &timeSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandMap(StarTracker::UPLOAD_IMAGE); - this->insertInCommandMap(StarTracker::DOWNLOAD_IMAGE); - this->insertInCommandAndReplyMap(StarTracker::REQ_POWER, 3, &powerSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_INTERFACE, 3, &interfaceSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::PING_REQUEST, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandMap(startracker::BOOT); + this->insertInCommandAndReplyMap(startracker::REQ_VERSION, 3, &versionSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_TIME, 3, &timeSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandMap(startracker::UPLOAD_IMAGE); + this->insertInCommandMap(startracker::DOWNLOAD_IMAGE); + this->insertInCommandAndReplyMap(startracker::REQ_POWER, 3, &powerSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_INTERFACE, 3, &interfaceSet, + startracker::MAX_FRAME_SIZE * 2 + 2); // Reboot has no reply. Star tracker reboots immediately - this->insertInCommandMap(StarTracker::SWITCH_TO_BOOTLOADER_PROGRAM); - this->insertInCommandAndReplyMap(StarTracker::SUBSCRIBE_TO_TM, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_SOLUTION, 3, &solutionSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_TEMPERATURE, 3, &temperatureSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_HISTOGRAM, 3, &histogramSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_CONTRAST, 3, &contrastSet, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::LIMITS, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::MOUNTING, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::IMAGE_PROCESSOR, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::CAMERA, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::CAMERA, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::CENTROIDING, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::LISA, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::MATCHING, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::TRACKING, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::VALIDATION, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::ALGO, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::TAKE_IMAGE, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::RESET_ERROR, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::ERASE, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::UNLOCK, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::CHECKSUM, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::SET_TIME, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::DOWNLOAD_CENTROID, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::UPLOAD_CENTROID, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::DOWNLOAD_MATCHED_STAR, 3, &downloadMatchedStar, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::DOWNLOAD_DBIMAGE, 3, &downloadDbImage, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::DOWNLOAD_BLOBPIXEL, 3, &downloadBlobPixel, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::FPGA_ACTION, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_CAMERA, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::REQ_LIMITS, 3, nullptr, - StarTracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandMap(startracker::SWITCH_TO_BOOTLOADER_PROGRAM); + this->insertInCommandAndReplyMap(startracker::SUBSCRIBE_TO_TM, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_SOLUTION, 3, &solutionSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_TEMPERATURE, 3, &temperatureSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_HISTOGRAM, 3, &histogramSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_CONTRAST, 3, &contrastSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::LIMITS, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::MOUNTING, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::IMAGE_PROCESSOR, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::CAMERA, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::CAMERA, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::CENTROIDING, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::LISA, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::MATCHING, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::TRACKING, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::VALIDATION, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::ALGO, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::TAKE_IMAGE, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::RESET_ERROR, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::ERASE, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::UNLOCK, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::CHECKSUM, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::SET_TIME, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::DOWNLOAD_CENTROID, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::UPLOAD_CENTROID, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::DOWNLOAD_MATCHED_STAR, 3, &downloadMatchedStar, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::DOWNLOAD_DBIMAGE, 3, &downloadDbImage, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::DOWNLOAD_BLOBPIXEL, 3, &downloadBlobPixel, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::FPGA_ACTION, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_CAMERA, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_LIMITS, 3, nullptr, + startracker::MAX_FRAME_SIZE * 2 + 2); } ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize, @@ -658,57 +658,57 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, ReturnValue_t result = RETURN_OK; switch (id) { - case (StarTracker::SUBSCRIBE_TO_TM): { + case (startracker::SUBSCRIBE_TO_TM): { result = handleSetParamReply(); break; } - case (StarTracker::REQ_TIME): { - result = handleTm(timeSet, StarTracker::TimeSet::SIZE); + case (startracker::REQ_TIME): { + result = handleTm(timeSet, startracker::TimeSet::SIZE); break; } - case (StarTracker::PING_REQUEST): { + case (startracker::PING_REQUEST): { result = handlePingReply(); break; } - case (StarTracker::BOOT): - case (StarTracker::TAKE_IMAGE): - case (StarTracker::RESET_ERROR): - case (StarTracker::UNLOCK): - case (StarTracker::SET_TIME): - case (StarTracker::FPGA_ACTION): { + case (startracker::BOOT): + case (startracker::TAKE_IMAGE): + case (startracker::RESET_ERROR): + case (startracker::UNLOCK): + case (startracker::SET_TIME): + case (startracker::FPGA_ACTION): { result = handleActionReply(); break; } - case (StarTracker::DOWNLOAD_CENTROID): { - result = handleActionReplySet(downloadCentroidSet, StarTracker::DownloadCentroidSet::SIZE); + case (startracker::DOWNLOAD_CENTROID): { + result = handleActionReplySet(downloadCentroidSet, startracker::DownloadCentroidSet::SIZE); break; } - case (StarTracker::DOWNLOAD_MATCHED_STAR): { - result = handleActionReplySet(downloadMatchedStar, StarTracker::DownloadMatchedStar::SIZE); + case (startracker::DOWNLOAD_MATCHED_STAR): { + result = handleActionReplySet(downloadMatchedStar, startracker::DownloadMatchedStar::SIZE); break; } - case (StarTracker::DOWNLOAD_DBIMAGE): { - result = handleActionReplySet(downloadDbImage, StarTracker::DownloadDBImage::SIZE); + case (startracker::DOWNLOAD_DBIMAGE): { + result = handleActionReplySet(downloadDbImage, startracker::DownloadDBImage::SIZE); break; } - case (StarTracker::DOWNLOAD_BLOBPIXEL): { - result = handleActionReplySet(downloadBlobPixel, StarTracker::DownloadBlobPixel::SIZE); + case (startracker::DOWNLOAD_BLOBPIXEL): { + result = handleActionReplySet(downloadBlobPixel, startracker::DownloadBlobPixel::SIZE); break; } - case (StarTracker::UPLOAD_CENTROID): { + case (startracker::UPLOAD_CENTROID): { result = handleUploadCentroidReply(); break; } - case (StarTracker::ERASE): { + case (startracker::ERASE): { result = handleEraseReply(); break; } - case (StarTracker::CHECKSUM): { + case (startracker::CHECKSUM): { result = handleChecksumReply(); break; } - case (StarTracker::REQ_VERSION): { - result = handleTm(versionSet, StarTracker::VersionSet::SIZE); + case (startracker::REQ_VERSION): { + result = handleTm(versionSet, startracker::VersionSet::SIZE); if (result != RETURN_OK) { return result; } @@ -718,49 +718,49 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, } break; } - case (StarTracker::REQ_INTERFACE): { - result = handleTm(interfaceSet, StarTracker::InterfaceSet::SIZE); + case (startracker::REQ_INTERFACE): { + result = handleTm(interfaceSet, startracker::InterfaceSet::SIZE); break; } - case (StarTracker::REQ_POWER): { - result = handleTm(powerSet, StarTracker::PowerSet::SIZE); + case (startracker::REQ_POWER): { + result = handleTm(powerSet, startracker::PowerSet::SIZE); break; } - case (StarTracker::REQ_SOLUTION): { - result = handleTm(solutionSet, StarTracker::SolutionSet::SIZE); + case (startracker::REQ_SOLUTION): { + result = handleTm(solutionSet, startracker::SolutionSet::SIZE); break; } - case (StarTracker::REQ_TEMPERATURE): { - result = handleTm(temperatureSet, StarTracker::TemperatureSet::SIZE); + case (startracker::REQ_TEMPERATURE): { + result = handleTm(temperatureSet, startracker::TemperatureSet::SIZE); break; } - case (StarTracker::REQ_HISTOGRAM): { - result = handleTm(histogramSet, StarTracker::HistogramSet::SIZE); + case (startracker::REQ_HISTOGRAM): { + result = handleTm(histogramSet, startracker::HistogramSet::SIZE); break; } - case (StarTracker::REQ_CONTRAST): { - result = handleTm(contrastSet, StarTracker::ContrastSet::SIZE); + case (startracker::REQ_CONTRAST): { + result = handleTm(contrastSet, startracker::ContrastSet::SIZE); break; } - case (StarTracker::LIMITS): - case (StarTracker::MOUNTING): - case (StarTracker::CAMERA): - case (StarTracker::CENTROIDING): - case (StarTracker::LISA): - case (StarTracker::MATCHING): - case (StarTracker::TRACKING): - case (StarTracker::VALIDATION): - case (StarTracker::IMAGE_PROCESSOR): - case (StarTracker::ALGO): { + case (startracker::LIMITS): + case (startracker::MOUNTING): + case (startracker::CAMERA): + case (startracker::CENTROIDING): + case (startracker::LISA): + case (startracker::MATCHING): + case (startracker::TRACKING): + case (startracker::VALIDATION): + case (startracker::IMAGE_PROCESSOR): + case (startracker::ALGO): { result = handleSetParamReply(); break; } - case (StarTracker::REQ_CAMERA): { - handleParamRequest(cameraSet, StarTracker::CameraSet::SIZE); + case (startracker::REQ_CAMERA): { + handleParamRequest(cameraSet, startracker::CameraSet::SIZE); break; } - case (StarTracker::REQ_LIMITS): { - handleParamRequest(limitsSet, StarTracker::LimitsSet::SIZE); + case (startracker::REQ_LIMITS): { + handleParamRequest(limitsSet, startracker::LimitsSet::SIZE); break; } default: { @@ -779,225 +779,225 @@ uint32_t StarTrackerHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(StarTracker::TICKS_TIME_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_TIME_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::RUN_TIME, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::UNIX_TIME, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_TIME_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_TIME_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::RUN_TIME, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::UNIX_TIME, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_VERSION_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_VERSION_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::PROGRAM, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MAJOR, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MINOR, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_VERSION_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_VERSION_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::PROGRAM, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MAJOR, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MINOR, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_INTERFACE_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_INTERFACE_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FRAME_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CHECKSUM_ERROR_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::SET_PARAM_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::SET_PARAM_REPLY_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::PARAM_REQUEST_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::PARAM_REPLY_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::REQ_TM_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TM_REPLY_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::ACTION_REQ_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::ACTION_REPLY_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_INTERFACE_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_INTERFACE_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FRAME_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CHECKSUM_ERROR_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::SET_PARAM_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::SET_PARAM_REPLY_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::PARAM_REQUEST_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::PARAM_REPLY_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::REQ_TM_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TM_REPLY_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::ACTION_REQ_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::ACTION_REPLY_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_POWER_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_POWER_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MCU_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MCU_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_CORE_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_CORE_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_18_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_18_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_25_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_25_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_21_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_21_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_PIX_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_PIX_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_33_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_33_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_RES_CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMV_RES_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_POWER_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_POWER_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MCU_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MCU_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_CORE_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_CORE_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_18_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_18_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_25_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_25_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_21_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_21_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_PIX_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_PIX_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_33_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_33_VOLTAGE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_RES_CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMV_RES_VOLTAGE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_TEMPERATURE_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_TEMPERATURE_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MCU_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CMOS_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FPGA_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_TEMPERATURE_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_TEMPERATURE_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MCU_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CMOS_TEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FPGA_TEMPERATURE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_SOLUTION_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_SOLUTION_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CALI_QW, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CALI_QX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CALI_QY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CALI_QZ, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_CONFIDENCE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_QW, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_QX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_QY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_QZ, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRACK_REMOVED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::STARS_CENTROIDED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::STARS_MATCHED_DATABASE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_QW, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_QX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_QY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_QZ, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_PERC_CLOSE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LISA_NR_CLOSE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TRUST_WORTHY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::STABLE_COUNT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::SOLUTION_STRATEGY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_SOLUTION_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_SOLUTION_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CALI_QW, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CALI_QX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CALI_QY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CALI_QZ, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_CONFIDENCE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_QW, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_QX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_QY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_QZ, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRACK_REMOVED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::STARS_CENTROIDED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::STARS_MATCHED_DATABASE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_QW, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_QX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_QY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_QZ, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_PERC_CLOSE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LISA_NR_CLOSE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TRUST_WORTHY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::STABLE_COUNT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::SOLUTION_STRATEGY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_HISTOGRAM_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_HISTOGRAM_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINA8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINB8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BINC8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::HISTOGRAM_BIND8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_HISTOGRAM_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_HISTOGRAM_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINA8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINB8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BINC8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::HISTOGRAM_BIND8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TICKS_CONTRAST_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::TIME_CONTRAST_SET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINA8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINB8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BINC8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND0, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND5, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND6, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND7, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CONTRAST_BIND8, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CHKSUM, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_CONTRAST_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TIME_CONTRAST_SET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINA8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINB8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BINC8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND0, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND5, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND6, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND7, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CONTRAST_BIND8, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_ID, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_PIXX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_PIXY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_X_UNCORRECTED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_Y_UNCORRECTED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_X_CORRECTED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_Y_CORRECTED, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_MAGNITUDE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_CXA, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_CYA, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::DWL_QUALITY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_ID, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_PIXX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_PIXY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_X_UNCORRECTED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_Y_UNCORRECTED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_X_CORRECTED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_Y_CORRECTED, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_MAGNITUDE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_CXA, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_CYA, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::DWL_QUALITY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_ID, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMFPX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMFPY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMCARTX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMCARTY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMCARTZ, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CAMMAGNITUDE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBFPX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBFPY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBCARTX, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBCARTY, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBCARTZ, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_DBMAGNITUDE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::MATCHEDSTR_CATALOGID, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_ID, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMFPX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMFPY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMCARTX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMCARTY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMCARTZ, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CAMMAGNITUDE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBFPX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBFPY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBCARTX, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBCARTY, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBCARTZ, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_DBMAGNITUDE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::MATCHEDSTR_CATALOGID, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_ID, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_X, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_Y, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_TOT_VAL, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_IN_USE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_BRIGHT_NEIGHBOURS, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOBPIX_REGION, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_ID, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_X, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_Y, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_TOT_VAL, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_IN_USE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_BRIGHT_NEIGHBOURS, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::BLOBPIX_REGION, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAMERA_MODE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::FOCALLENGTH, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::EXPOSURE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::INTERVAL, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAMERA_OFFSET, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::PGAGAIN, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::ADCGAIN, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_REG1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_VAL1, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_REG2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_VAL2, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_REG3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_VAL3, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_REG4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::CAM_VAL4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAMERA_MODE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::FOCALLENGTH, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::EXPOSURE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::INTERVAL, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAMERA_OFFSET, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::PGAGAIN, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::ADCGAIN, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_REG1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_VAL1, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_REG2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_VAL2, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_REG3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_VAL3, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_REG4, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::CAM_VAL4, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_ACTION, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_FPGA18CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_FPGA25CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_FPGA10CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_MCUCURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_CMOS21CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_CMOSPIXCURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_CMOS33CURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_CMOSVRESCURRENT, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::LIMITS_CMOSTEMPERATURE, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_ACTION, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_FPGA18CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_FPGA25CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_FPGA10CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_MCUCURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_CMOS21CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_CMOSPIXCURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_CMOS33CURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_CMOSVRESCURRENT, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::LIMITS_CMOSTEMPERATURE, new PoolEntry({0})); return RETURN_OK; } size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) { - return StarTracker::MAX_FRAME_SIZE; + return startracker::MAX_FRAME_SIZE; } ReturnValue_t StarTrackerHandler::doSendReadHook() { @@ -1010,8 +1010,8 @@ ReturnValue_t StarTrackerHandler::doSendReadHook() { ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) { switch (actionId) { - case StarTracker::UPLOAD_IMAGE: - case StarTracker::DOWNLOAD_IMAGE: { + case startracker::UPLOAD_IMAGE: + case startracker::DOWNLOAD_IMAGE: { return DeviceHandlerBase::acceptExternalDeviceCommands(); default: break; @@ -1023,68 +1023,68 @@ ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) { ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId) { const uint8_t* reply = dataLinkLayer.getReply(); switch (*reply) { - case (StarTracker::ID::PING): { - *foundId = StarTracker::PING_REQUEST; + case (startracker::ID::PING): { + *foundId = startracker::PING_REQUEST; break; } - case (StarTracker::ID::WRITE): { - *foundId = StarTracker::WRITE; + case (startracker::ID::WRITE): { + *foundId = startracker::WRITE; break; } - case (StarTracker::ID::BOOT): { - *foundId = StarTracker::BOOT; + case (startracker::ID::BOOT): { + *foundId = startracker::BOOT; break; } - case (StarTracker::ID::TAKE_IMAGE): { - *foundId = StarTracker::TAKE_IMAGE; + case (startracker::ID::TAKE_IMAGE): { + *foundId = startracker::TAKE_IMAGE; break; } - case (StarTracker::ID::UPLOAD_IMAGE): { - *foundId = StarTracker::UPLOAD_IMAGE; + case (startracker::ID::UPLOAD_IMAGE): { + *foundId = startracker::UPLOAD_IMAGE; break; } - case (StarTracker::ID::ERROR_RESET): { - *foundId = StarTracker::RESET_ERROR; + case (startracker::ID::ERROR_RESET): { + *foundId = startracker::RESET_ERROR; break; } - case (StarTracker::ID::ERASE): { - *foundId = StarTracker::ERASE; + case (startracker::ID::ERASE): { + *foundId = startracker::ERASE; break; } - case (StarTracker::ID::UNLOCK): { - *foundId = StarTracker::UNLOCK; + case (startracker::ID::UNLOCK): { + *foundId = startracker::UNLOCK; break; } - case (StarTracker::ID::CHECKSUM): { - *foundId = StarTracker::CHECKSUM; + case (startracker::ID::CHECKSUM): { + *foundId = startracker::CHECKSUM; break; } - case (StarTracker::ID::SET_TIME): { - *foundId = StarTracker::SET_TIME; + case (startracker::ID::SET_TIME): { + *foundId = startracker::SET_TIME; break; } - case (StarTracker::ID::DOWNLOAD_CENTROID): { - *foundId = StarTracker::DOWNLOAD_CENTROID; + case (startracker::ID::DOWNLOAD_CENTROID): { + *foundId = startracker::DOWNLOAD_CENTROID; break; } - case (StarTracker::ID::UPLOAD_CENTROID): { - *foundId = StarTracker::UPLOAD_CENTROID; + case (startracker::ID::UPLOAD_CENTROID): { + *foundId = startracker::UPLOAD_CENTROID; break; } - case (StarTracker::ID::DOWNLOAD_MATCHED_STAR): { - *foundId = StarTracker::DOWNLOAD_MATCHED_STAR; + case (startracker::ID::DOWNLOAD_MATCHED_STAR): { + *foundId = startracker::DOWNLOAD_MATCHED_STAR; break; } - case (StarTracker::ID::DOWNLOAD_DBIMAGE): { - *foundId = StarTracker::DOWNLOAD_DBIMAGE; + case (startracker::ID::DOWNLOAD_DBIMAGE): { + *foundId = startracker::DOWNLOAD_DBIMAGE; break; } - case (StarTracker::ID::DOWNLOAD_BLOBPIXEL): { - *foundId = StarTracker::DOWNLOAD_BLOBPIXEL; + case (startracker::ID::DOWNLOAD_BLOBPIXEL): { + *foundId = startracker::DOWNLOAD_BLOBPIXEL; break; } - case (StarTracker::ID::FPGA_ACTION): { - *foundId = StarTracker::FPGA_ACTION; + case (startracker::ID::FPGA_ACTION): { + *foundId = startracker::FPGA_ACTION; break; } default: @@ -1098,48 +1098,48 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId) ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* foundId) { const uint8_t* reply = dataLinkLayer.getReply(); switch (*reply) { - case (StarTracker::ID::SUBSCRIBE): { - *foundId = StarTracker::SUBSCRIBE_TO_TM; + case (startracker::ID::SUBSCRIBE): { + *foundId = startracker::SUBSCRIBE_TO_TM; break; } - case (StarTracker::ID::LIMITS): { - *foundId = StarTracker::LIMITS; + case (startracker::ID::LIMITS): { + *foundId = startracker::LIMITS; break; } - case (StarTracker::ID::MOUNTING): { - *foundId = StarTracker::MOUNTING; + case (startracker::ID::MOUNTING): { + *foundId = startracker::MOUNTING; break; } - case (StarTracker::ID::IMAGE_PROCESSOR): { - *foundId = StarTracker::IMAGE_PROCESSOR; + case (startracker::ID::IMAGE_PROCESSOR): { + *foundId = startracker::IMAGE_PROCESSOR; break; } - case (StarTracker::ID::CAMERA): { - *foundId = StarTracker::CAMERA; + case (startracker::ID::CAMERA): { + *foundId = startracker::CAMERA; break; } - case (StarTracker::ID::CENTROIDING): { - *foundId = StarTracker::CENTROIDING; + case (startracker::ID::CENTROIDING): { + *foundId = startracker::CENTROIDING; break; } - case (StarTracker::ID::LISA): { - *foundId = StarTracker::LISA; + case (startracker::ID::LISA): { + *foundId = startracker::LISA; break; } - case (StarTracker::ID::MATCHING): { - *foundId = StarTracker::MATCHING; + case (startracker::ID::MATCHING): { + *foundId = startracker::MATCHING; break; } - case (StarTracker::ID::TRACKING): { - *foundId = StarTracker::TRACKING; + case (startracker::ID::TRACKING): { + *foundId = startracker::TRACKING; break; } - case (StarTracker::ID::VALIDATION): { - *foundId = StarTracker::VALIDATION; + case (startracker::ID::VALIDATION): { + *foundId = startracker::VALIDATION; break; } - case (StarTracker::ID::ALGO): { - *foundId = StarTracker::ALGO; + case (startracker::ID::ALGO): { + *foundId = startracker::ALGO; break; } default: @@ -1153,12 +1153,12 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* foundId) { const uint8_t* reply = dataLinkLayer.getReply(); switch (*reply) { - case (StarTracker::ID::CAMERA): { - *foundId = StarTracker::REQ_CAMERA; + case (startracker::ID::CAMERA): { + *foundId = startracker::REQ_CAMERA; break; } - case (StarTracker::ID::LIMITS): { - *foundId = StarTracker::REQ_LIMITS; + case (startracker::ID::LIMITS): { + *foundId = startracker::REQ_LIMITS; break; } default: { @@ -1173,36 +1173,36 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* fo ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) { const uint8_t* reply = dataLinkLayer.getReply(); switch (*reply) { - case (StarTracker::ID::VERSION): { - *foundId = StarTracker::REQ_VERSION; + case (startracker::ID::VERSION): { + *foundId = startracker::REQ_VERSION; break; } - case (StarTracker::ID::INTERFACE): { - *foundId = StarTracker::REQ_INTERFACE; + case (startracker::ID::INTERFACE): { + *foundId = startracker::REQ_INTERFACE; break; } - case (StarTracker::ID::POWER): { - *foundId = StarTracker::REQ_POWER; + case (startracker::ID::POWER): { + *foundId = startracker::REQ_POWER; break; } - case (StarTracker::ID::TEMPERATURE): { - *foundId = StarTracker::REQ_TEMPERATURE; + case (startracker::ID::TEMPERATURE): { + *foundId = startracker::REQ_TEMPERATURE; break; } - case (StarTracker::ID::HISTOGRAM): { - *foundId = StarTracker::REQ_HISTOGRAM; + case (startracker::ID::HISTOGRAM): { + *foundId = startracker::REQ_HISTOGRAM; break; } - case (StarTracker::ID::CONTRAST): { - *foundId = StarTracker::REQ_CONTRAST; + case (startracker::ID::CONTRAST): { + *foundId = startracker::REQ_CONTRAST; break; } - case (StarTracker::ID::TIME): { - *foundId = StarTracker::REQ_TIME; + case (startracker::ID::TIME): { + *foundId = startracker::REQ_TIME; break; } - case (StarTracker::ID::SOLUTION): { - *foundId = StarTracker::REQ_SOLUTION; + case (startracker::ID::SOLUTION): { + *foundId = startracker::REQ_SOLUTION; break; } default: { @@ -1485,72 +1485,72 @@ ReturnValue_t StarTrackerHandler::prepareUploadCentroidCommand(const uint8_t* co << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::id, &req.id); + result = j.getValue(startracker::UploadCentroidKeys::id, &req.id); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::id << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::id << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::pixx, &req.pixx); + result = j.getValue(startracker::UploadCentroidKeys::pixx, &req.pixx); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::pixx << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::pixx << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::pixy, &req.pixy); + result = j.getValue(startracker::UploadCentroidKeys::pixy, &req.pixy); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::pixy << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::pixy << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::x_uncorrected, &req.x_uncorrected); + result = j.getValue(startracker::UploadCentroidKeys::x_uncorrected, &req.x_uncorrected); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::x_uncorrected << " does not exist" + << startracker::UploadCentroidKeys::x_uncorrected << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected); + result = j.getValue(startracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::y_uncorrected << " does not exist" + << startracker::UploadCentroidKeys::y_uncorrected << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::x_corrected, &req.x_corrected); + result = j.getValue(startracker::UploadCentroidKeys::x_corrected, &req.x_corrected); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::x_corrected << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::x_corrected << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::y_corrected, &req.y_corrected); + result = j.getValue(startracker::UploadCentroidKeys::y_corrected, &req.y_corrected); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::y_corrected << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::y_corrected << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::magnitude, &req.magnitude); + result = j.getValue(startracker::UploadCentroidKeys::magnitude, &req.magnitude); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::magnitude << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::magnitude << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::cxa, &req.cxa); + result = j.getValue(startracker::UploadCentroidKeys::cxa, &req.cxa); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::cxa << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::cxa << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::cya, &req.cya); + result = j.getValue(startracker::UploadCentroidKeys::cya, &req.cya); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::cya << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::cya << " does not exist" << std::endl; return result; } - result = j.getValue(StarTracker::UploadCentroidKeys::quality, &req.quality); + result = j.getValue(startracker::UploadCentroidKeys::quality, &req.quality); if (result != RETURN_OK) { sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key " - << StarTracker::UploadCentroidKeys::quality << " does not exist" << std::endl; + << startracker::UploadCentroidKeys::quality << " does not exist" << std::endl; return result; } uint32_t length = 0; @@ -1625,7 +1625,7 @@ void StarTrackerHandler::prepareTakeImageCommand(const uint8_t* commandData) { void StarTrackerHandler::prepareSubscriptionCommand(const uint8_t* tmId) { uint32_t length = 18; commandBuffer[0] = TMTC_SETPARAMREQ; - commandBuffer[1] = StarTracker::ID::SUBSCRIBE; + commandBuffer[1] = startracker::ID::SUBSCRIBE; // Fill all other fields with invalid tm id commandBuffer[2] = *tmId; commandBuffer[3] = 0; @@ -1796,7 +1796,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() { ReturnValue_t StarTrackerHandler::handleSetParamReply() { const uint8_t* reply = dataLinkLayer.getReply(); uint8_t status = *(reply + STATUS_OFFSET); - if (status != StarTracker::STATUS_OK) { + if (status != startracker::STATUS_OK) { sif::warning << "StarTrackerHandler::handleSetParamReply: Failed to execute parameter set " " command with parameter ID" << static_cast(*(reply + PARAMETER_ID_OFFSET)) << std::endl; @@ -1814,7 +1814,7 @@ ReturnValue_t StarTrackerHandler::handleSetParamReply() { ReturnValue_t StarTrackerHandler::handleActionReply() { const uint8_t* reply = dataLinkLayer.getReply(); uint8_t status = *(reply + STATUS_OFFSET); - if (status != StarTracker::STATUS_OK) { + if (status != startracker::STATUS_OK) { sif::warning << "StarTrackerHandler::handleActionReply: Failed to execute action " << "command with action ID " << static_cast(*(reply + ACTION_ID_OFFSET)) << " and status " @@ -1844,7 +1844,7 @@ ReturnValue_t StarTrackerHandler::handleEraseReply() { return result; } const uint8_t* replyData = dataLinkLayer.getReply() + ACTION_DATA_OFFSET; - StarTracker::EraseReply eraseReply(replyData); + startracker::EraseReply eraseReply(replyData); if (eraseReply.getRegion() != eraseCmd.rememberRegion) { sif::warning << "StarTrackerHandler::handleEraseReply: Region mismatch" << std::endl; return REGION_MISMATCH; @@ -1859,7 +1859,7 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() { return result; } const uint8_t* replyData = dataLinkLayer.getReply() + ACTION_DATA_OFFSET; - StarTracker::ChecksumReply checksumReply(replyData); + startracker::ChecksumReply checksumReply(replyData); if (checksumReply.getRegion() != checksumCmd.rememberRegion) { sif::warning << "StarTrackerHandler::handleChecksumReply: Region mismatch" << std::endl; return REGION_MISMATCH; @@ -1874,7 +1874,7 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() { } PoolReadGuard rg(&checksumSet); checksumSet.checksum = checksumReply.getChecksum(); - handleDeviceTM(&checksumSet, StarTracker::CHECKSUM); + handleDeviceTM(&checksumSet, startracker::CHECKSUM); #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 checksumReply.printChecksum(); #endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */ @@ -1917,7 +1917,7 @@ ReturnValue_t StarTrackerHandler::handlePingReply() { sif::info << "StarTracker: Ping status: " << static_cast(status) << std::endl; sif::info << "Ping id: 0x" << std::hex << pingId << std::endl; #endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */ - if (status != StarTracker::STATUS_OK || pingId != PING_ID) { + if (status != startracker::STATUS_OK || pingId != PING_ID) { sif::warning << "StarTrackerHandler::handlePingReply: Ping failed" << std::endl; result = PING_FAILED; } else { @@ -1931,14 +1931,14 @@ ReturnValue_t StarTrackerHandler::handlePingReply() { ReturnValue_t StarTrackerHandler::checkProgram() { PoolReadGuard pg(&versionSet); switch (versionSet.program.value) { - case StarTracker::Program::BOOTLOADER: + case startracker::Program::BOOTLOADER: // Star tracker currently in bootloader program. Need to send boot command to switch to // firmware program if (startupState != StartupState::IDLE) { startupState = StartupState::BOOT; } break; - case StarTracker::Program::FIRMWARE: + case startracker::Program::FIRMWARE: // Firmware already booted if (startupState != StartupState::IDLE) { startupState = StartupState::LIMITS; @@ -1955,7 +1955,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() { ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t size) { ReturnValue_t result = RETURN_OK; uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET); - if (status != StarTracker::STATUS_OK) { + if (status != startracker::STATUS_OK) { sif::warning << "StarTrackerHandler::handleTm: Reply error: " << static_cast(status) << std::endl; return REPLY_ERROR; @@ -1985,7 +1985,7 @@ ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size) { ReturnValue_t result = RETURN_OK; uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET); - if (status != StarTracker::STATUS_OK) { + if (status != startracker::STATUS_OK) { sif::warning << "StarTrackerHandler::handleActionReplySet: Reply error: " << static_cast(status) << std::endl; return REPLY_ERROR; @@ -2014,43 +2014,43 @@ ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dat void StarTrackerHandler::handleStartup(const uint8_t* parameterId) { switch (*parameterId) { - case (StarTracker::ID::LIMITS): { + case (startracker::ID::LIMITS): { startupState = StartupState::TRACKING; break; } - case (StarTracker::ID::TRACKING): { + case (startracker::ID::TRACKING): { startupState = StartupState::MOUNTING; break; } - case (StarTracker::ID::MOUNTING): { + case (startracker::ID::MOUNTING): { startupState = StartupState::IMAGE_PROCESSOR; break; } - case (StarTracker::ID::IMAGE_PROCESSOR): { + case (startracker::ID::IMAGE_PROCESSOR): { startupState = StartupState::CAMERA; break; } - case (StarTracker::ID::CAMERA): { + case (startracker::ID::CAMERA): { startupState = StartupState::CENTROIDING; break; } - case (StarTracker::ID::CENTROIDING): { + case (startracker::ID::CENTROIDING): { startupState = StartupState::LISA; break; } - case (StarTracker::ID::LISA): { + case (startracker::ID::LISA): { startupState = StartupState::MATCHING; break; } - case (StarTracker::ID::MATCHING): { + case (startracker::ID::MATCHING): { startupState = StartupState::VALIDATION; break; } - case (StarTracker::ID::VALIDATION): { + case (startracker::ID::VALIDATION): { startupState = StartupState::ALGO; break; } - case (StarTracker::ID::ALGO): { + case (startracker::ID::ALGO): { startupState = StartupState::DONE; break; } diff --git a/bsp_q7s/devices/startracker/StarTrackerHandler.h b/bsp_q7s/devices/startracker/StarTrackerHandler.h index bcec92ce..b362b67f 100644 --- a/bsp_q7s/devices/startracker/StarTrackerHandler.h +++ b/bsp_q7s/devices/startracker/StarTrackerHandler.h @@ -245,26 +245,26 @@ class StarTrackerHandler : public DeviceHandlerBase { ArcsecDatalinkLayer dataLinkLayer; - StarTracker::TemperatureSet temperatureSet; - StarTracker::VersionSet versionSet; - StarTracker::PowerSet powerSet; - StarTracker::InterfaceSet interfaceSet; - StarTracker::TimeSet timeSet; - StarTracker::SolutionSet solutionSet; - StarTracker::HistogramSet histogramSet; - StarTracker::ContrastSet contrastSet; - StarTracker::ChecksumSet checksumSet; - StarTracker::DownloadCentroidSet downloadCentroidSet; - StarTracker::DownloadMatchedStar downloadMatchedStar; - StarTracker::DownloadDBImage downloadDbImage; - StarTracker::DownloadBlobPixel downloadBlobPixel; - StarTracker::CameraSet cameraSet; - StarTracker::LimitsSet limitsSet; + startracker::TemperatureSet temperatureSet; + startracker::VersionSet versionSet; + startracker::PowerSet powerSet; + startracker::InterfaceSet interfaceSet; + startracker::TimeSet timeSet; + startracker::SolutionSet solutionSet; + startracker::HistogramSet histogramSet; + startracker::ContrastSet contrastSet; + startracker::ChecksumSet checksumSet; + startracker::DownloadCentroidSet downloadCentroidSet; + startracker::DownloadMatchedStar downloadMatchedStar; + startracker::DownloadDBImage downloadDbImage; + startracker::DownloadBlobPixel downloadBlobPixel; + startracker::CameraSet cameraSet; + startracker::LimitsSet limitsSet; // Pointer to object responsible for uploading and downloading images to/from the star tracker StrHelper* strHelper = nullptr; - uint8_t commandBuffer[StarTracker::MAX_FRAME_SIZE]; + uint8_t commandBuffer[startracker::MAX_FRAME_SIZE]; // Countdown to insert delay for star tracker to switch from bootloader to firmware program Countdown bootCountdown; diff --git a/bsp_q7s/devices/startracker/StrHelper.cpp b/bsp_q7s/devices/startracker/StrHelper.cpp index a37d5a38..7a17260e 100644 --- a/bsp_q7s/devices/startracker/StrHelper.cpp +++ b/bsp_q7s/devices/startracker/StrHelper.cpp @@ -154,7 +154,7 @@ ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) { return FILE_NOT_EXISTS; } flashWrite.address = 0; - flashWrite.region = static_cast(RegionId::MAIN_FIRMWARE_SECTION); + flashWrite.section = static_cast(RegionId::MAIN_FIRMWARE_SECTION); internalState = InternalState::FIRMWARE_UPDATE; semaphore.release(); terminate = false; @@ -317,12 +317,10 @@ ReturnValue_t StrHelper::performImageUpload() { } ReturnValue_t StrHelper::performFirmwareUpdate() { + using namespace startracker; ReturnValue_t result = RETURN_OK; - result = unlock(flashWrite.region); - if (result != RETURN_OK) { - return result; - } - eraseF(flashWrite.region); + result = unlockAndEraseRegions(static_cast(FirmwareRegions::START), + static_cast(FirmwareRegions::END)); if (result != RETURN_OK) { return result; } @@ -345,7 +343,7 @@ ReturnValue_t StrHelper::performFlashWrite() { file.seekg(0, file.end); fileSize = file.tellg(); remainingBytes = fileSize; - req.region = flashWrite.region; + req.region = flashWrite.section; req.address = flashWrite.address; req.length = MAX_FLASH_DATA; while (remainingBytes >= MAX_FLASH_DATA) { @@ -357,7 +355,7 @@ ReturnValue_t StrHelper::performFlashWrite() { arc_pack_write_action_req(&req, commandBuffer, &size); result = sendAndRead(size, req.address); if (result != RETURN_OK) { - return RETURN_FAILED; + return result; } result = checkFlashActionReply(req.region, req.address, req.length); if (result != RETURN_OK) { @@ -371,7 +369,7 @@ ReturnValue_t StrHelper::performFlashWrite() { arc_pack_write_action_req(&req, commandBuffer, &size); result = sendAndRead(size, req.address); if (result != RETURN_OK) { - return RETURN_FAILED; + return result; } result = checkFlashActionReply(req.region, req.address, req.length); if (result != RETURN_OK) { @@ -551,7 +549,7 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter) { } decResult = ArcsecDatalinkLayer::DEC_IN_PROGRESS; while (decResult == ArcsecDatalinkLayer::DEC_IN_PROGRESS) { - result = uartComIF->requestReceiveMessage(comCookie, StarTracker::MAX_FRAME_SIZE * 2 + 2); + result = uartComIF->requestReceiveMessage(comCookie, startracker::MAX_FRAME_SIZE * 2 + 2); if (result != RETURN_OK) { sif::warning << "StrHelper::sendAndRead: Failed to request reply" << std::endl; triggerEvent(STR_HELPER_REQUESTING_MSG_FAILED, result, parameter); @@ -706,3 +704,31 @@ void StrHelper::printProgress(uint32_t itemsTransferred, uint32_t fullNumItems) nextProgressPrint = 0; } } + +ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) { + using namespace startracker::region_secrets; + struct UnlockActionRequest unlockReq; + struct EraseActionRequest eraseReq; + uint32_t size = 0; + for (uint8_t idx = from; idx <= to; idx++) { + unlockReq.region = idx; + unlockReq.code = secret[idx]; + arc_pack_unlock_action_req(&req, commandBuffer, &size); + sendAndRead(size, req.region); + result = checkActionReply(); + if (result != RETURN_OK) { + sif::warning << "StrHelper::unlockAndEraseRegions: Failed to unlock region with id " + << static_cast(unlockReq.region) << std::endl; + return result; + } + eraseReq.region = idx; + arc_pack_erase_action_req(&eraseReq, commandBuffer, &size); + result = sendAndRead(size, eraseReq.region); + if (result != RETURN_OK) { + sif::warning << "StrHelper::unlockAndEraseRegions: Failed to erase region with id " + << static_cast(eraseReq.region) << std::endl; + return result; + } + } + return result; +} diff --git a/bsp_q7s/devices/startracker/StrHelper.h b/bsp_q7s/devices/startracker/StrHelper.h index 0e19bca7..e0e402b0 100644 --- a/bsp_q7s/devices/startracker/StrHelper.h +++ b/bsp_q7s/devices/startracker/StrHelper.h @@ -21,6 +21,9 @@ extern "C" { * @brief Helper class for the star tracker handler to accelerate large data transfers. */ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF { + + using namespace startracker; + public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HELPER; @@ -267,8 +270,8 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu public: // File which contains data to write when executing the flash write command std::string fullname; - // Will be set with the flash write command - uint8_t region = 0; + // Section where to write to + uint8_t section = 0; // Will be set with the flash write command and specifies the start address where to write the // flash data to uint32_t address = 0; @@ -291,15 +294,9 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu }; FlashRead flashRead; - enum class RegionId : uint8_t { - BOOTLOADER_SECTION = 0, - MAIN_FIRMWARE_SECTION = 1, - ARC_CONFIG_SECTION = 2, - }; - SdCardManager* sdcMan = nullptr; - uint8_t commandBuffer[StarTracker::MAX_FRAME_SIZE]; + uint8_t commandBuffer[startracker::MAX_FRAME_SIZE]; bool terminate = false; @@ -413,6 +410,15 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu * @param fullNumItems Full number of items to transfer */ void printProgress(uint32_t itemsTransferred, uint32_t fullNumItems); + + /** + * @brief Unlocks a range of flash regions + * + * @param from First region in range to unlock + * @param to Last region in range to unlock + * + */ + ReturnValue_t unlockRegions(uint32_t from, uint32_t to); }; #endif /* BSP_Q7S_DEVICES_STRHELPER_H_ */ diff --git a/fsfw b/fsfw index faf7da27..f08d291e 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit faf7da2743dcd30d83c3ab2f7b4d85277878e636 +Subproject commit f08d291e3e22950e729c327c101d22a943910e9b