Swap PL and PS I2C #725

Merged
muellerr merged 20 commits from swap-pl-ps-i2c into main 2023-07-06 15:05:54 +02:00
31 changed files with 318 additions and 170 deletions

View File

@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
## Changed
- Swapped PL and PS I2C, BPX battery and MGT are connected to PS I2C now for firmware versions
equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware.
meggert marked this conversation as resolved Outdated

You might wanna check for typos ins this sentence.

You might wanna check for typos ins this sentence.

there are now typos in there

there are now typos in there

all typos ins now fixed

all typos ins now fixed
- The firmware version variables are global statics inititalized early during the program
runtime now. This makes it possible to check the firmware version earlier.
## Fixed ## Fixed
- TMP1075: Set dataset invalid on shutdown explicitely - TMP1075: Set dataset invalid on shutdown explicitely

View File

@ -150,7 +150,7 @@ set(OBSW_ADD_SYRLINKS
1 1
CACHE STRING "Add Syrlinks module") CACHE STRING "Add Syrlinks module")
set(OBSW_ADD_TMP_DEVICES set(OBSW_ADD_TMP_DEVICES
${INIT_VAL} 1
CACHE STRING "Add TMP devices") CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU set(OBSW_ADD_GOMSPACE_PCDU
1 1

View File

@ -113,7 +113,7 @@ void ObjectFactory::produce(void* args) {
if (heaterHandler == nullptr) { if (heaterHandler == nullptr) {
sif::error << "HeaterHandler could not be created" << std::endl; sif::error << "HeaterHandler could not be created" << std::endl;
} else { } else {
ObjectFactory::createThermalController(*heaterHandler); ObjectFactory::createThermalController(*heaterHandler, true);
} }
new TestTask(objects::TEST_TASK); new TestTask(objects::TEST_TASK);
} }

View File

@ -7,7 +7,8 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC ${LIB_FSFW_NAME})
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
add_subdirectory(simple) add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp) target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp scheduling.cpp
objectFactory.cpp)
add_subdirectory(boardtest) add_subdirectory(boardtest)

View File

@ -1,4 +1 @@
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp scheduling.cpp target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp)
ObjectFactory.cpp WatchdogHandler.cpp)
target_sources(${SIMPLE_OBSW_NAME} PRIVATE scheduling.cpp)

View File

