diff --git a/bsp_q7s/devices/startracker/ArcsecJsonKeys.h b/bsp_q7s/devices/startracker/ArcsecJsonKeys.h index a32e380e..044bef8d 100644 --- a/bsp_q7s/devices/startracker/ArcsecJsonKeys.h +++ b/bsp_q7s/devices/startracker/ArcsecJsonKeys.h @@ -28,6 +28,13 @@ static const char qx[] = "qx"; static const char qy[] = "qy"; static const char qz[] = "qz"; +static const char IMAGE_PROCESSOR[] = "imageprocessor"; +static const char IMAGE_PROCESSOR_MODE[] = "mode"; +static const char STORE[] = "store"; +static const char SIGNAL_THRESHOLD[] = "signalThreshold"; +static const char IMAGE_PROCESSOR_DARK_THRESHOLD[] = "darkThreshold"; +static const char BACKGROUND_COMPENSATION[] = "backgroundcompensation"; + static const char CAMERA[] = "camera"; static const char MODE[] = "mode"; static const char FOCALLENGTH[] = "focallength"; @@ -64,7 +71,7 @@ static const char MAX_TOTAL_VALUE[] = "maxTotalValue"; static const char MIN_BRIGHT_NEIGHBOURS[] = "minBrightNeighbours"; static const char MAX_BRIGHT_NEIGHBOURS[] = "maxBrightNeighbours"; static const char MAX_PIXEL_TO_CONSIDER[] = "maxPixelsToConsider"; -static const char SIGNAL_THRESHOLD[] = "signalThreshold"; +//static const char SIGNAL_THRESHOLD[] = "signalThreshold"; static const char BLOB_DARK_THRESHOLD[] = "darkThreshold"; static const char ENABLE_HISTOGRAM[] = "enableHistogram"; static const char ENABLE_CONTRAST[] = "enableContrast"; diff --git a/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp index 3824f752..36aa8ea3 100644 --- a/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp +++ b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp @@ -97,5 +97,7 @@ ReturnValue_t ArcsecJsonParamBase::initSet() { return RETURN_OK; } } + sif::warning << "ArcsecJsonParamBase::initSet: Set " << setName << "not present in json file" + << std::endl; return SET_NOT_EXISTS; } diff --git a/bsp_q7s/devices/startracker/StarTrackerDefinitions.h b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h index 1e0564d9..dda013b2 100644 --- a/bsp_q7s/devices/startracker/StarTrackerDefinitions.h +++ b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h @@ -60,6 +60,7 @@ enum PoolIds : lp_id_t { TIME_TEMPERATURE_SET, MCU_TEMPERATURE, CMOS_TEMPERATURE, + FPGA_TEMPERATURE, TICKS_SOLUTION_SET, TIME_SOLUTION_SET, CALI_QW, @@ -257,6 +258,7 @@ static const DeviceCommandId_t TAKE_IMAGE = 15; static const DeviceCommandId_t DOWNLOAD_CENTROID = 16; static const DeviceCommandId_t UPLOAD_CENTROID = 17; static const DeviceCommandId_t SUBSCRIBE_TO_TM = 18; +static const DeviceCommandId_t IMAGE_PROCESSOR = 19; static const DeviceCommandId_t REQ_SOLUTION = 24; static const DeviceCommandId_t REQ_TEMPERATURE = 25; static const DeviceCommandId_t REQ_HISTOGRAM = 28; @@ -264,7 +266,6 @@ static const DeviceCommandId_t REQ_CONTRAST = 29; static const DeviceCommandId_t LIMITS = 40; static const DeviceCommandId_t MOUNTING = 41; static const DeviceCommandId_t CAMERA = 42; -static const DeviceCommandId_t BLOB = 43; static const DeviceCommandId_t CENTROIDING = 44; static const DeviceCommandId_t LISA = 45; static const DeviceCommandId_t MATCHING = 46; @@ -289,7 +290,6 @@ static const DeviceCommandId_t UPLOAD_FPGA_IMAGE = 65; static const DeviceCommandId_t FPGA_ACTION = 66; static const DeviceCommandId_t REQ_CAMERA = 67; static const DeviceCommandId_t REQ_LIMITS = 68; -static const DeviceCommandId_t REQ_BLOB_PARAMS = 69; static const DeviceCommandId_t NONE = 0xFFFFFFFF; static const uint32_t VERSION_SET_ID = REQ_VERSION; @@ -307,12 +307,11 @@ static const uint32_t DOWNLOAD_DBIMAGE_SET_ID = DOWNLOAD_DBIMAGE; static const uint32_t DOWNLOAD_BLOBPIXEL_SET_ID = DOWNLOAD_BLOBPIXEL; static const uint32_t CAMERA_SET_ID = REQ_CAMERA; static const uint32_t LIMITS_SET_ID = REQ_LIMITS; -static const uint32_t BLOB_SET_ID = REQ_BLOB_PARAMS; /** Max size of unencoded frame */ static const size_t MAX_FRAME_SIZE = 1200; -static const uint8_t TEMPERATURE_SET_ENTRIES = 4; +static const uint8_t TEMPERATURE_SET_ENTRIES = 5; static const uint8_t VERSION_SET_ENTRIES = 5; static const uint8_t INTERFACE_SET_ENTRIES = 4; static const uint8_t POWER_SET_ENTRIES = 18; @@ -327,7 +326,6 @@ static const uint8_t DOWNLOAD_DBIMAGE_SET_ENTRIES = 6; static const uint8_t DOWNLOAD_BLOBPIXEL_SET_ENTRIES = 7; static const uint8_t CAMERA_SET_ENTRIES = 15; static const uint8_t LIMITS_SET_ENTRIES = 11; -static const uint8_t BLOB_SET_ENTRIES = 15; // Action, parameter and telemetry IDs namespace ID { @@ -337,8 +335,8 @@ static const uint8_t VERSION = 2; static const uint8_t INTERFACE = 3; static const uint8_t LIMITS = 5; static const uint8_t MOUNTING = 6; +static const uint8_t IMAGE_PROCESSOR = 10; static const uint8_t CAMERA = 9; -static const uint8_t BLOB = 10; static const uint8_t CENTROIDING = 11; static const uint8_t LISA = 12; static const uint8_t MATCHING = 13; @@ -351,7 +349,7 @@ static const uint8_t POWER = 11; static const uint8_t SET_TIME = 14; static const uint8_t SUBSCRIBE = 18; static const uint8_t SOLUTION = 24; -static const uint8_t TEMPERATURE = 25; +static const uint8_t TEMPERATURE = 27; static const uint8_t HISTOGRAM = 28; static const uint8_t CONTRAST = 29; static const uint8_t TIME = 1; @@ -380,7 +378,7 @@ static const uint8_t FIRMWARE = 2; */ class TemperatureSet : public StaticLocalDataSet { public: - static const size_t SIZE = 20; + static const size_t SIZE = 24; TemperatureSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {} @@ -392,14 +390,17 @@ class TemperatureSet : public StaticLocalDataSet { lp_var_t time = lp_var_t(sid.objectId, PoolIds::TIME_TEMPERATURE_SET, this); lp_var_t mcuTemperature = lp_var_t(sid.objectId, PoolIds::MCU_TEMPERATURE, this); lp_var_t cmosTemperature = lp_var_t(sid.objectId, PoolIds::CMOS_TEMPERATURE, this); + lp_var_t fpgaTemperature = lp_var_t(sid.objectId, PoolIds::FPGA_TEMPERATURE, this); void printSet() { sif::info << "TemperatureSet::printSet: Ticks: " << this->ticks << std::endl; sif::info << "TemperatureSet::printSet: Time: " << this->time << " us" << std::endl; sif::info << "TemperatureSet::printSet: MCU Temperature: " << this->mcuTemperature << " °C" << std::endl; - sif::info << "TemperatureSet::printSet: CMOS Temperature: " << this->cmosTemperature << " °C" + sif::info << "TemperatureSet::printSet: CMOS Temperature (raw): " << this->cmosTemperature << std::endl; + sif::info << "TemperatureSet::printSet: FPGA Temperature (random value): " + << this->fpgaTemperature << " °C" << std::endl; } }; @@ -1201,73 +1202,5 @@ class LimitsSet : public StaticLocalDataSet { sif::info << "CameraSet::printSet: CMOSTemperature: " << this->cmosTemperature << std::endl; } }; - -/** - * @brief Will store the request of the blob parameters. - */ -class BlobSet : public StaticLocalDataSet { - public: - // Size of dataset - static const size_t SIZE = 22; - - BlobSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BLOB_SET_ID) {} - - BlobSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, BLOB_SET_ID)) {} - - lp_var_t mode = lp_var_t(sid.objectId, PoolIds::BLOB_MODE, this); - lp_var_t minValue = lp_var_t(sid.objectId, PoolIds::BLOB_MIN_VALUE, this); - lp_var_t minDistance = lp_var_t(sid.objectId, PoolIds::BLOB_MIN_DISTANCE, this); - lp_var_t neighbourDistance = - lp_var_t(sid.objectId, PoolIds::BLOB_NEIGHBOUR_DISTANCE, this); - lp_var_t neighbourBrightPixels = - lp_var_t(sid.objectId, PoolIds::BLOB_NEIGHBOUR_BRIGHTPIXELS, this); - lp_var_t minTotalValue = - lp_var_t(sid.objectId, PoolIds::BLOB_MIN_TOTAL_VALUE, this); - lp_var_t maxTotalValue = - lp_var_t(sid.objectId, PoolIds::BLOB_MAX_TOTAL_VALUE, this); - lp_var_t minBrightNeighbours = - lp_var_t(sid.objectId, PoolIds::BLOB_MIN_BRIGHT_NEIGHBOURS, this); - lp_var_t maxBrightNeighbours = - lp_var_t(sid.objectId, PoolIds::BLOB_MAX_BRIGHT_NEIGHBOURS, this); - lp_var_t maxPixelsToConsider = - lp_var_t(sid.objectId, PoolIds::BLOB_MAX_PIXELSTOCONSIDER, this); - lp_var_t signalThreshold = - lp_var_t(sid.objectId, PoolIds::BLOB_SIGNAL_THRESHOLD, this); - lp_var_t darkThreshold = - lp_var_t(sid.objectId, PoolIds::BLOB_DARK_THRESHOLD, this); - lp_var_t enableContrast = - lp_var_t(sid.objectId, PoolIds::BLOB_ENABLE_CONTRAST, this); - lp_var_t enableBinMode = lp_var_t(sid.objectId, PoolIds::BLOB_BIN_MODE, this); - - void printSet() { - PoolReadGuard rg(this); - sif::info << "BlobSet::printSet: mode: " << static_cast(this->mode.value) - << std::endl; - sif::info << "BlobSet::printSet: minValue: " << static_cast(this->minValue.value) - << std::endl; - sif::info << "BlobSet::printSet: minDistance: " - << static_cast(this->minDistance.value) << std::endl; - sif::info << "BlobSet::printSet: neighboutDistance: " - << static_cast(this->neighbourDistance.value) << std::endl; - sif::info << "BlobSet::printSet: neighboutBrightPixels: " - << static_cast(this->neighbourBrightPixels.value) << std::endl; - sif::info << "BlobSet::printSet: minTotalValue: " << this->minTotalValue << std::endl; - sif::info << "BlobSet::printSet: maxTotalValue: " << this->maxTotalValue << std::endl; - sif::info << "BlobSet::printSet: minBrightNeighbours: " << this->minBrightNeighbours - << std::endl; - sif::info << "BlobSet::printSet: maxBrightNeighbours: " << this->maxBrightNeighbours - << std::endl; - sif::info << "BlobSet::printSet: maxPixelsToConsider: " << this->maxPixelsToConsider - << std::endl; - sif::info << "BlobSet::printSet: signalThreshold: " - << static_cast(this->signalThreshold.value) << std::endl; - sif::info << "BlobSet::printSet: darkThreshold: " - << static_cast(this->darkThreshold.value) << std::endl; - sif::info << "BlobSet::printSet: enableContrast: " - << static_cast(this->enableContrast.value) << std::endl; - sif::info << "BlobSet::printSet: enableBinMode: " - << static_cast(this->enableBinMode.value) << std::endl; - } -}; } // namespace StarTracker #endif /* MISSION_STARTRACKER_DEFINITIONS_H_ */ diff --git a/bsp_q7s/devices/startracker/StarTrackerHandler.cpp b/bsp_q7s/devices/startracker/StarTrackerHandler.cpp index a7f5bb01..0ca02118 100644 --- a/bsp_q7s/devices/startracker/StarTrackerHandler.cpp +++ b/bsp_q7s/devices/startracker/StarTrackerHandler.cpp @@ -12,7 +12,6 @@ extern "C" { #include #include #include - #include "common/misc.h" } @@ -109,7 +108,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu } if (strHelperExecuting == true) { - return IMAGE_LOADER_EXECUTING; + return STR_HELPER_EXECUTING; } result = checkMode(actionId); @@ -316,16 +315,16 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t *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; + return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), + paramJsonFile.size()); case StartupState::CAMERA: startupState = StartupState::WAIT_FOR_EXECUTION; *id = StarTracker::CAMERA; return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), paramJsonFile.size()); -// case StartupState::BLOB: -// startupState = StartupState::WAIT_FOR_EXECUTION; -// *id = StarTracker::BLOB; -// return buildCommandFromCommand(*id, reinterpret_cast(paramJsonFile.c_str()), -// paramJsonFile.size()); case StartupState::CENTROIDING: startupState = StartupState::WAIT_FOR_EXECUTION; *id = StarTracker::CENTROIDING; @@ -428,16 +427,16 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi result = prepareParamCommand(commandData, commandDataLen, mounting); return result; } + case (StarTracker::IMAGE_PROCESSOR): { + ImageProcessor imageProcessor; + result = prepareParamCommand(commandData, commandDataLen, imageProcessor); + return result; + } case (StarTracker::CAMERA): { Camera camera; result = prepareParamCommand(commandData, commandDataLen, camera); return result; } - case (StarTracker::BLOB): { - Blob blob; - result = prepareParamCommand(commandData, commandDataLen, blob); - return result; - } case (StarTracker::CENTROIDING): { Centroiding centroiding; result = prepareParamCommand(commandData, commandDataLen, centroiding); @@ -558,9 +557,9 @@ void StarTrackerHandler::fillCommandAndReplyMap() { StarTracker::MAX_FRAME_SIZE * 2 + 2); this->insertInCommandAndReplyMap(StarTracker::MOUNTING, 3, nullptr, StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::CAMERA, 3, nullptr, + this->insertInCommandAndReplyMap(StarTracker::IMAGE_PROCESSOR, 3, nullptr, StarTracker::MAX_FRAME_SIZE * 2 + 2); - this->insertInCommandAndReplyMap(StarTracker::BLOB, 3, nullptr, + this->insertInCommandAndReplyMap(StarTracker::CAMERA, 3, nullptr, StarTracker::MAX_FRAME_SIZE * 2 + 2); this->insertInCommandAndReplyMap(StarTracker::CENTROIDING, 3, nullptr, StarTracker::MAX_FRAME_SIZE * 2 + 2); @@ -751,12 +750,12 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, case (StarTracker::LIMITS): case (StarTracker::MOUNTING): case (StarTracker::CAMERA): - case (StarTracker::BLOB): 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; @@ -769,10 +768,6 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, handleParamRequest(limitsSet, StarTracker::LimitsSet::SIZE); break; } - case (StarTracker::REQ_BLOB_PARAMS): { - handleParamRequest(blobSet, StarTracker::BlobSet::SIZE); - break; - } default: { sif::debug << "StarTrackerHandler::interpretDeviceReply: Unknown device reply id:" << id << std::endl; @@ -836,6 +831,7 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l 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})); @@ -1002,23 +998,6 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l 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::BLOB_MODE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MIN_VALUE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MIN_DISTANCE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_DISTANCE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MIN_TOTAL_VALUE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MAX_TOTAL_VALUE, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MIN_BRIGHT_NEIGHBOURS, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MAX_BRIGHT_NEIGHBOURS, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_MAX_PIXELSTOCONSIDER, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_SIGNAL_THRESHOLD, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_DARK_THRESHOLD, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_HISTOGRAM, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_CONTRAST, new PoolEntry({0})); - localDataPoolMap.emplace(StarTracker::BLOB_BIN_MODE, new PoolEntry({0})); return RETURN_OK; } @@ -1136,12 +1115,12 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo *foundId = StarTracker::MOUNTING; break; } - case (StarTracker::ID::CAMERA): { - *foundId = StarTracker::CAMERA; + case (StarTracker::ID::IMAGE_PROCESSOR): { + *foundId = StarTracker::IMAGE_PROCESSOR; break; } - case (StarTracker::ID::BLOB): { - *foundId = StarTracker::BLOB; + case (StarTracker::ID::CAMERA): { + *foundId = StarTracker::CAMERA; break; } case (StarTracker::ID::CENTROIDING): { @@ -1187,10 +1166,6 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* fo *foundId = StarTracker::REQ_LIMITS; break; } - case (StarTracker::ID::BLOB): { - *foundId = StarTracker::REQ_BLOB_PARAMS; - break; - } default: { sif::warning << "tarTrackerHandler::scanForGetParameterReply: UnkNown ID" << std::endl; return RETURN_FAILED; @@ -1236,8 +1211,8 @@ ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) { break; } default: { - sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id" - << std::endl; + sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id: " + << static_cast(*reply) << std::endl; return RETURN_FAILED; break; } @@ -1730,9 +1705,6 @@ ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData result = paramSet.create(fullName, commandBuffer); if (result != RETURN_OK) { - sif::warning << "StarTrackerHandler::prepareParamCommand: Failed to create parameter " - "command" - << std::endl; return result; } dataLinkLayer.encodeFrame(commandBuffer, paramSet.getSize()); @@ -1826,15 +1798,6 @@ ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() { return RETURN_OK; } -ReturnValue_t StarTrackerHandler::prepareRequestBlobParams() { - uint32_t length = 0; - arc_pack_blob_parameter_req(commandBuffer, &length); - dataLinkLayer.encodeFrame(commandBuffer, length); - rawPacket = dataLinkLayer.getEncodedFrame(); - rawPacketLen = dataLinkLayer.getEncodedLength(); - return RETURN_OK; -} - ReturnValue_t StarTrackerHandler::handleSetParamReply() { const uint8_t* reply = dataLinkLayer.getReply(); uint8_t status = *(reply + STATUS_OFFSET); @@ -2065,15 +2028,14 @@ void StarTrackerHandler::handleStartup(const uint8_t* parameterId) { break; } case (StarTracker::ID::MOUNTING): { + startupState = StartupState::IMAGE_PROCESSOR; + break; + } + case (StarTracker::ID::IMAGE_PROCESSOR): { startupState = StartupState::CAMERA; break; } case (StarTracker::ID::CAMERA): { -// startupState = StartupState::BLOB; - startupState = StartupState::CENTROIDING; - break; - } - case (StarTracker::ID::BLOB): { startupState = StartupState::CENTROIDING; break; } diff --git a/bsp_q7s/devices/startracker/StarTrackerHandler.h b/bsp_q7s/devices/startracker/StarTrackerHandler.h index 70be3099..235663a4 100644 --- a/bsp_q7s/devices/startracker/StarTrackerHandler.h +++ b/bsp_q7s/devices/startracker/StarTrackerHandler.h @@ -72,15 +72,6 @@ class StarTrackerHandler : public DeviceHandlerBase { private: static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER; - //! [EXPORT] : [COMMENT] Received reply is too short - static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xB0); - //! [EXPORT] : [COMMENT] Received reply with invalid CRC - static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xB1); - //! [EXPORT] : [COMMENT] Image loader executing - static const ReturnValue_t IMAGE_LOADER_EXECUTING = MAKE_RETURN_CODE(0xB2); - - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HANDLER; - //! [EXPORT] : [COMMENT] Status in temperature reply signals error static const ReturnValue_t TEMPERATURE_REQ_FAILED = MAKE_RETURN_CODE(0xA0); //! [EXPORT] : [COMMENT] Ping command failed @@ -132,6 +123,13 @@ class StarTrackerHandler : public DeviceHandlerBase { static const ReturnValue_t INVALID_TYPE = MAKE_RETURN_CODE(0xB6); //! [EXPORT] : [COMMENT] Received FPGA action command with invalid ID static const ReturnValue_t INVALID_ID = MAKE_RETURN_CODE(0xB7); + //! [EXPORT] : [COMMENT] Received reply is too short + static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xB8); + //! [EXPORT] : [COMMENT] Received reply with invalid CRC + static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xB9); + //! [EXPORT] : [COMMENT] Star tracker handler currently executing a command and using the + //! communication interface + static const ReturnValue_t STR_HELPER_EXECUTING = MAKE_RETURN_CODE(0xBA); static const size_t MAX_PATH_SIZE = 50; static const size_t MAX_FILE_NAME = 30; @@ -262,7 +260,6 @@ class StarTrackerHandler : public DeviceHandlerBase { StarTracker::DownloadBlobPixel downloadBlobPixel; StarTracker::CameraSet cameraSet; StarTracker::LimitsSet limitsSet; - StarTracker::BlobSet blobSet; // Pointer to object responsible for uploading and downloading images to/from the star tracker StrHelper* strHelper = nullptr; @@ -286,6 +283,7 @@ class StarTrackerHandler : public DeviceHandlerBase { LIMITS, TRACKING, MOUNTING, + IMAGE_PROCESSOR, CAMERA, BLOB, CENTROIDING, @@ -502,11 +500,6 @@ class StarTrackerHandler : public DeviceHandlerBase { */ ReturnValue_t prepareRequestLimitsParams(); - /** - * @brief Will fill the command buffer with the command to request the set blob parameters. - */ - ReturnValue_t prepareRequestBlobParams(); - /** * @brief Handles action replies with datasets. */ diff --git a/bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp b/bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp index 9563f3e6..4b675e93 100644 --- a/bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp +++ b/bsp_q7s/devices/startracker/StarTrackerJsonCommands.cpp @@ -152,6 +152,48 @@ ReturnValue_t Mounting::createCommand(uint8_t* buffer) { return RETURN_OK; } +ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESSOR) {} + +size_t ImageProcessor::getSize() { return COMMAND_SIZE; } + +ReturnValue_t ImageProcessor::createCommand(uint8_t* buffer) { + ReturnValue_t result = RETURN_OK; + uint8_t offset = 0; + std::string param; + addSetParamHeader(buffer, StarTracker::ID::IMAGE_PROCESSOR); + offset = 2; + result = getParam(arcseckeys::IMAGE_PROCESSOR_MODE, param); + if (result != RETURN_OK) { + return result; + } + adduint8(param, buffer + offset); + offset += sizeof(uint8_t); + result = getParam(arcseckeys::STORE, param); + if (result != RETURN_OK) { + return result; + } + adduint8(param, buffer + offset); + offset += sizeof(uint8_t); + result = getParam(arcseckeys::SIGNAL_THRESHOLD, param); + if (result != RETURN_OK) { + return result; + } + adduint16(param, buffer + offset); + offset += sizeof(uint16_t); + result = getParam(arcseckeys::IMAGE_PROCESSOR_DARK_THRESHOLD, param); + if (result != RETURN_OK) { + return result; + } + adduint16(param, buffer + offset); + offset += sizeof(uint16_t); + result = getParam(arcseckeys::BACKGROUND_COMPENSATION, param); + if (result != RETURN_OK) { + return result; + } + adduint8(param, buffer + offset); + return RETURN_OK; +} + Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {} size_t Camera::getSize() { return COMMAND_SIZE; } diff --git a/bsp_q7s/devices/startracker/StarTrackerJsonCommands.h b/bsp_q7s/devices/startracker/StarTrackerJsonCommands.h index b94fa231..eef4c57e 100644 --- a/bsp_q7s/devices/startracker/StarTrackerJsonCommands.h +++ b/bsp_q7s/devices/startracker/StarTrackerJsonCommands.h @@ -60,6 +60,22 @@ class Mounting : public ArcsecJsonParamBase { ReturnValue_t createCommand(uint8_t* buffer) override; }; +/** + * @brief Generates the command to configure the image processor + * + */ +class ImageProcessor : public ArcsecJsonParamBase { + public: + ImageProcessor(); + + size_t getSize(); + + private: + static const size_t COMMAND_SIZE = 9; + + ReturnValue_t createCommand(uint8_t* buffer) override; +}; + /** * @brief Generates the command to set the mounting quaternion * diff --git a/fsfw b/fsfw index cc7a3a5a..faf7da27 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cc7a3a5a342aa274ba85805ebdfef65224bbe80c +Subproject commit faf7da2743dcd30d83c3ab2f7b4d85277878e636 diff --git a/linux/obc/PtmeRateSetter.cpp b/linux/obc/PtmeRateSetter.cpp index cace128b..8275e8fe 100644 --- a/linux/obc/PtmeRateSetter.cpp +++ b/linux/obc/PtmeRateSetter.cpp @@ -16,7 +16,7 @@ ReturnValue_t PtmeRateSetter::initialize() { } ReturnValue_t PtmeRateSetter::setRate(uint32_t bitRate) { - if (bitRate == 0) { + if (bitRate <= 1) { return BAD_BIT_RATE; } uint32_t rateVal = PtmeConfig::BIT_CLK_FREQ / bitRate - 1; diff --git a/tmtc b/tmtc index b06211d0..598635ee 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b06211d0865f5d904572635340303d8b4aec30eb +Subproject commit 598635ee4fb1eb246980564ae9f3a0feb1f4da30