From 33d60ccf7f92919b043b11f4897a607fb98c6055 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 18:31:56 +0200 Subject: [PATCH] v10.7 --- CHANGELOG.md | 5 +++- bsp_q7s/core/CoreController.cpp | 4 +-- linux/acs/StrComHandler.cpp | 38 ++++++++++++++++---------- linux/acs/StrComHandler.h | 6 +--- mission/acs/str/StarTrackerHandler.cpp | 1 + mission/acs/str/arcsecJsonKeys.h | 28 +++++++++---------- mission/acs/str/strHelpers.h | 4 ++- thirdparty/sagittactl | 2 +- tmtc | 2 +- 9 files changed, 50 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df62f43..3bdee815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ will consitute of a breaking change warranting a new major release: # [unreleased] - q7s-package: v2.5.0 -- STR firmware was updated to v10.3 +- STR firmware was updated to v10.7 ## Fixed @@ -27,6 +27,9 @@ will consitute of a breaking change warranting a new major release: - Bugfix for STR where an invalid reply was received for special requests like firmware updates. - Bugfix for shell command executors in command controller which lead to a crash. +- Important bugfix for STR solution set. +- Fix for STR image download. +- Possible fix for STR image upload. ## Changed diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index e1033943..49145f9f 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -369,7 +369,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return actionReboot(data, size); } case (EXECUTE_SHELL_CMD_BLOCKING): { - std::string cmdToExecute = std::string(reinterpret_cast(data), size); + std::string cmdToExecute = std::string(reinterpret_cast(data), size); int result = std::system(cmdToExecute.c_str()); if (result != 0) { // TODO: Data reply with returnalue maybe? @@ -378,7 +378,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_ return EXECUTION_FINISHED; } case (EXECUTE_SHELL_CMD_NON_BLOCKING): { - std::string cmdToExecute = std::string(reinterpret_cast(data), size); + std::string cmdToExecute = std::string(reinterpret_cast(data), size); if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or shellCmdIsExecuting) { return HasActionsIF::IS_BUSY; diff --git a/linux/acs/StrComHandler.cpp b/linux/acs/StrComHandler.cpp index 51c66f18..5ae00c94 100644 --- a/linux/acs/StrComHandler.cpp +++ b/linux/acs/StrComHandler.cpp @@ -17,6 +17,10 @@ #include "mission/utility/ProgressPrinter.h" #include "mission/utility/Timestamp.h" +extern "C" { +#include +} + using namespace returnvalue; StrComHandler::StrComHandler(object_id_t objectId) : SystemObject(objectId) { @@ -305,6 +309,7 @@ ReturnValue_t StrComHandler::performImageUpload() { uint32_t imageSize = 0; struct UploadActionRequest uploadReq; uploadReq.position = 0; + size_t writtenBytes = 0; #ifdef XIPHOS_Q7S if (not sdcMan->getActiveSdCard()) { return HasFileSystemIF::FILESYSTEM_INACTIVE; @@ -327,7 +332,9 @@ ReturnValue_t StrComHandler::performImageUpload() { #if OBSW_DEBUG_STARTRACKER == 1 ProgressPrinter progressPrinter("Image upload", imageSize); #endif /* OBSW_DEBUG_STARTRACKER == 1 */ - while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) { + size_t fullChunks = imageSize / SIZE_IMAGE_PART; + size_t remainder = imageSize % SIZE_IMAGE_PART; + for (size_t idx = 0; idx < fullChunks; idx++) { if (terminate) { return returnvalue::OK; } @@ -346,6 +353,7 @@ ReturnValue_t StrComHandler::performImageUpload() { progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART); #endif /* OBSW_DEBUG_STARTRACKER == 1 */ uploadReq.position++; + writtenBytes += SIZE_IMAGE_PART; // This does a bit of delaying roughly every second if (uploadReq.position % 50 == 0) { @@ -353,20 +361,20 @@ ReturnValue_t StrComHandler::performImageUpload() { TaskFactory::delayTask(2); } } - std::memset(uploadReq.data, 0, sizeof(uploadReq.data)); - uint32_t remainder = imageSize - uploadReq.position * SIZE_IMAGE_PART; - file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg); - file.read(reinterpret_cast(uploadReq.data), remainder); - file.close(); - uploadReq.position++; - arc_pack_upload_action_req(&uploadReq, cmdBuf.data(), &size); - result = sendAndRead(size, uploadReq.position); - if (result != returnvalue::OK) { - return returnvalue::FAILED; - } - result = checkActionReply(replyLen); - if (result != returnvalue::OK) { - return result; + if (remainder > 0) { + std::memset(uploadReq.data, 0, sizeof(uploadReq.data)); + file.seekg(fullChunks * SIZE_IMAGE_PART, file.beg); + file.read(reinterpret_cast(uploadReq.data), remainder); + file.close(); + arc_pack_upload_action_req(&uploadReq, cmdBuf.data(), &size); + result = sendAndRead(size, uploadReq.position); + if (result != returnvalue::OK) { + return returnvalue::FAILED; + } + result = checkActionReply(replyLen); + if (result != returnvalue::OK) { + return result; + } } #if OBSW_DEBUG_STARTRACKER == 1 progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART); diff --git a/linux/acs/StrComHandler.h b/linux/acs/StrComHandler.h index d8542f26..252b2466 100644 --- a/linux/acs/StrComHandler.h +++ b/linux/acs/StrComHandler.h @@ -18,10 +18,6 @@ #include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw_hal/linux/serial/SerialComIF.h" -extern "C" { -#include -} - /** * @brief Helper class for the star tracker handler to accelerate large data transfers. * @@ -176,7 +172,7 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public static const uint32_t FLASH_REGION_SIZE = 0x20000; struct ImageDownload { - static const uint32_t LAST_POSITION = 4095; + static const uint32_t LAST_POSITION = 4096; }; static const uint32_t MAX_POLLS = 10000; diff --git a/mission/acs/str/StarTrackerHandler.cpp b/mission/acs/str/StarTrackerHandler.cpp index 54af25da..cb0ca2c8 100644 --- a/mission/acs/str/StarTrackerHandler.cpp +++ b/mission/acs/str/StarTrackerHandler.cpp @@ -1084,6 +1084,7 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l 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::STR_MODE, 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})); diff --git a/mission/acs/str/arcsecJsonKeys.h b/mission/acs/str/arcsecJsonKeys.h index 34989b1f..f9e2f4f1 100644 --- a/mission/acs/str/arcsecJsonKeys.h +++ b/mission/acs/str/arcsecJsonKeys.h @@ -9,7 +9,7 @@ static const char PROPERTIES[] = "properties"; static const char NAME[] = "name"; static const char VALUE[] = "value"; -static const char LIMITS[] = "limits"; +static const char LIMITS[] = "Limits"; static const char ACTION[] = "action"; static const char FPGA18CURRENT[] = "FPGA18Current"; static const char FPGA25CURRENT[] = "FPGA25Current"; @@ -22,20 +22,20 @@ static const char CMOSVRESCURRENT[] = "CMOSVResCurrent"; static const char CMOS_TEMPERATURE[] = "CMOSTemperature"; static const char MCU_TEMPERATURE[] = "MCUTemperature"; -static const char MOUNTING[] = "mounting"; +static const char MOUNTING[] = "Mounting"; static const char qw[] = "qw"; 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[] = "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 CAMERA[] = "Camera"; static const char MODE[] = "mode"; static const char FOCALLENGTH[] = "focallength"; static const char EXPOSURE[] = "exposure"; @@ -77,7 +77,7 @@ static const char ENABLE_HISTOGRAM[] = "enableHistogram"; static const char ENABLE_CONTRAST[] = "enableContrast"; static const char BIN_MODE[] = "binMode"; -static const char CENTROIDING[] = "centroiding"; +static const char CENTROIDING[] = "Centroiding"; static const char ENABLE_FILTER[] = "enableFilter"; static const char MAX_QUALITY[] = "maxquality"; static const char DARK_THRESHOLD[] = "darkthreshold"; @@ -92,7 +92,7 @@ static const char TRANSMATRIX_01[] = "transmatrix01"; static const char TRANSMATRIX_10[] = "transmatrix10"; static const char TRANSMATRIX_11[] = "transmatrix11"; -static const char LISA[] = "lisa"; +static const char LISA[] = "LISA"; static const char LISA_MODE[] = "mode"; static const char PREFILTER_DIST_THRESHOLD[] = "prefilterDistThreshold"; static const char PREFILTER_ANGLE_THRESHOLD[] = "prefilterAngleThreshold"; @@ -108,29 +108,29 @@ static const char MAX_COMBINATIONS[] = "max_combinations"; static const char NR_STARS_STOP[] = "nr_stars_stop"; static const char FRACTION_CLOSE_STOP[] = "fraction_close_stop"; -static const char MATCHING[] = "matching"; +static const char MATCHING[] = "Matching"; static const char SQUARED_DISTANCE_LIMIT[] = "squaredDistanceLimit"; static const char SQUARED_SHIFT_LIMIT[] = "squaredShiftLimit"; -static const char VALIDATION[] = "validation"; +static const char VALIDATION[] = "Validation"; static const char STABLE_COUNT[] = "stable_count"; static const char MAX_DIFFERENCE[] = "max_difference"; static const char MIN_TRACKER_CONFIDENCE[] = "min_trackerConfidence"; static const char MIN_MATCHED_STARS[] = "min_matchedStars"; -static const char TRACKING[] = "tracking"; +static const char TRACKING[] = "Tracking"; static const char THIN_LIMIT[] = "thinLimit"; static const char OUTLIER_THRESHOLD[] = "outlierThreshold"; static const char OUTLIER_THRESHOLD_QUEST[] = "outlierThresholdQUEST"; static const char TRACKER_CHOICE[] = "trackerChoice"; -static const char ALGO[] = "algo"; +static const char ALGO[] = "Algo"; static const char L2T_MIN_CONFIDENCE[] = "l2t_minConfidence"; static const char L2T_MIN_MATCHED[] = "l2t_minMatched"; static const char T2L_MIN_CONFIDENCE[] = "t2l_minConfidence"; static const char T2L_MIN_MATCHED[] = "t2l_minMatched"; -static const char LOGLEVEL[] = "loglevel"; +static const char LOGLEVEL[] = "LogLevel"; static const char LOGLEVEL1[] = "loglevel1"; static const char LOGLEVEL2[] = "loglevel2"; static const char LOGLEVEL3[] = "loglevel3"; @@ -148,7 +148,7 @@ static const char LOGLEVEL14[] = "loglevel14"; static const char LOGLEVEL15[] = "loglevel15"; static const char LOGLEVEL16[] = "loglevel16"; -static const char SUBSCRIPTION[] = "subscription"; +static const char SUBSCRIPTION[] = "Subscription"; static const char TELEMETRY_1[] = "telemetry1"; static const char TELEMETRY_2[] = "telemetry2"; static const char TELEMETRY_3[] = "telemetry3"; @@ -166,13 +166,13 @@ static const char TELEMETRY_14[] = "telemetry14"; static const char TELEMETRY_15[] = "telemetry15"; static const char TELEMETRY_16[] = "telemetry16"; -static const char LOG_SUBSCRIPTION[] = "logsubscription"; +static const char LOG_SUBSCRIPTION[] = "LogSubscription"; static const char LEVEL1[] = "level1"; static const char MODULE1[] = "module1"; static const char LEVEL2[] = "level2"; static const char MODULE2[] = "module2"; -static const char DEBUG_CAMERA[] = "debugcamera"; +static const char DEBUG_CAMERA[] = "DebugCamera"; static const char TIMING[] = "timing"; static const char TEST[] = "test"; diff --git a/mission/acs/str/strHelpers.h b/mission/acs/str/strHelpers.h index 4eea2635..16b82661 100644 --- a/mission/acs/str/strHelpers.h +++ b/mission/acs/str/strHelpers.h @@ -91,6 +91,7 @@ enum PoolIds : lp_id_t { LISA_QZ, LISA_PERC_CLOSE, LISA_NR_CLOSE, + STR_MODE, TRUST_WORTHY, STABLE_COUNT, SOLUTION_STRATEGY, @@ -358,7 +359,7 @@ static const uint8_t VERSION_SET_ENTRIES = 5; static const uint8_t INTERFACE_SET_ENTRIES = 4; static const uint8_t POWER_SET_ENTRIES = 18; static const uint8_t TIME_SET_ENTRIES = 4; -static const uint8_t SOLUTION_SET_ENTRIES = 23; +static const uint8_t SOLUTION_SET_ENTRIES = 25; static const uint8_t HISTOGRAM_SET_ENTRIES = 38; static const uint8_t CHECKSUM_SET_ENTRIES = 1; static const uint8_t CAMERA_SET_ENTRIES = 24; @@ -682,6 +683,7 @@ class SolutionSet : public StaticLocalDataSet { lp_var_t(sid.objectId, PoolIds::LISA_PERC_CLOSE, this); // Number of close stars in LISA solution lp_var_t lisaNrClose = lp_var_t(sid.objectId, PoolIds::LISA_NR_CLOSE, this); + lp_var_t strMode = lp_var_t(sid.objectId, PoolIds::STR_MODE, this); // Gives a combined overview of the validation parameters (1 for valid solution, otherwise 0) lp_var_t isTrustWorthy = lp_var_t(sid.objectId, PoolIds::TRUST_WORTHY, this); // Number of times the validation criteria was met diff --git a/thirdparty/sagittactl b/thirdparty/sagittactl index 64332216..29e87667 160000 --- a/thirdparty/sagittactl +++ b/thirdparty/sagittactl @@ -1 +1 @@ -Subproject commit 64332216c193fa6483258060b53fc2842c08dcf4 +Subproject commit 29e876671a72fcdb0b393e2f692303725f00724f diff --git a/tmtc b/tmtc index f8da9cff..f5734260 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f8da9cff7c5d6d6bdd483f90ccefb67b2d1e11a4 +Subproject commit f57342602da3232c0bfecaecb0c10be6d692b384