@ -188,17 +188,6 @@ ReturnValue_t CoreController::initialize() {
} }
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY); triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
announceCurrentImageInfo(); announceCurrentImageInfo();
// This has to come before the version announce because it might be required for retrieving
// the firmware version.
if (common::OBSW_VERSION_MAJOR >= 6 or common::OBSW_VERSION_MAJOR == 4) {
UioMapper sysRomMapper(q7s::UIO_SYS_ROM);
result = sysRomMapper.getMappedAdress(&mappedSysRomAddr, UioMapper::Permissions::READ_ONLY);
if (result != returnvalue::OK) {
// TODO: This might be a reason to switch to another image..
sif::error << "Getting mapped SYS ROM UIO address failed" << std::endl;
result = ObjectManager::CHILD_INIT_FAILED;
}
}
announceVersionInfo(); announceVersionInfo();
return result; return result;
@ -2526,14 +2515,10 @@ void CoreController::announceVersionInfo() {
} }
triggerEvent(VERSION_INFO, p1, p2); triggerEvent(VERSION_INFO, p1, p2);
p1 = (core::FW_VERSION_MAJOR << 24) | (core::FW_VERSION_MINOR << 16) |
if (common::OBSW_VERSION_MAJOR >= 6 or common::OBSW_VERSION_MAJOR == 4) { (core::FW_VERSION_REVISION << 8) | (core::FW_VERSION_HAS_SHA);
if (mappedSysRomAddr != nullptr) { std::memcpy(&p2, core::FW_VERSION_GIT_SHA, 4);
uint32_t p1Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr)); triggerEvent(FIRMWARE_INFO, p1, p2);
uint32_t p2Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr) + 1);
triggerEvent(FIRMWARE_INFO, p1Firmware, p2Firmware);
}
}
} }
void CoreController::announceCurrentImageInfo() { void CoreController::announceCurrentImageInfo() {

View File

@ -1,6 +1,7 @@
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_ #ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
#define BSP_Q7S_CORE_CORECONTROLLER_H_ #define BSP_Q7S_CORE_CORECONTROLLER_H_
#include <bsp_q7s/core/defs.h>
#include <fsfw/container/DynamicFIFO.h> #include <fsfw/container/DynamicFIFO.h>
#include <fsfw/container/SimpleRingBuffer.h> #include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h> #include <fsfw/globalfunctions/PeriodicOperationDivider.h>
@ -14,7 +15,6 @@
#include <atomic> #include <atomic>
#include <cstddef> #include <cstddef>
#include "CoreDefinitions.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/fs/SdCardManager.h"
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"

View File

@ -1,10 +1,16 @@
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_ #ifndef BSP_Q7S_CORE_DEFS_H_
#define BSP_Q7S_CORE_COREDEFINITIONS_H_ #define BSP_Q7S_CORE_DEFS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
namespace core { namespace core {
extern uint8_t FW_VERSION_MAJOR;
extern uint8_t FW_VERSION_MINOR;
extern uint8_t FW_VERSION_REVISION;
extern bool FW_VERSION_HAS_SHA;
extern char FW_VERSION_GIT_SHA[4];
static const uint8_t HK_SET_ENTRIES = 3; static const uint8_t HK_SET_ENTRIES = 3;
static const uint32_t HK_SET_ID = 5; static const uint32_t HK_SET_ID = 5;
@ -36,4 +42,4 @@ class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
} // namespace core } // namespace core
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */ #endif /* BSP_Q7S_CORE_DEFS_H_ */

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h> #include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/objectFactory.h>
#include <dummies/ComCookieDummy.h> #include <dummies/ComCookieDummy.h>
#include <dummies/PcduHandlerDummy.h> #include <dummies/PcduHandlerDummy.h>
#include <fsfw/health/HealthTableIF.h> #include <fsfw/health/HealthTableIF.h>
@ -10,8 +11,8 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h" #include "busConf.h"
#include "common/config/devices/addresses.h"
#include "devConf.h" #include "devConf.h"
#include "dummies/helperFactory.h" #include "dummies/helperFactory.h"
#include "eive/objects.h" #include "eive/objects.h"
@ -35,6 +36,7 @@ void ObjectFactory::produce(void* args) {
#endif #endif
PersistentTmStores stores; PersistentTmStores stores;
readFirmwareVersion();
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
enableHkSets); enableHkSets);
@ -44,7 +46,7 @@ void ObjectFactory::produce(void* args) {
SpiComIF* spiMainComIF = nullptr; SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr; I2cComIF* i2cComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF); createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF);
/* Adding gpios for chip select decoding to the gpioComIf */ // Adding GPIOs for chip select decoding and initializing them.
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF); q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
gpioCallbacks::disableAllDecoder(gpioComIF); gpioCallbacks::disableAllDecoder(gpioComIF);
createPlI2cResetGpio(gpioComIF); createPlI2cResetGpio(gpioComIF);
@ -60,6 +62,25 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_PLOC_SUPERVISOR == 1 || OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_SUPERVISOR == 1 || OBSW_ADD_PLOC_MPSOC == 1
dummyCfg.addPlocDummies = false; dummyCfg.addPlocDummies = false;
#endif #endif
#if OBSW_ADD_TMP_DEVICES == 1
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
{objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}};
const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
dummy::Tmp1075Cfg tmpCfg{};
tmpCfg.addTcsBrd0 = true;
tmpCfg.addTcsBrd1 = true;
tmpCfg.addPlPcdu0 = false;
tmpCfg.addPlPcdu1 = false;
tmpCfg.addIfBrd = false;
dummyCfg.tmp1075Cfg = tmpCfg;
#endif
#if OBSW_ADD_GOMSPACE_PCDU == 1 #if OBSW_ADD_GOMSPACE_PCDU == 1
dummyCfg.addPowerDummies = false; dummyCfg.addPowerDummies = false;
// The ACU broke. // The ACU broke.
@ -97,8 +118,12 @@ void ObjectFactory::produce(void* args) {
gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board"); gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board");
#endif #endif
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
}
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets); createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
@ -110,7 +135,7 @@ void ObjectFactory::produce(void* args) {
#endif #endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 #if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets); createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
@ -142,6 +167,6 @@ void ObjectFactory::produce(void* args) {
createAcsController(true, enableHkSets); createAcsController(true, enableHkSets);
HeaterHandler* heaterHandler; HeaterHandler* heaterHandler;
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler); createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
createThermalController(*heaterHandler); createThermalController(*heaterHandler, true);
satsystem::init(); satsystem::init();
} }

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h> #include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/objectFactory.h>
#include <devices/gpioIds.h> #include <devices/gpioIds.h>
#include <fsfw/storagemanager/LocalPool.h> #include <fsfw/storagemanager/LocalPool.h>
#include <fsfw/storagemanager/PoolManager.h> #include <fsfw/storagemanager/PoolManager.h>
@ -7,9 +8,9 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h" #include "busConf.h"
#include "devConf.h" #include "devConf.h"
#include "devices/addresses.h"
#include "eive/objects.h" #include "eive/objects.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "linux/ObjectFactory.h" #include "linux/ObjectFactory.h"
@ -32,6 +33,7 @@ void ObjectFactory::produce(void* args) {
#endif #endif
PersistentTmStores stores; PersistentTmStores stores;
readFirmwareVersion();
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200, *SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
true); true);
@ -67,7 +69,19 @@ void ObjectFactory::produce(void* args) {
HeaterHandler* heaterHandler; HeaterHandler* heaterHandler;
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler); createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
#if OBSW_ADD_TMP_DEVICES == 1 #if OBSW_ADD_TMP_DEVICES == 1
createTmpComponents(); std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{
{objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0},
{objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1},
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
// damaged
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}};
const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
#endif #endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF); createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
@ -77,13 +91,17 @@ void ObjectFactory::produce(void* args) {
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher); createPayloadComponents(gpioComIF, *pwrSwitcher);
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
}
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets); createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev);
#endif #endif
createReactionWheelComponents(gpioComIF, pwrSwitcher); createReactionWheelComponents(gpioComIF, pwrSwitcher);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 #if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets); createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
@ -113,7 +131,7 @@ void ObjectFactory::produce(void* args) {
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
createMiscComponents(); createMiscComponents();
createThermalController(*heaterHandler); createThermalController(*heaterHandler, false);
createAcsController(true, enableHkSets); createAcsController(true, enableHkSets);
satsystem::init(); satsystem::init();
} }

View File

