diff --git a/CHANGELOG.md b/CHANGELOG.md index 029f2a7f..f061adf0 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. `wire` library still needs to be updated. ## Fixed @@ -27,10 +27,19 @@ 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. Missing STR mode u8 parameter. +- Fix for STR image download. +- Possible fix for STR image upload. +- Fixed regression where the reply result for ACS board and SUS board devices was set to FAILED + even when going to OFF mode. In that case, it has to be set to OK so the device handler can + complete the OFF transition. ## Changed - STR `wire` library updated to v10.3. Submodule renamed to `sagittactl`. +- Custom FDIR for TMP1075 sensors. The device handlers reject `NEEDS_RECOVERY` health commands + anyway, so it does not really make sense to use the default FDIR. +- Reject `NEEDS_RECOVERY` health commands for the heater health devices. ## Added diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 72c042c1..964d728b 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -27,8 +27,9 @@ #include #include #include +#include #include -#include +#include #include "OBSWConfig.h" #include "bsp_q7s/boardtest/Q7STestTask.h" @@ -62,17 +63,15 @@ #include "mission/system/acs/acsModeTree.h" #include "mission/system/com/SyrlinksFdir.h" #include "mission/system/com/comModeTree.h" -#include "mission/system/fdir/RtdFdir.h" -#include "mission/system/objects/TcsBoardAssembly.h" #include "mission/system/power/GomspacePowerFdir.h" +#include "mission/system/tcs/RtdFdir.h" +#include "mission/system/tcs/TcsBoardAssembly.h" +#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tree/payloadModeTree.h" -#include "mission/system/tree/tcsModeTree.h" #include "mission/tmtc/tmFilters.h" #include "mission/utility/GlobalConfigHandler.h" #include "tmtc/pusIds.h" -using gpio::Direction; -using gpio::Levels; #if OBSW_TEST_LIBGPIOD == 1 #include "linux/boardtest/LibgpiodTest.h" #endif @@ -123,6 +122,9 @@ using gpio::Levels; #include "mission/system/acs/AcsBoardAssembly.h" #include "mission/tmtc/TmFunnelHandler.h" +using gpio::Direction; +using gpio::Levels; + ResetArgs RESET_ARGS_GNSS; std::atomic_bool LINK_STATE = CcsdsIpCoreHandler::LINK_DOWN; std::atomic_bool PTME_LOCKED = false; @@ -164,6 +166,7 @@ void ObjectFactory::createTmpComponents() { new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_PS_EIVE)); auto* tmpDevHandler = new Tmp1075Handler(tmpDevIds[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); + tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevIds[idx].first)); tmpDevHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); // TODO: Remove this after TCS subsystem was added // These devices are connected to the 3V3 stack and should be powered permanently. Therefore, diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 5a7d1d5b..98d2ecfa 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "TemperatureSensorInserter.h" #include "dummies/Max31865Dummy.h" @@ -38,8 +38,8 @@ #include "mission/genericFactory.h" #include "mission/system/acs/acsModeTree.h" #include "mission/system/com/comModeTree.h" +#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tree/payloadModeTree.h" -#include "mission/system/tree/tcsModeTree.h" #include "mission/tcs/defs.h" void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) { diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 72f30278..766b5ca2 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include +#include #include #include "OBSWConfig.h" @@ -27,8 +27,8 @@ #include "devices/gpioIds.h" #include "eive/definitions.h" #include "mission/system/acs/acsModeTree.h" +#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tree/payloadModeTree.h" -#include "mission/system/tree/tcsModeTree.h" #include "mission/tcs/defs.h" void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, diff --git a/linux/acs/AcsBoardPolling.cpp b/linux/acs/AcsBoardPolling.cpp index bc3dff74..e525bf53 100644 --- a/linux/acs/AcsBoardPolling.cpp +++ b/linux/acs/AcsBoardPolling.cpp @@ -122,13 +122,14 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send } else { sif::warning << "AcsBoardPolling: Unknown ADIS type" << std::endl; } + adis.replyResult = returnvalue::FAILED; adis.performStartup = true; } else if (req->mode == acs::SimpleSensorMode::OFF) { adis.performStartup = false; adis.ownReply.cfgWasSet = false; adis.ownReply.dataWasSet = false; + adis.replyResult = returnvalue::OK; } - adis.replyResult = returnvalue::FAILED; adis.mode = req->mode; } return returnvalue::OK; @@ -144,10 +145,11 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode == acs::SimpleSensorMode::NORMAL) { std::memcpy(gyro.sensorCfg, req->ctrlRegs, 5); gyro.performStartup = true; + gyro.replyResult = returnvalue::FAILED; } else { gyro.ownReply.cfgWasSet = false; + gyro.replyResult = returnvalue::OK; } - gyro.replyResult = returnvalue::FAILED; gyro.mode = req->mode; } return returnvalue::OK; @@ -162,11 +164,12 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode != mgm.mode) { if (req->mode == acs::SimpleSensorMode::NORMAL) { mgm.performStartup = true; + mgm.replyResult = returnvalue::FAILED; } else { mgm.ownReply.dataWasSet = false; + mgm.replyResult = returnvalue::OK; mgm.ownReply.temperatureWasSet = false; } - mgm.replyResult = returnvalue::FAILED; mgm.mode = req->mode; } return returnvalue::OK; @@ -181,10 +184,11 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode != mgm.mode) { if (req->mode == acs::SimpleSensorMode::NORMAL) { mgm.performStartup = true; + mgm.replyResult = returnvalue::FAILED; } else { mgm.ownReply.dataWasRead = false; + mgm.replyResult = returnvalue::OK; } - mgm.replyResult = returnvalue::FAILED; mgm.mode = req->mode; } return returnvalue::OK; 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/linux/acs/SusPolling.cpp b/linux/acs/SusPolling.cpp index 1da5ef5e..2ef02f43 100644 --- a/linux/acs/SusPolling.cpp +++ b/linux/acs/SusPolling.cpp @@ -69,11 +69,13 @@ ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData, if (susDevs[susIdx].mode != susReq->mode) { if (susReq->mode == acs::SimpleSensorMode::NORMAL) { susDevs[susIdx].performStartup = true; + susDevs[susIdx].replyResult = returnvalue::FAILED; } else { susDevs[susIdx].ownReply.cfgWasSet = false; susDevs[susIdx].ownReply.dataWasSet = false; + // We are off now, but DHB wants a proper reply. + susDevs[susIdx].replyResult = returnvalue::OK; } - susDevs[susIdx].replyResult = returnvalue::FAILED; susDevs[susIdx].mode = susReq->mode; } if (state == InternalState::IDLE) { 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/mission/genericFactory.cpp b/mission/genericFactory.cpp index 9889fe9e..08d14f45 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ #include "mission/cfdp/Config.h" #include "mission/system/acs/RwAssembly.h" #include "mission/system/acs/acsModeTree.h" -#include "mission/system/tree/tcsModeTree.h" +#include "mission/system/tcs/tcsModeTree.h" #include "mission/tcs/defs.h" #include "mission/tmtc/tmFilters.h" #include "objects/systemObjectList.h" @@ -287,15 +287,17 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler) { HeaterHelper helper({{ - {new HealthDevice(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE), + {new HeaterHealthDev(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_0}, - {new HealthDevice(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_1}, - {new HealthDevice(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2}, - {new HealthDevice(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3}, - {new HealthDevice(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4}, - {new HealthDevice(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5}, - {new HealthDevice(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6}, - {new HealthDevice(objects::HEATER_7_SYRLINKS, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_7}, + {new HeaterHealthDev(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), + gpioIds::HEATER_1}, + {new HeaterHealthDev(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2}, + {new HeaterHealthDev(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3}, + {new HeaterHealthDev(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4}, + {new HeaterHealthDev(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5}, + {new HeaterHealthDev(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6}, + {new HeaterHealthDev(objects::HEATER_7_SYRLINKS, MessageQueueIF::NO_QUEUE), + gpioIds::HEATER_7}, }}); heaterHandler = new HeaterHandler(objects::HEATER_HANDLER, &gpioIF, helper, &pwrSwitcher, power::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V); diff --git a/mission/system/CMakeLists.txt b/mission/system/CMakeLists.txt index e5473de8..116c0438 100644 --- a/mission/system/CMakeLists.txt +++ b/mission/system/CMakeLists.txt @@ -1,8 +1,8 @@ add_subdirectory(objects) add_subdirectory(tree) add_subdirectory(acs) +add_subdirectory(tcs) add_subdirectory(com) -add_subdirectory(fdir) add_subdirectory(power) target_sources( diff --git a/mission/system/fdir/CMakeLists.txt b/mission/system/fdir/CMakeLists.txt deleted file mode 100644 index 3f0baf01..00000000 --- a/mission/system/fdir/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE RtdFdir.cpp) diff --git a/mission/system/objects/CMakeLists.txt b/mission/system/objects/CMakeLists.txt index b2fe6056..e7c2b6f3 100644 --- a/mission/system/objects/CMakeLists.txt +++ b/mission/system/objects/CMakeLists.txt @@ -1,4 +1,3 @@ target_sources( - ${LIB_EIVE_MISSION} - PRIVATE CamSwitcher.cpp TcsSubsystem.cpp PayloadSubsystem.cpp - Stack5VHandler.cpp PowerStateMachineBase.cpp TcsBoardAssembly.cpp) + ${LIB_EIVE_MISSION} PRIVATE CamSwitcher.cpp PayloadSubsystem.cpp + Stack5VHandler.cpp PowerStateMachineBase.cpp) diff --git a/mission/system/objects/SyrlinksAssembly.cpp b/mission/system/objects/SyrlinksAssembly.cpp deleted file mode 100644 index b5e50924..00000000 --- a/mission/system/objects/SyrlinksAssembly.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "SyrlinksAssembly.h" - -#include - -using namespace returnvalue; - -SyrlinksAssembly::SyrlinksAssembly(object_id_t objectId) : AssemblyBase(objectId) { - ModeListEntry entry; - entry.setObject(objects::SYRLINKS_HANDLER); - entry.setMode(MODE_OFF); - entry.setSubmode(SUBMODE_NONE); - commandTable.insert(entry); -} - -ReturnValue_t SyrlinksAssembly::commandChildren(Mode_t mode, Submode_t submode) { - commandTable[0].setMode(mode); - commandTable[0].setSubmode(submode); - HybridIterator iter(commandTable.begin(), commandTable.end()); - if (recoveryState == RECOVERY_IDLE) { - ReturnValue_t result = checkAndHandleHealthState(mode, submode); - if (result == NEED_TO_CHANGE_HEALTH) { - return OK; - } - } - executeTable(iter); - return returnvalue::OK; -} - -ReturnValue_t SyrlinksAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) { - if (childrenMap[objects::SYRLINKS_HANDLER].mode != wantedMode) { - return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; - } - return returnvalue::OK; -} - -ReturnValue_t SyrlinksAssembly::isModeCombinationValid(Mode_t mode, Submode_t submode) { - if (mode == MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_OFF) { - return returnvalue::OK; - } - return returnvalue::FAILED; -} - -ReturnValue_t SyrlinksAssembly::checkAndHandleHealthState(Mode_t deviceMode, - Submode_t deviceSubmode) { - HealthState health = healthHelper.healthTable->getHealth(objects::SYRLINKS_HANDLER); - if (health == FAULTY or health == PERMANENT_FAULTY) { - overwriteDeviceHealth(objects::SYRLINKS_HANDLER, health); - return NEED_TO_CHANGE_HEALTH; - } else if (health == EXTERNAL_CONTROL) { - modeHelper.setForced(true); - } - return OK; -} - -void SyrlinksAssembly::handleChildrenLostMode(ReturnValue_t result) { - startTransition(mode, submode); -} diff --git a/mission/system/objects/SyrlinksAssembly.h b/mission/system/objects/SyrlinksAssembly.h deleted file mode 100644 index 314474d3..00000000 --- a/mission/system/objects/SyrlinksAssembly.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MISSION_SYSTEM_OBJECTS_SYRLINKSASSEMBLY_H_ -#define MISSION_SYSTEM_OBJECTS_SYRLINKSASSEMBLY_H_ -#include - -class SyrlinksAssembly : public AssemblyBase { - public: - SyrlinksAssembly(object_id_t objectId); - - private: - FixedArrayList commandTable; - - ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override; - ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) override; - ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override; - void handleChildrenLostMode(ReturnValue_t result) override; - - ReturnValue_t checkAndHandleHealthState(Mode_t deviceMode, Submode_t deviceSubmode); -}; - -#endif /* MISSION_SYSTEM_OBJECTS_SYRLINKSASSEMBLY_H_ */ diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 73a6b4b7..37adbaf5 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -11,8 +11,8 @@ #include "eive/objects.h" #include "mission/com/defs.h" #include "mission/system/acs/acsModeTree.h" +#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tree/payloadModeTree.h" -#include "mission/system/tree/tcsModeTree.h" #include "treeUtil.h" namespace { diff --git a/mission/system/tcs/CMakeLists.txt b/mission/system/tcs/CMakeLists.txt new file mode 100644 index 00000000..475a2dd2 --- /dev/null +++ b/mission/system/tcs/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources( + ${LIB_EIVE_MISSION} PRIVATE tcsModeTree.cpp TcsSubsystem.cpp + TcsBoardAssembly.cpp RtdFdir.cpp TmpDevFdir.cpp) diff --git a/mission/system/fdir/RtdFdir.cpp b/mission/system/tcs/RtdFdir.cpp similarity index 100% rename from mission/system/fdir/RtdFdir.cpp rename to mission/system/tcs/RtdFdir.cpp diff --git a/mission/system/fdir/RtdFdir.h b/mission/system/tcs/RtdFdir.h similarity index 100% rename from mission/system/fdir/RtdFdir.h rename to mission/system/tcs/RtdFdir.h diff --git a/mission/system/objects/TcsBoardAssembly.cpp b/mission/system/tcs/TcsBoardAssembly.cpp similarity index 100% rename from mission/system/objects/TcsBoardAssembly.cpp rename to mission/system/tcs/TcsBoardAssembly.cpp diff --git a/mission/system/objects/TcsBoardAssembly.h b/mission/system/tcs/TcsBoardAssembly.h similarity index 100% rename from mission/system/objects/TcsBoardAssembly.h rename to mission/system/tcs/TcsBoardAssembly.h diff --git a/mission/system/objects/TcsSubsystem.cpp b/mission/system/tcs/TcsSubsystem.cpp similarity index 100% rename from mission/system/objects/TcsSubsystem.cpp rename to mission/system/tcs/TcsSubsystem.cpp diff --git a/mission/system/objects/TcsSubsystem.h b/mission/system/tcs/TcsSubsystem.h similarity index 100% rename from mission/system/objects/TcsSubsystem.h rename to mission/system/tcs/TcsSubsystem.h diff --git a/mission/system/tcs/TmpDevFdir.cpp b/mission/system/tcs/TmpDevFdir.cpp new file mode 100644 index 00000000..d501dd1a --- /dev/null +++ b/mission/system/tcs/TmpDevFdir.cpp @@ -0,0 +1,91 @@ +#include "TmpDevFdir.h" + +#include +#include +#include +#include + +TmpDevFdir::TmpDevFdir(object_id_t sensorId) + : DeviceHandlerFailureIsolation(sensorId, objects::NO_OBJECT) {} + +ReturnValue_t TmpDevFdir::eventReceived(EventMessage* event) { + if (isFdirInActionOrAreWeFaulty(event)) { + return returnvalue::OK; + } + ReturnValue_t result = returnvalue::FAILED; + switch (event->getEvent()) { + case HasModesIF::MODE_TRANSITION_FAILED: + case HasModesIF::OBJECT_IN_INVALID_MODE: + case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT: + // We'll try a recovery as long as defined in MAX_REBOOT. + // Might cause some AssemblyBase cycles, so keep number low. + // Ignored for TMP device, no way to power cycle it without going to OFF/BOOT mode. + // handleRecovery(event->getEvent()); + break; + case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED: + case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED: + case DeviceHandlerIF::DEVICE_UNREQUESTED_REPLY: + case DeviceHandlerIF::DEVICE_UNKNOWN_REPLY: // Some DH's generate generic reply-ids. + case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED: + // These faults all mean that there were stupid replies from a device. + // With now way to do a recovery, set the device to faulty immediately. + setFaulty(event->getEvent()); + break; + case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED: + case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED: + // The two above should never be confirmed. + case DeviceHandlerIF::DEVICE_MISSED_REPLY: + result = sendConfirmationRequest(event); + if (result == returnvalue::OK) { + break; + } + // else + setFaulty(event->getEvent()); + break; + case StorageManagerIF::GET_DATA_FAILED: + case StorageManagerIF::STORE_DATA_FAILED: + // Rather strange bugs, occur in RAW mode only. Ignore. + break; + case DeviceHandlerIF::INVALID_DEVICE_COMMAND: + // Ignore, is bad configuration. We can't do anything in flight. + break; + case HasHealthIF::HEALTH_INFO: + case HasModesIF::MODE_INFO: + case HasModesIF::CHANGING_MODE: + // Do nothing, but mark as handled. + break; + //****Thermal***** + case ThermalComponentIF::COMPONENT_TEMP_LOW: + case ThermalComponentIF::COMPONENT_TEMP_HIGH: + case ThermalComponentIF::COMPONENT_TEMP_OOL_LOW: + case ThermalComponentIF::COMPONENT_TEMP_OOL_HIGH: + // Well, the device is not really faulty, but it is required to stay off as long as possible. + setFaulty(event->getEvent()); + break; + case ThermalComponentIF::TEMP_NOT_IN_OP_RANGE: + // Ignore, is information only. + break; + //*******Default monitoring variables. Are currently not used.***** + // case DeviceHandlerIF::MONITORING_LIMIT_EXCEEDED: + // setFaulty(event->getEvent()); + // break; + // case DeviceHandlerIF::MONITORING_AMBIGUOUS: + // break; + default: + // We don't know the event, someone else should handle it. + return returnvalue::FAILED; + } + return returnvalue::OK; +} + +void TmpDevFdir::eventConfirmed(EventMessage* event) { + switch (event->getEvent()) { + case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED: + case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED: + case DeviceHandlerIF::DEVICE_MISSED_REPLY: + setFaulty(event->getEvent()); + break; + default: + break; + } +} diff --git a/mission/system/tcs/TmpDevFdir.h b/mission/system/tcs/TmpDevFdir.h new file mode 100644 index 00000000..38cb73b0 --- /dev/null +++ b/mission/system/tcs/TmpDevFdir.h @@ -0,0 +1,20 @@ +#ifndef MISSION_SYSTEM_TCS_TMPDEVFDIR_H_ +#define MISSION_SYSTEM_TCS_TMPDEVFDIR_H_ +#include + +/** + * Special FDIR because we can not simply power cycle the TMP devices which are powered by the + * 3.3 V stack and there is also no way to logically reset or re-configure the TMP devices in + * any way. In general, instead of doing a recovery, the TMP devices should be set faulty + * immediately for the EIVE project. + */ +class TmpDevFdir : public DeviceHandlerFailureIsolation { + public: + TmpDevFdir(object_id_t sensorId); + + private: + ReturnValue_t eventReceived(EventMessage* event) override; + void eventConfirmed(EventMessage* event) override; +}; + +#endif /* MISSION_SYSTEM_TCS_TMPDEVFDIR_H_ */ diff --git a/mission/system/tree/tcsModeTree.cpp b/mission/system/tcs/tcsModeTree.cpp similarity index 100% rename from mission/system/tree/tcsModeTree.cpp rename to mission/system/tcs/tcsModeTree.cpp diff --git a/mission/system/tree/tcsModeTree.h b/mission/system/tcs/tcsModeTree.h similarity index 84% rename from mission/system/tree/tcsModeTree.h rename to mission/system/tcs/tcsModeTree.h index ca576a6d..e5973641 100644 --- a/mission/system/tree/tcsModeTree.h +++ b/mission/system/tcs/tcsModeTree.h @@ -1,7 +1,7 @@ #ifndef MISSION_SYSTEM_TREE_TCSMODETREE_H_ #define MISSION_SYSTEM_TREE_TCSMODETREE_H_ -#include +#include namespace satsystem { namespace tcs { diff --git a/mission/system/tree/CMakeLists.txt b/mission/system/tree/CMakeLists.txt index 8715d8e1..7b546846 100644 --- a/mission/system/tree/CMakeLists.txt +++ b/mission/system/tree/CMakeLists.txt @@ -1 +1 @@ -target_sources(${LIB_EIVE_MISSION} PRIVATE payloadModeTree.cpp tcsModeTree.cpp) +target_sources(${LIB_EIVE_MISSION} PRIVATE payloadModeTree.cpp) diff --git a/mission/tcs/CMakeLists.txt b/mission/tcs/CMakeLists.txt index ea077050..c23e9c18 100644 --- a/mission/tcs/CMakeLists.txt +++ b/mission/tcs/CMakeLists.txt @@ -1,3 +1,4 @@ target_sources( - ${LIB_EIVE_MISSION} PRIVATE HeaterHandler.cpp max1227.cpp - Max31865EiveHandler.cpp Tmp1075Handler.cpp) + ${LIB_EIVE_MISSION} + PRIVATE HeaterHandler.cpp max1227.cpp Max31865EiveHandler.cpp + Tmp1075Handler.cpp HeaterHealthDev.cpp) diff --git a/mission/tcs/HeaterHandler.h b/mission/tcs/HeaterHandler.h index c3ea4afa..609ac725 100644 --- a/mission/tcs/HeaterHandler.h +++ b/mission/tcs/HeaterHandler.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ class PowerSwitchIF; class HealthTableIF; -using HeaterPair = std::pair; +using HeaterPair = std::pair; struct HeaterHelper { public: diff --git a/mission/tcs/HeaterHealthDev.cpp b/mission/tcs/HeaterHealthDev.cpp new file mode 100644 index 00000000..6be56a09 --- /dev/null +++ b/mission/tcs/HeaterHealthDev.cpp @@ -0,0 +1,12 @@ +#include "HeaterHealthDev.h" + +HeaterHealthDev::HeaterHealthDev(object_id_t setObjectId, MessageQueueId_t parentQueue) + : HealthDevice(setObjectId, parentQueue) {} + +ReturnValue_t HeaterHealthDev::setHealth(HealthState health) { + // Does not make sense for a simple heater. + if (health == HealthState::NEEDS_RECOVERY) { + return returnvalue::FAILED; + } + return HealthDevice::setHealth(health); +} diff --git a/mission/tcs/HeaterHealthDev.h b/mission/tcs/HeaterHealthDev.h new file mode 100644 index 00000000..8d15836c --- /dev/null +++ b/mission/tcs/HeaterHealthDev.h @@ -0,0 +1,12 @@ +#ifndef MISSION_TCS_HEATERHEALTHDEV_H_ +#define MISSION_TCS_HEATERHEALTHDEV_H_ +#include + +class HeaterHealthDev : public HealthDevice { + public: + HeaterHealthDev(object_id_t setObjectId, MessageQueueId_t parentQueue); + + ReturnValue_t setHealth(HealthState health) override; +}; + +#endif /* MISSION_TCS_HEATERHEALTHDEV_H_ */ 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