some more fixes so heater info works
This commit is contained in:
parent
3ffdcf3885
commit
582c8e8eff
@ -113,11 +113,16 @@ void ThermalController::performControlOperation() {
|
|||||||
deviceTemperatures.commit();
|
deviceTemperatures.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::array<HeaterHandler::SwitchState, 8> heaterStates;
|
||||||
|
heaterHandler.getAllSwitchStates(heaterStates);
|
||||||
{
|
{
|
||||||
PoolReadGuard pg(&heaterInfo);
|
PoolReadGuard pg(&heaterInfo);
|
||||||
PoolReadGuard pg2(¤tVecPdu2);
|
std::memcpy(heaterInfo.heaterSwitchState.value, heaterStates.data(), 8);
|
||||||
if (pg.getReadResult() == returnvalue::OK and pg2.getReadResult() == returnvalue::OK) {
|
{
|
||||||
heaterInfo.heaterCurrent.value = currentVecPdu2.value[PDU2::Channels::TCS_HEATER_IN];
|
PoolReadGuard pg2(¤tVecPdu2);
|
||||||
|
if (pg.getReadResult() == returnvalue::OK and pg2.getReadResult() == returnvalue::OK) {
|
||||||
|
heaterInfo.heaterCurrent.value = currentVecPdu2.value[PDU2::Channels::TCS_HEATER_IN];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class SusTemperatures : public StaticLocalDataSet<ENTRIES_SUS_TEMPERATURE_SET> {
|
|||||||
lp_var_t<float>(sid.objectId, PoolIds::SUS_11_R_LOC_XBYMZB_PT_ZB, this);
|
lp_var_t<float>(sid.objectId, PoolIds::SUS_11_R_LOC_XBYMZB_PT_ZB, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
class HeaterInfo : public StaticLocalDataSet<12> {
|
class HeaterInfo : public StaticLocalDataSet<3> {
|
||||||
public:
|
public:
|
||||||
HeaterInfo(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HEATER_SET) {}
|
HeaterInfo(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HEATER_SET) {}
|
||||||
HeaterInfo(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HEATER_SET)) {}
|
HeaterInfo(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HEATER_SET)) {}
|
||||||
|
@ -361,13 +361,8 @@ ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, SwitchState
|
|||||||
void HeaterHandler::announceMode(bool recursive) {
|
void HeaterHandler::announceMode(bool recursive) {
|
||||||
triggerEvent(MODE_INFO, mode, submode);
|
triggerEvent(MODE_INFO, mode, submode);
|
||||||
|
|
||||||
SwitchState states[helper.heaters.size()];
|
std::array<SwitchState, 8> states;
|
||||||
{
|
getAllSwitchStates(states);
|
||||||
MutexGuard mg(heaterHealthAndStateMutex);
|
|
||||||
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
|
||||||
states[idx] = heaterVec[idx].switchState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
||||||
if (states[idx] == ON) {
|
if (states[idx] == ON) {
|
||||||
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_ON, 0);
|
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_ON, 0);
|
||||||
@ -398,6 +393,19 @@ ModeTreeChildIF& HeaterHandler::getModeTreeChildIF() { return *this; }
|
|||||||
|
|
||||||
object_id_t HeaterHandler::getObjectId() const { return SystemObject::getObjectId(); }
|
object_id_t HeaterHandler::getObjectId() const { return SystemObject::getObjectId(); }
|
||||||
|
|
||||||
|
ReturnValue_t HeaterHandler::getAllSwitchStates(std::array<SwitchState, 8>& statesBuf) {
|
||||||
|
{
|
||||||
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
||||||
|
statesBuf[idx] = heaterVec[idx].switchState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
|
||||||
bool HeaterHandler::allSwitchesOff() {
|
bool HeaterHandler::allSwitchesOff() {
|
||||||
bool allSwitchesOrd = false;
|
bool allSwitchesOrd = false;
|
||||||
MutexGuard mg(heaterHealthAndStateMutex);
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
|
@ -59,6 +59,7 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
static const ReturnValue_t COMMAND_ALREADY_WAITING = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t COMMAND_ALREADY_WAITING = MAKE_RETURN_CODE(0xA5);
|
||||||
|
|
||||||
enum CmdSourceParam : uint8_t { INTERNAL = 0, EXTERNAL = 1 };
|
enum CmdSourceParam : uint8_t { INTERNAL = 0, EXTERNAL = 1 };
|
||||||
|
enum SwitchState : uint8_t { ON = 1, OFF = 0 };
|
||||||
|
|
||||||
/** Device command IDs */
|
/** Device command IDs */
|
||||||
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
||||||
@ -67,11 +68,11 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
PowerSwitchIF* mainLineSwitcherObjectId, power::Switch_t mainLineSwitch);
|
PowerSwitchIF* mainLineSwitcherObjectId, power::Switch_t mainLineSwitch);
|
||||||
|
|
||||||
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
|
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF& parent) override;
|
||||||
|
ReturnValue_t getAllSwitchStates(std::array<SwitchState, 8>& statesBuf);
|
||||||
|
|
||||||
virtual ~HeaterHandler();
|
virtual ~HeaterHandler();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum SwitchState : bool { ON = true, OFF = false };
|
|
||||||
enum SwitchAction : uint8_t { SET_SWITCH_OFF, SET_SWITCH_ON, NONE };
|
enum SwitchAction : uint8_t { SET_SWITCH_OFF, SET_SWITCH_ON, NONE };
|
||||||
|
|
||||||
ReturnValue_t switchHeater(heater::Switchers heater, SwitchState switchState);
|
ReturnValue_t switchHeater(heater::Switchers heater, SwitchState switchState);
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit d1f96cb83d287ea6f7714631fa944eb2c7fe17b8
|
Subproject commit 5f082cd9fccdaa304f00d92c1f25cdd6a7d8ed0b
|
Loading…
Reference in New Issue
Block a user