@ -1,8 +1,9 @@
#include "ObjectFactory.h" #include "objectFactory.h"
#include <fsfw/devicehandlers/HealthDevice.h> #include <fsfw/devicehandlers/HealthDevice.h>
#include <fsfw/subsystem/Subsystem.h> #include <fsfw/subsystem/Subsystem.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <fsfw_hal/linux/uio/UioMapper.h>
#include <linux/acs/AcsBoardPolling.h> #include <linux/acs/AcsBoardPolling.h>
#include <linux/acs/GpsHyperionLinuxController.h> #include <linux/acs/GpsHyperionLinuxController.h>
#include <linux/acs/ImtqPollingTask.h> #include <linux/acs/ImtqPollingTask.h>
@ -32,6 +33,9 @@
#include <mission/system/objects/CamSwitcher.h> #include <mission/system/objects/CamSwitcher.h>
#include <mission/system/tcs/TmpDevFdir.h> #include <mission/system/tcs/TmpDevFdir.h>
#include <cstdint>
#include <cstring>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/callbacks/gnssCallback.h" #include "bsp_q7s/callbacks/gnssCallback.h"
@ -100,6 +104,7 @@
#include <sstream> #include <sstream>
#include "bsp_q7s/core/defs.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/CommandingServiceBase.h"
@ -130,6 +135,11 @@ ResetArgs RESET_ARGS_GNSS;
std::atomic_bool LINK_STATE = CcsdsIpCoreHandler::LINK_DOWN; std::atomic_bool LINK_STATE = CcsdsIpCoreHandler::LINK_DOWN;
std::atomic_bool PTME_LOCKED = false; std::atomic_bool PTME_LOCKED = false;
std::atomic_uint16_t I2C_FATAL_ERRORS = 0; std::atomic_uint16_t I2C_FATAL_ERRORS = 0;
uint8_t core::FW_VERSION_MAJOR = 0;
uint8_t core::FW_VERSION_MINOR = 0;
uint8_t core::FW_VERSION_REVISION = 0;
bool core::FW_VERSION_HAS_SHA = false;
char core::FW_VERSION_GIT_SHA[4] = {};
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
@ -151,23 +161,16 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
void ObjectFactory::createTmpComponents() { void ObjectFactory::createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd,
std::vector<std::pair<object_id_t, address_t>> tmpDevIds = {{ const char* i2cDev) {
{objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0},
{objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1},
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
// damaged
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}};
std::vector<I2cCookie*> tmpDevCookies; std::vector<I2cCookie*> tmpDevCookies;
for (size_t idx = 0; idx < tmpDevIds.size(); idx++) { for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) {
tmpDevCookies.push_back( tmpDevCookies.push_back(
new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_PS_EIVE)); new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, i2cDev));
auto* tmpDevHandler = auto* tmpDevHandler =
new Tmp1075Handler(tmpDevIds[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]);
tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevIds[idx].first)); tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first));
tmpDevHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); tmpDevHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
// TODO: Remove this after TCS subsystem was added // TODO: Remove this after TCS subsystem was added
// These devices are connected to the 3V3 stack and should be powered permanently. Therefore, // These devices are connected to the 3V3 stack and should be powered permanently. Therefore,
@ -954,12 +957,13 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
starTracker->setCustomFdir(strFdir); starTracker->setCustomFdir(strFdir);
} }
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets) { void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets,
const char* i2cDev) {
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY); auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
new ImtqPollingTask(objects::IMTQ_POLLING, I2C_FATAL_ERRORS); new ImtqPollingTask(objects::IMTQ_POLLING, I2C_FATAL_ERRORS);
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, q7s::I2C_PL_EIVE); I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, imtq::MAX_REPLY_SIZE, i2cDev);
auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::IMTQ_POLLING, imtqI2cCookie, auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::IMTQ_POLLING, imtqI2cCookie,
power::Switches::PDU1_CH3_MGT_5V, enableHkSets); power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
imtqHandler->enableThermalModule(ThermalStateCfg()); imtqHandler->enableThermalModule(ThermalStateCfg());
@ -975,8 +979,8 @@ void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enable
#endif #endif
} }
void ObjectFactory::createBpxBatteryComponent(bool enableHkSets) { void ObjectFactory::createBpxBatteryComponent(bool enableHkSets, const char* i2cDev) {
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_PL_EIVE); I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, i2cDev);
BpxBatteryHandler* bpxHandler = new BpxBatteryHandler( BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(
objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie, enableHkSets); objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie, enableHkSets);
bpxHandler->setStartUpImmediately(); bpxHandler->setStartUpImmediately();
@ -1032,3 +1036,32 @@ void ObjectFactory::createPlI2cResetGpio(LinuxLibgpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::PL_I2C_ARESETN); gpioIF->pullHigh(gpioIds::PL_I2C_ARESETN);
} }
} }
ReturnValue_t ObjectFactory::readFirmwareVersion() {
uint32_t* mappedSysRomAddr = nullptr;
// The SYS ROM FPGA block is only available in those versions.
if (not(common::OBSW_VERSION_MAJOR >= 6) or (common::OBSW_VERSION_MAJOR == 4)) {
return returnvalue::OK;
}
// This has to come before the version announce because it might be required for retrieving
// the firmware version.
UioMapper sysRomMapper(q7s::UIO_SYS_ROM);
ReturnValue_t result =
sysRomMapper.getMappedAdress(&mappedSysRomAddr, UioMapper::Permissions::READ_ONLY);
if (result != returnvalue::OK) {
sif::error << "Getting mapped SYS ROM UIO address failed" << std::endl;
return returnvalue::FAILED;
}
if (mappedSysRomAddr != nullptr) {
uint32_t firstEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr));
uint32_t secondEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr) + 1);
core::FW_VERSION_MAJOR = (firstEntry >> 24) & 0xff;
core::FW_VERSION_MINOR = (firstEntry >> 16) & 0xff;
core::FW_VERSION_REVISION = (firstEntry >> 8) & 0xff;
bool hasGitSha = (firstEntry & 0x0b1);
if (hasGitSha) {
std::memcpy(core::FW_VERSION_GIT_SHA, &secondEntry, 4);
}
}
return returnvalue::OK;
}

