add more mode support for heaters
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
1e0c94246d
commit
7f74cca11f
@ -17,13 +17,17 @@ change warranting a new major release:
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added new heater info set for the TCS controller. This set contains the heater switch states
|
- Added new heater info set for the TCS controller. This set contains the heater switch states
|
||||||
and the current draw.
|
and the current draw.
|
||||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/351
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/351
|
||||||
=======
|
- The HeaterHandler now exposes a mode which reflects whether the heater power
|
||||||
|
is on or off. It also triggers mode events for its heater children objects
|
||||||
|
which show whether the specific heaters are on or off. The heater handler
|
||||||
|
will be part of the TCS tree.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/351
|
||||||
|
|
||||||
# [v1.28.0] 2023-02-17
|
# [v1.28.0] 2023-02-17
|
||||||
|
|
||||||
eive-tmtc: v2.12.7
|
eive-tmtc: v2.12.7
|
||||||
|
@ -22,7 +22,7 @@ ThermalController::ThermalController(object_id_t objectId, HeaterHandler& heater
|
|||||||
susTemperatures(this),
|
susTemperatures(this),
|
||||||
deviceTemperatures(this),
|
deviceTemperatures(this),
|
||||||
heaterInfo(this),
|
heaterInfo(this),
|
||||||
imtqThermalSet(objects::IMTQ_HANDLER),
|
imtqThermalSet(objects::IMTQ_HANDLER, ThermalStateCfg()),
|
||||||
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER,
|
max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER,
|
||||||
EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
EiveMax31855::RtdCommands::EXCHANGE_SET_ID),
|
||||||
max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
|
max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD,
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
||||||
|
|
||||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
|
||||||
#include "mission/devices/HeaterHandler.h"
|
|
||||||
#include "mission/trace.h"
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
#include "mission/devices/HeaterHandler.h"
|
||||||
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
|
#include "mission/trace.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
|
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
|
||||||
* is exceeded.
|
* is exceeded.
|
||||||
|
@ -8,11 +8,13 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "devices/powerSwitcherList.h"
|
#include "devices/powerSwitcherList.h"
|
||||||
|
#include "fsfw/subsystem/helper.h"
|
||||||
|
|
||||||
HeaterHandler::HeaterHandler(object_id_t setObjectId_, GpioIF* gpioInterface_, HeaterHelper helper,
|
HeaterHandler::HeaterHandler(object_id_t setObjectId_, GpioIF* gpioInterface_, HeaterHelper helper,
|
||||||
PowerSwitchIF* mainLineSwitcher_, power::Switch_t mainLineSwitch_)
|
PowerSwitchIF* mainLineSwitcher_, power::Switch_t mainLineSwitch_)
|
||||||
: SystemObject(setObjectId_),
|
: SystemObject(setObjectId_),
|
||||||
helper(helper),
|
helper(helper),
|
||||||
|
modeHelper(this),
|
||||||
gpioInterface(gpioInterface_),
|
gpioInterface(gpioInterface_),
|
||||||
mainLineSwitcher(mainLineSwitcher_),
|
mainLineSwitcher(mainLineSwitcher_),
|
||||||
mainLineSwitch(mainLineSwitch_),
|
mainLineSwitch(mainLineSwitch_),
|
||||||
@ -46,6 +48,12 @@ ReturnValue_t HeaterHandler::performOperation(uint8_t operationCode) {
|
|||||||
heater.first->performOperation(0);
|
heater.first->performOperation(0);
|
||||||
}
|
}
|
||||||
handleSwitchHandling();
|
handleSwitchHandling();
|
||||||
|
if (waitForSwitchOff) {
|
||||||
|
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == SWITCH_OFF) {
|
||||||
|
waitForSwitchOff = false;
|
||||||
|
mode = MODE_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (const std::out_of_range& e) {
|
} catch (const std::out_of_range& e) {
|
||||||
sif::warning << "HeaterHandler::performOperation: "
|
sif::warning << "HeaterHandler::performOperation: "
|
||||||
"Out of range error | "
|
"Out of range error | "
|
||||||
@ -76,6 +84,10 @@ ReturnValue_t HeaterHandler::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = modeHelper.initialize();
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +230,9 @@ void HeaterHandler::handleSwitchHandling() {
|
|||||||
void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
auto& heater = heaterVec.at(heaterIdx);
|
auto& heater = heaterVec.at(heaterIdx);
|
||||||
|
if (waitForSwitchOff) {
|
||||||
|
waitForSwitchOff = false;
|
||||||
|
}
|
||||||
/* Check if command waits for main switch being set on and whether the timeout has expired */
|
/* Check if command waits for main switch being set on and whether the timeout has expired */
|
||||||
if (heater.waitMainSwitchOn && heater.mainSwitchCountdown.hasTimedOut()) {
|
if (heater.waitMainSwitchOn && heater.mainSwitchCountdown.hasTimedOut()) {
|
||||||
// TODO - This requires the initiation of an FDIR procedure
|
// TODO - This requires the initiation of an FDIR procedure
|
||||||
@ -235,6 +250,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
// Check state of main line switch
|
// Check state of main line switch
|
||||||
ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch);
|
ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch);
|
||||||
if (mainSwitchState == PowerSwitchIF::SWITCH_ON) {
|
if (mainSwitchState == PowerSwitchIF::SWITCH_ON) {
|
||||||
|
mode = HasModesIF::MODE_ON;
|
||||||
if (checkSwitchState(heaterIdx) == SwitchState::OFF) {
|
if (checkSwitchState(heaterIdx) == SwitchState::OFF) {
|
||||||
gpioId_t gpioId = heater.gpioId;
|
gpioId_t gpioId = heater.gpioId;
|
||||||
result = gpioInterface->pullHigh(gpioId);
|
result = gpioInterface->pullHigh(gpioId);
|
||||||
@ -298,6 +314,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) {
|
|||||||
// When all switches are off, also main line switch will be turned off
|
// When all switches are off, also main line switch will be turned off
|
||||||
if (allSwitchesOff()) {
|
if (allSwitchesOff()) {
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
|
waitForSwitchOff = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -329,6 +346,38 @@ ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, SwitchState
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HeaterHandler::announceMode(bool recursive) {
|
||||||
|
triggerEvent(MODE_INFO, mode, submode);
|
||||||
|
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
||||||
|
if (heaterVec[idx].switchState == SWITCH_ON) {
|
||||||
|
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_ON, 0);
|
||||||
|
} else {
|
||||||
|
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_OFF,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeaterHandler::getMode(Mode_t* mode, Submode_t* submode) {
|
||||||
|
if (!mode || !submode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*mode = this->mode;
|
||||||
|
*submode = this->submode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HasHealthIF* HeaterHandler::getOptHealthIF() const { return nullptr; }
|
||||||
|
|
||||||
|
const HasModesIF& HeaterHandler::getModeIF() const { return *this; }
|
||||||
|
|
||||||
|
ReturnValue_t HeaterHandler::connectModeTreeParent(HasModeTreeChildrenIF& parent) {
|
||||||
|
return modetree::connectModeTreeParent(parent, *this, nullptr, modeHelper);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModeTreeChildIF& HeaterHandler::getModeTreeChildIF() { return *this; }
|
||||||
|
|
||||||
|
object_id_t HeaterHandler::getObjectId() const { return SystemObject::getObjectId(); }
|
||||||
|
|
||||||
bool HeaterHandler::allSwitchesOff() {
|
bool HeaterHandler::allSwitchesOff() {
|
||||||
bool allSwitchesOrd = false;
|
bool allSwitchesOrd = false;
|
||||||
MutexGuard mg(heaterMutex);
|
MutexGuard mg(heaterMutex);
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/power/PowerSwitchIF.h>
|
#include <fsfw/power/PowerSwitchIF.h>
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
#include <fsfw/subsystem/ModeTreeChildIF.h>
|
||||||
|
#include <fsfw/subsystem/ModeTreeConnectionIF.h>
|
||||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||||
#include <fsfw/timemanager/Countdown.h>
|
#include <fsfw/timemanager/Countdown.h>
|
||||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
@ -40,6 +42,9 @@ struct HeaterHelper {
|
|||||||
*/
|
*/
|
||||||
class HeaterHandler : public ExecutableObjectIF,
|
class HeaterHandler : public ExecutableObjectIF,
|
||||||
public PowerSwitchIF,
|
public PowerSwitchIF,
|
||||||
|
public HasModesIF,
|
||||||
|
public ModeTreeChildIF,
|
||||||
|
public ModeTreeConnectionIF,
|
||||||
public SystemObject,
|
public SystemObject,
|
||||||
public HasActionsIF {
|
public HasActionsIF {
|
||||||
friend class ThermalController;
|
friend class ThermalController;
|
||||||
@ -131,9 +136,11 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
MutexIF* heaterMutex = nullptr;
|
MutexIF* heaterMutex = nullptr;
|
||||||
|
|
||||||
HeaterHelper helper;
|
HeaterHelper helper;
|
||||||
|
ModeHelper modeHelper;
|
||||||
|
|
||||||
/** Size of command queue */
|
/** Size of command queue */
|
||||||
size_t cmdQueueSize = 20;
|
size_t cmdQueueSize = 20;
|
||||||
|
bool waitForSwitchOff = true;
|
||||||
|
|
||||||
GpioIF* gpioInterface = nullptr;
|
GpioIF* gpioInterface = nullptr;
|
||||||
|
|
||||||
@ -152,6 +159,9 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
|
|
||||||
StorageManagerIF* ipcStore = nullptr;
|
StorageManagerIF* ipcStore = nullptr;
|
||||||
|
|
||||||
|
Mode_t mode = HasModesIF::MODE_OFF;
|
||||||
|
Submode_t submode = 0;
|
||||||
|
|
||||||
void readCommandQueue();
|
void readCommandQueue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,6 +182,17 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
*/
|
*/
|
||||||
void setInitialSwitchStates();
|
void setInitialSwitchStates();
|
||||||
|
|
||||||
|
// HasModesIF implementation
|
||||||
|
void announceMode(bool recursive) override;
|
||||||
|
void getMode(Mode_t* mode, Submode_t* submode) override;
|
||||||
|
|
||||||
|
// Mode Tree helper overrides
|
||||||
|
object_id_t getObjectId() const override;
|
||||||
|
const HasHealthIF* getOptHealthIF() const override;
|
||||||
|
const HasModesIF& getModeIF() const override;
|
||||||
|
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
|
||||||
|
ModeTreeChildIF& getModeTreeChildIF() override;
|
||||||
|
|
||||||
void handleSwitchOnCommand(heater::Switchers heaterIdx);
|
void handleSwitchOnCommand(heater::Switchers heaterIdx);
|
||||||
|
|
||||||
void handleSwitchOffCommand(heater::Switchers heaterIdx);
|
void handleSwitchOffCommand(heater::Switchers heaterIdx);
|
||||||
|
Loading…
Reference in New Issue
Block a user