Merge branch 'main' into some-more-tcs-tweaks
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
2023-07-06 19:12:01 +02:00
31 changed files with 332 additions and 172 deletions

View File

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

View File

@ -1,7 +1,7 @@
#ifndef 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/devicehandlers/DeviceHandlerThermalSet.h>
#include <fsfw/timemanager/Countdown.h>
@ -103,7 +103,8 @@ class ThermalController : public ExtendedControllerBase {
static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160;
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;
@ -142,6 +143,7 @@ class ThermalController : public ExtendedControllerBase {
HeaterHandler& heaterHandler;
bool pollPcdu1Tmp;
tcsCtrl::SensorTemperatures sensorTemperatures;
tcsCtrl::SusTemperatures susTemperatures;
tcsCtrl::DeviceTemperatures deviceTemperatures;
@ -173,7 +175,7 @@ class ThermalController : public ExtendedControllerBase {
TMP1075::Tmp1075Dataset tmp1075SetTcs1;
TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0;
// damaged
// TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1;
TMP1075::Tmp1075Dataset* tmp1075SetPlPcdu1;
TMP1075::Tmp1075Dataset tmp1075SetIfBoard;
// SUS

View File

@ -311,9 +311,9 @@ void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF&
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,
tcs::TCS_BOARD_SHORTLY_UNAVAILABLE);
tcs::TCS_BOARD_SHORTLY_UNAVAILABLE, pollPlPcduTmp1);
tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
}
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,
HeaterHandler*& heaterHandler);
void createThermalController(HeaterHandler& heaterHandler);
void createThermalController(HeaterHandler& heaterHandler, bool pollPlPcduTmp1);
void createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
std::array<DeviceHandlerBase*, 4> rws, std::array<object_id_t, 4> rwIds);
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
// 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
uint32_t length = thisSequence->getPeriodMs();
static_cast<void>(length);
// These are actually part of another bus, but this works, so keep it like this for now
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.2,
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.2, 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.3, DeviceHandlerIF::GET_READ);
if (schedConf.scheduleTmpDev0) {
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.1, DeviceHandlerIF::GET_READ);
}
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.5, DeviceHandlerIF::GET_READ);
if (schedConf.scheduleTmpDev1) {
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.2,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
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,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.6,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.7, DeviceHandlerIF::GET_READ);
// damaged
/*
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ);
*/
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
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);
if (schedConf.schedulePlPcduDev0) {
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.5,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.5,
DeviceHandlerIF::GET_READ);
}
if (schedConf.schedulePlPcduDev1) {
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.6,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.7,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.7,
DeviceHandlerIF::GET_READ);
}
if (schedConf.scheduleIfBoardDev) {
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.8,
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);
return thisSequence->checkSequence();
}

View File

@ -39,6 +39,16 @@ struct AcsPstCfg {
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.
* @details
@ -51,7 +61,7 @@ ReturnValue_t pstSyrlinks(FixedTimeslotTaskIF* thisSequence);
ReturnValue_t pstTcsAndAcs(FixedTimeslotTaskIF* thisSequence, AcsPstCfg cfg);
ReturnValue_t pstI2cProcessingSystem(FixedTimeslotTaskIF* thisSequence);
ReturnValue_t pstI2c(TmpSchedConfig schedConf, FixedTimeslotTaskIF* thisSequence);
/**
* Generic test PST

View File

@ -20,7 +20,7 @@ ReturnValue_t TmpDevFdir::eventReceived(EventMessage* event) {
// 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());
setFaulty(event->getEvent());
break;
case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED:
@ -28,8 +28,10 @@ ReturnValue_t TmpDevFdir::eventReceived(EventMessage* event) {
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());
// With no way to do a recovery, set the device to faulty instead of trying a recovery.
if (strangeReplyCount.incrementAndCheck()) {
setFaulty(event->getEvent());
}
break;
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
@ -40,7 +42,9 @@ ReturnValue_t TmpDevFdir::eventReceived(EventMessage* event) {
break;
}
// else
setFaulty(event->getEvent());
if (missedReplyCount.incrementAndCheck()) {
setFaulty(event->getEvent());
}
break;
case StorageManagerIF::GET_DATA_FAILED:
case StorageManagerIF::STORE_DATA_FAILED:

View File

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