View File

@ -58,7 +58,8 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
bool enableHkSets); bool enableHkSets);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler); PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
void createTmpComponents(); void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd,
const char* i2cDev);
void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF); void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF);
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler); ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
void createAcsBoardGpios(GpioCookie& cookie); void createAcsBoardGpios(GpioCookie& cookie);
@ -67,14 +68,15 @@ void createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* gpioComIF, Ser
adis1650x::Type adisType); adis1650x::Type adisType);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable, void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable,
HeaterHandler*& heaterHandler); HeaterHandler*& heaterHandler);
void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets); void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets, const char* i2cDev);
void createBpxBatteryComponent(bool enableHkSets); void createBpxBatteryComponent(bool enableHkSets, const char* i2cDev);
void createStrComponents(PowerSwitchIF* pwrSwitcher); void createStrComponents(PowerSwitchIF* pwrSwitcher);
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF); void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher); void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher); void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args); ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args);
ReturnValue_t readFirmwareVersion();
void createMiscComponents(); void createMiscComponents();
void createTestComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF);

View File

@ -11,13 +11,13 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/WatchdogHandler.h" #include "bsp_q7s/core/WatchdogHandler.h"
#include "commonConfig.h" #include "commonConfig.h"
#include "core/scheduling.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h" #include "fsfw/version.h"
#include "mission/acs/defs.h" #include "mission/acs/defs.h"
#include "mission/com/defs.h" #include "mission/com/defs.h"
#include "mission/system/systemTree.h" #include "mission/system/systemTree.h"
#include "q7sConfig.h" #include "q7sConfig.h"
#include "scheduling.h"
#include "watchdog/definitions.h" #include "watchdog/definitions.h"
static constexpr int OBSW_ALREADY_RUNNING = -2; static constexpr int OBSW_ALREADY_RUNNING = -2;

View File

@ -9,7 +9,6 @@
#include <vector> #include <vector>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/platform.h" #include "fsfw/platform.h"
@ -21,6 +20,8 @@
#include "mission/pollingSeqTables.h" #include "mission/pollingSeqTables.h"
#include "mission/scheduling.h" #include "mission/scheduling.h"
#include "mission/utility/InitMission.h" #include "mission/utility/InitMission.h"
#include "objectFactory.h"
#include "q7sConfig.h"
/* This is configured for linux without CR */ /* This is configured for linux without CR */
#ifdef PLATFORM_UNIX #ifdef PLATFORM_UNIX
@ -531,7 +532,15 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
FixedTimeslotTaskIF* i2cPst = FixedTimeslotTaskIF* i2cPst =
factory.createFixedTimeslotTask("I2C_PS_PST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.6, factory.createFixedTimeslotTask("I2C_PS_PST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.6,
missedDeadlineFunc, &RR_SCHEDULING); missedDeadlineFunc, &RR_SCHEDULING);
result = pst::pstI2cProcessingSystem(i2cPst); pst::TmpSchedConfig tmpSchedConf;
#if OBSW_Q7S_EM == 1
tmpSchedConf.scheduleTmpDev0 = true;
tmpSchedConf.scheduleTmpDev1 = true;
tmpSchedConf.schedulePlPcduDev0 = true;
tmpSchedConf.schedulePlPcduDev1 = true;
tmpSchedConf.scheduleIfBoardDev = true;
#endif
result = pst::pstI2c(tmpSchedConf, i2cPst);
meggert marked this conversation as resolved Outdated

Naming is kind of confusing, if we are trying to keep this backwad compatible. Maybe pstTmpI2c might be better here.

Naming is kind of confusing, if we are trying to keep this backwad compatible. Maybe `pstTmpI2c` might be better here.

good catch

good catch
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl; sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl;

View File

@ -1,6 +1,6 @@
#include "CoreControllerDummy.h" #include "CoreControllerDummy.h"
#include <bsp_q7s/core/CoreDefinitions.h> #include <bsp_q7s/core/defs.h>
#include <objects/systemObjectList.h> #include <objects/systemObjectList.h>
#include <cmath> #include <cmath>

View File

@ -7,9 +7,9 @@
#include <cstdlib> #include <cstdlib>
#include <utility> #include <utility>
TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId, TemperatureSensorInserter::TemperatureSensorInserter(
Max31865DummyMap tempSensorDummies_, object_id_t objectId, Max31865DummyMap tempSensorDummies_,
Tmp1075DummyMap tempTmpSensorDummies_) std::optional<Tmp1075DummyMap> tempTmpSensorDummies_)
: SystemObject(objectId), : SystemObject(objectId),
max31865DummyMap(std::move(tempSensorDummies_)), max31865DummyMap(std::move(tempSensorDummies_)),
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {} tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
@ -25,8 +25,10 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
for (auto& rtdDummy : max31865DummyMap) { for (auto& rtdDummy : max31865DummyMap) {
rtdDummy.second->setTemperature(10, true); rtdDummy.second->setTemperature(10, true);
} }
for (auto& tmpDummy : tmp1075DummyMap) { if (tmp1075DummyMap.has_value()) {
tmpDummy.second->setTemperature(10, true); for (auto& tmpDummy : tmp1075DummyMap.value()) {
tmpDummy.second->setTemperature(10, true);
}
} }
tempsWereInitialized = true; tempsWereInitialized = true;
} }

View File

@ -12,7 +12,7 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
using Max31865DummyMap = std::map<object_id_t, Max31865Dummy*>; using Max31865DummyMap = std::map<object_id_t, Max31865Dummy*>;
using Tmp1075DummyMap = std::map<object_id_t, Tmp1075Dummy*>; using Tmp1075DummyMap = std::map<object_id_t, Tmp1075Dummy*>;
explicit TemperatureSensorInserter(object_id_t objectId, Max31865DummyMap tempSensorDummies_, explicit TemperatureSensorInserter(object_id_t objectId, Max31865DummyMap tempSensorDummies_,
Tmp1075DummyMap tempTmpSensorDummies_); std::optional<Tmp1075DummyMap> tempTmpSensorDummies_);
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
@ -22,7 +22,7 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
private: private:
Max31865DummyMap max31865DummyMap; Max31865DummyMap max31865DummyMap;
Tmp1075DummyMap tmp1075DummyMap; std::optional<Tmp1075DummyMap> tmp1075DummyMap;
enum TestCase { enum TestCase {
NONE = 0, NONE = 0,

View File

@ -8,35 +8,46 @@ using namespace returnvalue;
Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie), set(this) {} : DeviceHandlerBase(objectId, comif, comCookie), set(this) {}
void Tmp1075Dummy::doStartUp() { setMode(MODE_NORMAL); } void Tmp1075Dummy::doStartUp() { setMode(MODE_ON); }
void Tmp1075Dummy::doShutDown() { setMode(MODE_OFF); } void Tmp1075Dummy::doShutDown() { setMode(MODE_OFF); }
ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
} }
ReturnValue_t Tmp1075Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { return OK; }
ReturnValue_t Tmp1075Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t Tmp1075Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t Tmp1075Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, const uint8_t *commandData,
size_t commandDataLen) { size_t commandDataLen) {
return 0; return NOTHING_TO_SEND;
} }
ReturnValue_t Tmp1075Dummy::scanForReply(const uint8_t *start, size_t len, ReturnValue_t Tmp1075Dummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
return 0; return 0;
} }
ReturnValue_t Tmp1075Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { ReturnValue_t Tmp1075Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return 0; return 0;
} }
void Tmp1075Dummy::setTemperature(float temperature, bool valid) { void Tmp1075Dummy::setTemperature(float temperature, bool valid) {
PoolReadGuard pg(&set); PoolReadGuard pg(&set);
set.temperatureCelcius.value = temperature; set.temperatureCelcius.value = temperature;
set.setValidity(valid, true); set.setValidity(valid, true);
} }
void Tmp1075Dummy::fillCommandAndReplyMap() {} void Tmp1075Dummy::fillCommandAndReplyMap() {}
uint32_t Tmp1075Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; } uint32_t Tmp1075Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; }
ReturnValue_t Tmp1075Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t Tmp1075Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({10.0}, true)); localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({10.0}, true));
return OK; return OK;
} }
LocalPoolDataSetBase *Tmp1075Dummy::getDataSetHandle(sid_t sid) { return &set; } LocalPoolDataSetBase *Tmp1075Dummy::getDataSetHandle(sid_t sid) { return &set; }

View File

@ -191,25 +191,36 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
objects::RTD_15_IC18_IMTQ, objects::RTD_15_IC18_IMTQ,
new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy)); new Max31865Dummy(objects::RTD_15_IC18_IMTQ, objects::DUMMY_COM_IF, comCookieDummy));
std::map<object_id_t, Tmp1075Dummy*> tmpSensorDummies; std::optional<TemperatureSensorInserter::Tmp1075DummyMap> tmpSensorDummies;
tmpSensorDummies.emplace( if (cfg.addTmpDummies) {
objects::TMP1075_HANDLER_TCS_0, TemperatureSensorInserter::Tmp1075DummyMap tmpDummyMap;
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF, comCookieDummy)); if (cfg.tmp1075Cfg.addTcsBrd0) {
tmpSensorDummies.emplace( tmpDummyMap.emplace(objects::TMP1075_HANDLER_TCS_0,
objects::TMP1075_HANDLER_TCS_1, new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_0, objects::DUMMY_COM_IF,
new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF, comCookieDummy)); comCookieDummy));
tmpSensorDummies.emplace( }
objects::TMP1075_HANDLER_PLPCDU_0, if (cfg.tmp1075Cfg.addTcsBrd1) {
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy)); tmpDummyMap.emplace(objects::TMP1075_HANDLER_TCS_1,
// damaged. new Tmp1075Dummy(objects::TMP1075_HANDLER_TCS_1, objects::DUMMY_COM_IF,
// tmpSensorDummies.emplace( comCookieDummy));
// objects::TMP1075_HANDLER_PLPCDU_1, }
// new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, if (cfg.tmp1075Cfg.addPlPcdu0) {
// comCookieDummy)); tmpDummyMap.emplace(objects::TMP1075_HANDLER_PLPCDU_0,
tmpSensorDummies.emplace( new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0,
objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy));
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy)); }
if (cfg.tmp1075Cfg.addPlPcdu1) {
tmpDummyMap.emplace(objects::TMP1075_HANDLER_PLPCDU_1,
new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1,
objects::DUMMY_COM_IF, comCookieDummy));
}
if (cfg.tmp1075Cfg.addIfBrd) {
tmpDummyMap.emplace(objects::TMP1075_HANDLER_IF_BOARD,
new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD,
objects::DUMMY_COM_IF, comCookieDummy));
}
tmpSensorDummies = std::move(tmpDummyMap);
}
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, rtdSensorDummies, new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER, rtdSensorDummies,
tmpSensorDummies); tmpSensorDummies);
TcsBoardAssembly* tcsBoardAssy = TcsBoardAssembly* tcsBoardAssy =
@ -217,8 +228,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
for (auto& rtd : rtdSensorDummies) { for (auto& rtd : rtdSensorDummies) {
rtd.second->connectModeTreeParent(*tcsBoardAssy); rtd.second->connectModeTreeParent(*tcsBoardAssy);
} }
for (auto& tmp : tmpSensorDummies) { if (tmpSensorDummies.has_value()) {
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); for (auto& tmp : tmpSensorDummies.value()) {
tmp.second->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
} }
} }
if (cfg.addCamSwitcherDummy) { if (cfg.addCamSwitcherDummy) {

View File

@ -6,6 +6,14 @@ class GpioIF;
namespace dummy { namespace dummy {
struct Tmp1075Cfg {
bool addTcsBrd0 = true;
bool addTcsBrd1 = true;
bool addPlPcdu0 = true;
bool addPlPcdu1 = true;
bool addIfBrd = true;
};
// Default values targeted towards EM. // Default values targeted towards EM.
struct DummyCfg { struct DummyCfg {
bool addCoreCtrlCfg = true; bool addCoreCtrlCfg = true;
@ -19,6 +27,8 @@ struct DummyCfg {
bool addTempSensorDummies = true; bool addTempSensorDummies = true;
bool addRtdComIFDummy = true; bool addRtdComIFDummy = true;
bool addPlocDummies = true; bool addPlocDummies = true;
bool addTmpDummies = true;
Tmp1075Cfg tmp1075Cfg;
bool addCamSwitcherDummy = false; bool addCamSwitcherDummy = false;
}; };

View File

@ -1,6 +1,6 @@
#include "ThermalController.h" #include "ThermalController.h"
#include <bsp_q7s/core/CoreDefinitions.h> #include <bsp_q7s/core/defs.h>
#include <eive/objects.h> #include <eive/objects.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/thermal/ThermalComponentIF.h> #include <fsfw/thermal/ThermalComponentIF.h>
@ -24,9 +24,11 @@
#define LOWER_RW_UPPER_LIMITS 0 #define LOWER_RW_UPPER_LIMITS 0
ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater, ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater,
const std::atomic_bool& tcsBoardShortUnavailable) const std::atomic_bool& tcsBoardShortUnavailable,
bool pollPcdu1Tmp)
: ExtendedControllerBase(objectId), : ExtendedControllerBase(objectId),
heaterHandler(heater), heaterHandler(heater),
pollPcdu1Tmp(pollPcdu1Tmp),
sensorTemperatures(this), sensorTemperatures(this),
susTemperatures(this), susTemperatures(this),
deviceTemperatures(this), deviceTemperatures(this),
@ -55,8 +57,6 @@ ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater
tmp1075SetTcs0(objects::TMP1075_HANDLER_TCS_0), tmp1075SetTcs0(objects::TMP1075_HANDLER_TCS_0),
tmp1075SetTcs1(objects::TMP1075_HANDLER_TCS_1), tmp1075SetTcs1(objects::TMP1075_HANDLER_TCS_1),
tmp1075SetPlPcdu0(objects::TMP1075_HANDLER_PLPCDU_0), tmp1075SetPlPcdu0(objects::TMP1075_HANDLER_PLPCDU_0),
// damaged
// tmp1075SetPlPcdu1(objects::TMP1075_HANDLER_PLPCDU_1),
tmp1075SetIfBoard(objects::TMP1075_HANDLER_IF_BOARD), tmp1075SetIfBoard(objects::TMP1075_HANDLER_IF_BOARD),
susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF),
susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB), susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB),
@ -71,6 +71,9 @@ ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater
susSet10(objects::SUS_10_N_LOC_XMYBZF_PT_ZF), susSet10(objects::SUS_10_N_LOC_XMYBZF_PT_ZF),
susSet11(objects::SUS_11_R_LOC_XBYMZB_PT_ZB), susSet11(objects::SUS_11_R_LOC_XBYMZB_PT_ZB),
tcsBrdShortlyUnavailable(tcsBoardShortUnavailable) { tcsBrdShortlyUnavailable(tcsBoardShortUnavailable) {
if (pollPcdu1Tmp) {
tmp1075SetPlPcdu1 = new TMP1075::Tmp1075Dataset(objects::TMP1075_HANDLER_PLPCDU_1);
}
resetSensorsArray(); resetSensorsArray();
} }
@ -536,19 +539,19 @@ void ThermalController::copySensors() {
} }
} }
} }
// damaged // damaged on FM, and no dummies for now
/* if (pollPcdu1Tmp) {
{ {
PoolReadGuard pg(&tmp1075SetPlPcdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); PoolReadGuard pg(tmp1075SetPlPcdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() == returnvalue::OK) { if (pg.getReadResult() == returnvalue::OK) {
sensorTemperatures.tmp1075PlPcdu1.value = tmp1075SetPlPcdu1.temperatureCelcius.value; sensorTemperatures.tmp1075PlPcdu1.value = tmp1075SetPlPcdu1->temperatureCelcius.value;
sensorTemperatures.tmp1075PlPcdu1.setValid(tmp1075SetPlPcdu1.temperatureCelcius.isValid()); sensorTemperatures.tmp1075PlPcdu1.setValid(tmp1075SetPlPcdu1->temperatureCelcius.isValid());
if (not tmp1075SetPlPcdu1.temperatureCelcius.isValid()) { if (not tmp1075SetPlPcdu1->temperatureCelcius.isValid()) {
sensorTemperatures.tmp1075PlPcdu1.value = INVALID_TEMPERATURE; sensorTemperatures.tmp1075PlPcdu1.value = INVALID_TEMPERATURE;
}
} }
} }
} }
*/
{ {
PoolReadGuard pg(&tmp1075SetIfBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); PoolReadGuard pg(&tmp1075SetIfBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() == returnvalue::OK) { if (pg.getReadResult() == returnvalue::OK) {
@ -1828,6 +1831,12 @@ void ThermalController::heaterSwitchHelperAllOff() {
} }
} }
ThermalController::~ThermalController() {
if (tmp1075SetPlPcdu1 != nullptr) {
delete tmp1075SetPlPcdu1;
}
}
void ThermalController::tooHotHandlerWhichClearsOneShotFlag(object_id_t object, bool& oneShotFlag) { void ThermalController::tooHotHandlerWhichClearsOneShotFlag(object_id_t object, bool& oneShotFlag) {
// Clear the one shot flag is the component is in acceptable temperature range. // Clear the one shot flag is the component is in acceptable temperature range.
if (not tooHotHandler(object, oneShotFlag) and not componentAboveUpperLimit) { if (not tooHotHandler(object, oneShotFlag) and not componentAboveUpperLimit) {

View File

@ -1,7 +1,7 @@
#ifndef MISSION_CONTROLLER_THERMALCONTROLLER_H_ #ifndef MISSION_CONTROLLER_THERMALCONTROLLER_H_
#define MISSION_CONTROLLER_THERMALCONTROLLER_H_ #define MISSION_CONTROLLER_THERMALCONTROLLER_H_
#include <bsp_q7s/core/CoreDefinitions.h> #include <bsp_q7s/core/defs.h>
#include <fsfw/controller/ExtendedControllerBase.h> #include <fsfw/controller/ExtendedControllerBase.h>
#include <fsfw/devicehandlers/DeviceHandlerThermalSet.h> #include <fsfw/devicehandlers/DeviceHandlerThermalSet.h>
#include <fsfw/timemanager/Countdown.h> #include <fsfw/timemanager/Countdown.h>
@ -103,7 +103,8 @@ class ThermalController : public ExtendedControllerBase {
static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160; static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160;
ThermalController(object_id_t objectId, HeaterHandler& heater, ThermalController(object_id_t objectId, HeaterHandler& heater,
const std::atomic_bool& tcsBoardShortUnavailable); const std::atomic_bool& tcsBoardShortUnavailable, bool pollPcdu1Tmp);
virtual ~ThermalController();
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
@ -142,6 +143,7 @@ class ThermalController : public ExtendedControllerBase {
HeaterHandler& heaterHandler; HeaterHandler& heaterHandler;
bool pollPcdu1Tmp;
tcsCtrl::SensorTemperatures sensorTemperatures; tcsCtrl::SensorTemperatures sensorTemperatures;
tcsCtrl::SusTemperatures susTemperatures; tcsCtrl::SusTemperatures susTemperatures;
tcsCtrl::DeviceTemperatures deviceTemperatures; tcsCtrl::DeviceTemperatures deviceTemperatures;
@ -173,7 +175,7 @@ class ThermalController : public ExtendedControllerBase {
TMP1075::Tmp1075Dataset tmp1075SetTcs1; TMP1075::Tmp1075Dataset tmp1075SetTcs1;
TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0; TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0;
// damaged // damaged
// TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1; TMP1075::Tmp1075Dataset* tmp1075SetPlPcdu1;
TMP1075::Tmp1075Dataset tmp1075SetIfBoard; TMP1075::Tmp1075Dataset tmp1075SetIfBoard;
// SUS // SUS

View File

@ -311,9 +311,9 @@ void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF&
heaterHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); heaterHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
} }
void ObjectFactory::createThermalController(HeaterHandler& heaterHandler) { void ObjectFactory::createThermalController(HeaterHandler& heaterHandler, bool pollPlPcduTmp1) {
auto* tcsCtrl = new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler, auto* tcsCtrl = new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler,
tcs::TCS_BOARD_SHORTLY_UNAVAILABLE); tcs::TCS_BOARD_SHORTLY_UNAVAILABLE, pollPlPcduTmp1);
tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
} }
void ObjectFactory::createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch, void ObjectFactory::createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,

View File

@ -50,7 +50,7 @@ void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel,
void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher,
HeaterHandler*& heaterHandler); HeaterHandler*& heaterHandler);
void createThermalController(HeaterHandler& heaterHandler); void createThermalController(HeaterHandler& heaterHandler, bool pollPlPcduTmp1);
void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch, void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
std::array<DeviceHandlerBase*, 4> rws, std::array<object_id_t, 4> rwIds); std::array<DeviceHandlerBase*, 4> rws, std::array<object_id_t, 4> rwIds);
void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array<DeviceHandlerBase*, 12> suses); void createSusAssy(PowerSwitchIF& pwrSwitcher, std::array<DeviceHandlerBase*, 12> suses);

View File

@ -39,56 +39,67 @@ ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) {
// I don't think this needs to be in a PST because linux takes care of bus serialization, but // I don't think this needs to be in a PST because linux takes care of bus serialization, but
// keep it like this for now, it works // keep it like this for now, it works
ReturnValue_t pst::pstI2cProcessingSystem(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstI2c(TmpSchedConfig schedConf, FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle // Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length); static_cast<void>(length);
// These are actually part of another bus, but this works, so keep it like this for now if (schedConf.scheduleTmpDev0) {
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2, thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.3, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.3, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::GET_READ);
}
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, if (schedConf.scheduleTmpDev1) {
DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.2,
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.2,
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.3, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.3, DeviceHandlerIF::GET_READ);
}
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6, if (schedConf.schedulePlPcduDev0) {
DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6, DeviceHandlerIF::PERFORM_OPERATION);
DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6, DeviceHandlerIF::SEND_WRITE);
DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7, DeviceHandlerIF::GET_WRITE);
DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.5,
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7, DeviceHandlerIF::GET_READ); DeviceHandlerIF::SEND_READ);
// damaged thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.5,
/* DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, }
DeviceHandlerIF::PERFORM_OPERATION); if (schedConf.schedulePlPcduDev1) {
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::SEND_READ); DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.7,
*/ DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8, thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.7,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8, }
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8, if (schedConf.scheduleIfBoardDev) {
DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9, DeviceHandlerIF::GET_READ); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.9,
DeviceHandlerIF::GET_READ);
}
static_cast<void>(length); static_cast<void>(length);
return thisSequence->checkSequence(); return thisSequence->checkSequence();
} }

View File

@ -39,6 +39,16 @@ struct AcsPstCfg {
bool scheduleStr = true; bool scheduleStr = true;
}; };
// Default config is for FM.
struct TmpSchedConfig {
bool scheduleTmpDev0 = true;
bool scheduleTmpDev1 = true;
bool schedulePlPcduDev0 = true;
// damaged on FM
bool schedulePlPcduDev1 = false;
bool scheduleIfBoardDev = true;
};
/** /**
* @brief This function creates the PST for all gomspace devices. * @brief This function creates the PST for all gomspace devices.
* @details * @details
@ -51,7 +61,7 @@ ReturnValue_t pstSyrlinks(FixedTimeslotTaskIF* thisSequence);
ReturnValue_t pstTcsAndAcs(FixedTimeslotTaskIF* thisSequence, AcsPstCfg cfg); ReturnValue_t pstTcsAndAcs(FixedTimeslotTaskIF* thisSequence, AcsPstCfg cfg);
ReturnValue_t pstI2cProcessingSystem(FixedTimeslotTaskIF* thisSequence); ReturnValue_t pstI2c(TmpSchedConfig schedConf, FixedTimeslotTaskIF* thisSequence);
/** /**
* Generic test PST * Generic test PST

View File

@ -28,7 +28,7 @@ ReturnValue_t TmpDevFdir::eventReceived(EventMessage* event) {
case DeviceHandlerIF::DEVICE_UNKNOWN_REPLY: // Some DH's generate generic reply-ids. case DeviceHandlerIF::DEVICE_UNKNOWN_REPLY: // Some DH's generate generic reply-ids.
case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED: case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED:
// These faults all mean that there were stupid replies from a device. // 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. // With no way to do a recovery, set the device to faulty instead of trying a recovery.
meggert marked this conversation as resolved Outdated

Now way you did this

Now way you did this

now way someone is actually reading the comments

now way someone is actually reading the comments
if (strangeReplyCount.incrementAndCheck()) { if (strangeReplyCount.incrementAndCheck()) {
setFaulty(event->getEvent()); setFaulty(event->getEvent());
} }

View File

@ -1,5 +1,5 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include <OBSWConfig.h> #include <OBSWConfig.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include <mission/tcs/Tmp1075Definitions.h> #include <mission/tcs/Tmp1075Definitions.h>
#include <mission/tcs/Tmp1075Handler.h> #include <mission/tcs/Tmp1075Handler.h>
@ -12,11 +12,7 @@ Tmp1075Handler::Tmp1075Handler(object_id_t objectId, object_id_t comIF, CookieIF
Tmp1075Handler::~Tmp1075Handler() {} Tmp1075Handler::~Tmp1075Handler() {}
void Tmp1075Handler::doStartUp() { void Tmp1075Handler::doStartUp() { setMode(MODE_ON); }
if (getMode() == _MODE_START_UP) {
setMode(MODE_ON);
}
}
void Tmp1075Handler::doShutDown() { void Tmp1075Handler::doShutDown() {
communicationStep = CommunicationStep::START_ADC_CONVERSION; communicationStep = CommunicationStep::START_ADC_CONVERSION;

2
tmtc

@ -1 +1 @@
Subproject commit 18304c31fa423b1af6ff47764d4be81c7f20c8f2 Subproject commit c48f04eed5152f319b217870292968fb67b763d4

View File

@ -30,7 +30,8 @@ TEST_CASE("Thermal Controller", "[ThermalController]") {
// testEnvironment::initialize(); // testEnvironment::initialize();
ThermalController controller(THERMAL_CONTROLLER_ID, *heaterHandler, tcsBrdShortlyUnavailable); ThermalController controller(THERMAL_CONTROLLER_ID, *heaterHandler, tcsBrdShortlyUnavailable,
true);
ReturnValue_t result = controller.initialize(); ReturnValue_t result = controller.initialize();
REQUIRE(result == returnvalue::OK); REQUIRE(result == returnvalue::OK);