announce mode worsk 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
a864d51ddf
commit
3ffdcf3885
@ -126,105 +126,70 @@ void ThermalController::performControlOperation() {
|
|||||||
|
|
||||||
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_HEATSPREADER,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_PLOC_HEATSPREADER, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_PLOC_MISSIONBOARD, new PoolEntry<float>({1.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLOC_MISSIONBOARD,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_4K_CAMERA, new PoolEntry<float>({2.0}));
|
||||||
new PoolEntry<float>({1.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_DAC_HEATSPREADER, new PoolEntry<float>({3.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_4K_CAMERA,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_STARTRACKER, new PoolEntry<float>({4.0}));
|
||||||
new PoolEntry<float>({2.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_RW1, new PoolEntry<float>({5.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DAC_HEATSPREADER,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_DRO, new PoolEntry<float>({6.0}));
|
||||||
new PoolEntry<float>({3.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_SCEX, new PoolEntry<float>({7.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_STARTRACKER,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_X8, new PoolEntry<float>({8.0}));
|
||||||
new PoolEntry<float>({4.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_HPA, new PoolEntry<float>({9.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_RW1, new PoolEntry<float>({5.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TX_MODUL, new PoolEntry<float>({10.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_DRO, new PoolEntry<float>({6.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_MPA, new PoolEntry<float>({11.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_SCEX, new PoolEntry<float>({7.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_ACU, new PoolEntry<float>({12.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_X8, new PoolEntry<float>({8.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_PLPCDU_HEATSPREADER, new PoolEntry<float>({13.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_HPA, new PoolEntry<float>({9.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TCS_BOARD, new PoolEntry<float>({14.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TX_MODUL,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_MAGNETTORQUER, new PoolEntry<float>({15.0}));
|
||||||
new PoolEntry<float>({10.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TMP1075_TCS_0, &tmp1075Tcs0);
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MPA, new PoolEntry<float>({11.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TMP1075_TCS_1, &tmp1075Tcs1);
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_ACU, new PoolEntry<float>({12.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TMP1075_PLPCDU_0, &tmp1075PlPcdu0);
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_PLPCDU_HEATSPREADER,
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TMP1075_PLPCDU_1, &tmp1075PlPcdu1);
|
||||||
new PoolEntry<float>({13.0}));
|
localDataPoolMap.emplace(tcsCtrl::SENSOR_TMP1075_IF_BOARD, &tmp1075IfBrd);
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TCS_BOARD,
|
|
||||||
new PoolEntry<float>({14.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER,
|
|
||||||
new PoolEntry<float>({15.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, &tmp1075Tcs0);
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, &tmp1075Tcs1);
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_0, &tmp1075PlPcdu0);
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_1, &tmp1075PlPcdu1);
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_IF_BOARD, &tmp1075IfBrd);
|
|
||||||
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF,
|
localDataPoolMap.emplace(tcsCtrl::SUS_0_N_LOC_XFYFZM_PT_XF, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_6_R_LOC_XFYBZM_PT_XF, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_6_R_LOC_XFYBZM_PT_XF,
|
localDataPoolMap.emplace(tcsCtrl::SUS_1_N_LOC_XBYFZM_PT_XB, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_7_R_LOC_XBYBZM_PT_XB, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_1_N_LOC_XBYFZM_PT_XB,
|
localDataPoolMap.emplace(tcsCtrl::SUS_2_N_LOC_XFYBZB_PT_YB, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_8_R_LOC_XBYBZB_PT_YB, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_7_R_LOC_XBYBZM_PT_XB,
|
localDataPoolMap.emplace(tcsCtrl::SUS_3_N_LOC_XFYBZF_PT_YF, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_9_R_LOC_XBYBZB_PT_YF, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_2_N_LOC_XFYBZB_PT_YB,
|
localDataPoolMap.emplace(tcsCtrl::SUS_4_N_LOC_XMYFZF_PT_ZF, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_10_N_LOC_XMYBZF_PT_ZF, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_8_R_LOC_XBYBZB_PT_YB,
|
localDataPoolMap.emplace(tcsCtrl::SUS_5_N_LOC_XFYMZB_PT_ZB, new PoolEntry<float>({0.0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::SUS_11_R_LOC_XBYMZB_PT_ZB, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_3_N_LOC_XFYBZF_PT_YF,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_9_R_LOC_XBYBZB_PT_YF,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_4_N_LOC_XMYFZF_PT_ZF,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_10_N_LOC_XMYBZF_PT_ZF,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_5_N_LOC_XFYMZB_PT_ZB,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::SUS_11_R_LOC_XBYMZB_PT_ZB,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::COMPONENT_RW, new PoolEntry<float>({0.0}));
|
||||||
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_Q7S, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_Q7S, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_1,
|
localDataPoolMap.emplace(tcsCtrl::BATTERY_TEMP_1, new PoolEntry<int16_t>({0}));
|
||||||
new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::BATTERY_TEMP_2, new PoolEntry<int16_t>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_2,
|
localDataPoolMap.emplace(tcsCtrl::BATTERY_TEMP_3, new PoolEntry<int16_t>({0}));
|
||||||
new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::BATTERY_TEMP_4, new PoolEntry<int16_t>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_3,
|
localDataPoolMap.emplace(tcsCtrl::TEMP_RW1, new PoolEntry<int32_t>({0}));
|
||||||
new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_RW2, new PoolEntry<int32_t>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::BATTERY_TEMP_4,
|
localDataPoolMap.emplace(tcsCtrl::TEMP_RW3, new PoolEntry<int32_t>({0}));
|
||||||
new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_RW4, new PoolEntry<int32_t>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW1, new PoolEntry<int32_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_STAR_TRACKER, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW2, new PoolEntry<int32_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_SYRLINKS_POWER_AMPLIFIER, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW3, new PoolEntry<int32_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_SYRLINKS_BASEBAND_BOARD, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_RW4, new PoolEntry<int32_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_MGT, new PoolEntry<int16_t>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_STAR_TRACKER,
|
localDataPoolMap.emplace(tcsCtrl::TEMP_ACU, new PoolEntry<float>({0}));
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_PDU1, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_POWER_AMPLIFIER,
|
localDataPoolMap.emplace(tcsCtrl::TEMP_PDU2, new PoolEntry<float>({0}));
|
||||||
new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_1_P60DOCK, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_SYRLINKS_BASEBAND_BOARD,
|
localDataPoolMap.emplace(tcsCtrl::TEMP_2_P60DOCK, new PoolEntry<float>({0}));
|
||||||
new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_GYRO_0_SIDE_A, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGT, new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_GYRO_1_SIDE_A, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ACU, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_GYRO_2_SIDE_B, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU1, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_GYRO_3_SIDE_B, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU2, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_MGM_0_SIDE_A, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_1_P60DOCK, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_MGM_2_SIDE_B, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_2_P60DOCK, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(tcsCtrl::TEMP_ADC_PAYLOAD_PCDU, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_0_SIDE_A,
|
localDataPoolMap.emplace(tcsCtrl::HEATER_SWITCH_LIST, &heaterSwitchStates);
|
||||||
new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(tcsCtrl::HEATER_CURRENT, &heaterCurrent);
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_1_SIDE_A,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_2_SIDE_B,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_3_SIDE_B,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGM_0_SIDE_A,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_MGM_2_SIDE_B,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ADC_PAYLOAD_PCDU,
|
|
||||||
new PoolEntry<float>({0.0}));
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::HEATER_SWITCH_LIST, &heaterSwitchStates);
|
|
||||||
localDataPoolMap.emplace(thermalControllerDefinitions::HEATER_CURRENT, &heaterCurrent);
|
|
||||||
|
|
||||||
poolManager.subscribeForRegularPeriodicPacket(
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
subdp::RegularHkPeriodicParams(sensorTemperatures.getSid(), false, 10.0));
|
subdp::RegularHkPeriodicParams(sensorTemperatures.getSid(), false, 10.0));
|
||||||
@ -239,12 +204,14 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
|
|
||||||
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) {
|
||||||
switch (sid.ownerSetId) {
|
switch (sid.ownerSetId) {
|
||||||
case thermalControllerDefinitions::SENSOR_TEMPERATURES:
|
case tcsCtrl::SENSOR_TEMPERATURES:
|
||||||
return &sensorTemperatures;
|
return &sensorTemperatures;
|
||||||
case thermalControllerDefinitions::SUS_TEMPERATURES:
|
case tcsCtrl::SUS_TEMPERATURES:
|
||||||
return &susTemperatures;
|
return &susTemperatures;
|
||||||
case thermalControllerDefinitions::DEVICE_TEMPERATURES:
|
case tcsCtrl::DEVICE_TEMPERATURES:
|
||||||
return &deviceTemperatures;
|
return &deviceTemperatures;
|
||||||
|
case tcsCtrl::HEATER_SET:
|
||||||
|
return &heaterInfo;
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ class ThermalController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
HeaterHandler& heaterHandler;
|
HeaterHandler& heaterHandler;
|
||||||
|
|
||||||
thermalControllerDefinitions::SensorTemperatures sensorTemperatures;
|
tcsCtrl::SensorTemperatures sensorTemperatures;
|
||||||
thermalControllerDefinitions::SusTemperatures susTemperatures;
|
tcsCtrl::SusTemperatures susTemperatures;
|
||||||
thermalControllerDefinitions::DeviceTemperatures deviceTemperatures;
|
tcsCtrl::DeviceTemperatures deviceTemperatures;
|
||||||
thermalControllerDefinitions::HeaterInfo heaterInfo;
|
tcsCtrl::HeaterInfo heaterInfo;
|
||||||
lp_vec_t<int16_t, 9> currentVecPdu2 =
|
lp_vec_t<int16_t, 9> currentVecPdu2 =
|
||||||
lp_vec_t<int16_t, 9>(gp_id_t(objects::PDU2_HANDLER, PDU::pool::PDU_CURRENTS));
|
lp_vec_t<int16_t, 9>(gp_id_t(objects::PDU2_HANDLER, PDU::pool::PDU_CURRENTS));
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
#include "devices/heaterSwitcherList.h"
|
#include "devices/heaterSwitcherList.h"
|
||||||
|
|
||||||
namespace thermalControllerDefinitions {
|
namespace tcsCtrl {
|
||||||
|
|
||||||
enum SetIds : uint32_t {
|
enum SetId : uint32_t {
|
||||||
SENSOR_TEMPERATURES = 0,
|
SENSOR_TEMPERATURES = 0,
|
||||||
DEVICE_TEMPERATURES = 1,
|
DEVICE_TEMPERATURES = 1,
|
||||||
SUS_TEMPERATURES = 2,
|
SUS_TEMPERATURES = 2,
|
||||||
@ -219,6 +219,6 @@ class HeaterInfo : public StaticLocalDataSet<12> {
|
|||||||
lp_var_t<int16_t> heaterCurrent = lp_var_t<int16_t>(sid.objectId, PoolIds::HEATER_CURRENT, this);
|
lp_var_t<int16_t> heaterCurrent = lp_var_t<int16_t>(sid.objectId, PoolIds::HEATER_CURRENT, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace thermalControllerDefinitions
|
} // namespace tcsCtrl
|
||||||
|
|
||||||
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_THERMALCONTROLLERDEFINITIONS_H_ */
|
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_THERMALCONTROLLERDEFINITIONS_H_ */
|
||||||
|
@ -30,8 +30,8 @@ HeaterHandler::HeaterHandler(object_id_t setObjectId_, GpioIF* gpioInterface_, H
|
|||||||
if (mainLineSwitcher == nullptr) {
|
if (mainLineSwitcher == nullptr) {
|
||||||
throw std::invalid_argument("HeaterHandler::HeaterHandler: Invalid PowerSwitchIF");
|
throw std::invalid_argument("HeaterHandler::HeaterHandler: Invalid PowerSwitchIF");
|
||||||
}
|
}
|
||||||
heaterMutex = MutexFactory::instance()->createMutex();
|
heaterHealthAndStateMutex = MutexFactory::instance()->createMutex();
|
||||||
if (heaterMutex == nullptr) {
|
if (heaterHealthAndStateMutex == nullptr) {
|
||||||
throw std::runtime_error("HeaterHandler::HeaterHandler: Creating Mutex failed");
|
throw std::runtime_error("HeaterHandler::HeaterHandler: Creating Mutex failed");
|
||||||
}
|
}
|
||||||
auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this));
|
auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this));
|
||||||
@ -114,7 +114,7 @@ void HeaterHandler::readCommandQueue() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = modeHelper.handleModeCommand(&command);
|
result = modeHelper.handleModeCommand(&command);
|
||||||
if(result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} while (result == returnvalue::OK);
|
} while (result == returnvalue::OK);
|
||||||
@ -141,7 +141,11 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t
|
|||||||
auto action = static_cast<SwitchAction>(data[1]);
|
auto action = static_cast<SwitchAction>(data[1]);
|
||||||
// Always accepts OFF commands
|
// Always accepts OFF commands
|
||||||
if (action == SwitchAction::SET_SWITCH_ON) {
|
if (action == SwitchAction::SET_SWITCH_ON) {
|
||||||
HasHealthIF::HealthState health = heater.healthDevice->getHealth();
|
HasHealthIF::HealthState health;
|
||||||
|
{
|
||||||
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
|
health = heater.healthDevice->getHealth();
|
||||||
|
}
|
||||||
if (health == HasHealthIF::FAULTY or health == HasHealthIF::PERMANENT_FAULTY or
|
if (health == HasHealthIF::FAULTY or health == HasHealthIF::PERMANENT_FAULTY or
|
||||||
health == HasHealthIF::NEEDS_RECOVERY) {
|
health == HasHealthIF::NEEDS_RECOVERY) {
|
||||||
return HasHealthIF::OBJECT_NOT_HEALTHY;
|
return HasHealthIF::OBJECT_NOT_HEALTHY;
|
||||||
@ -264,8 +268,11 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
triggerEvent(GPIO_PULL_HIGH_FAILED, result);
|
triggerEvent(GPIO_PULL_HIGH_FAILED, result);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(HEATER_WENT_ON, heaterIdx, 0);
|
triggerEvent(HEATER_WENT_ON, heaterIdx, 0);
|
||||||
|
{
|
||||||
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
heater.switchState = ON;
|
heater.switchState = ON;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(SWITCH_ALREADY_ON, heaterIdx);
|
triggerEvent(SWITCH_ALREADY_ON, heaterIdx);
|
||||||
}
|
}
|
||||||
@ -311,10 +318,9 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) {
|
|||||||
<< " low" << std::endl;
|
<< " low" << std::endl;
|
||||||
triggerEvent(GPIO_PULL_LOW_FAILED, result);
|
triggerEvent(GPIO_PULL_LOW_FAILED, result);
|
||||||
} else {
|
} else {
|
||||||
result = heaterMutex->lockMutex();
|
{
|
||||||
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
heater.switchState = OFF;
|
heater.switchState = OFF;
|
||||||
if (result == returnvalue::OK) {
|
|
||||||
heaterMutex->unlockMutex();
|
|
||||||
}
|
}
|
||||||
triggerEvent(HEATER_WENT_OFF, heaterIdx, 0);
|
triggerEvent(HEATER_WENT_OFF, heaterIdx, 0);
|
||||||
// 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
|
||||||
@ -339,7 +345,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HeaterHandler::SwitchState HeaterHandler::checkSwitchState(heater::Switchers switchNr) const {
|
HeaterHandler::SwitchState HeaterHandler::checkSwitchState(heater::Switchers switchNr) const {
|
||||||
MutexGuard mg(heaterMutex);
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
return heaterVec.at(switchNr).switchState;
|
return heaterVec.at(switchNr).switchState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,8 +360,16 @@ 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()];
|
||||||
|
{
|
||||||
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
||||||
if (heaterVec[idx].switchState == SWITCH_ON) {
|
states[idx] = heaterVec[idx].switchState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (unsigned idx = 0; idx < helper.heaters.size(); idx++) {
|
||||||
|
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);
|
||||||
} else {
|
} else {
|
||||||
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_OFF,
|
EventManagerIF::triggerEvent(helper.heaters[idx].first->getObjectId(), MODE_INFO, MODE_OFF,
|
||||||
@ -386,7 +400,7 @@ object_id_t HeaterHandler::getObjectId() const { return SystemObject::getObjectI
|
|||||||
|
|
||||||
bool HeaterHandler::allSwitchesOff() {
|
bool HeaterHandler::allSwitchesOff() {
|
||||||
bool allSwitchesOrd = false;
|
bool allSwitchesOrd = false;
|
||||||
MutexGuard mg(heaterMutex);
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
/* Or all switches. As soon one switch is on, allSwitchesOrd will be true */
|
/* Or all switches. As soon one switch is on, allSwitchesOrd will be true */
|
||||||
for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) {
|
for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) {
|
||||||
allSwitchesOrd = allSwitchesOrd || heaterVec.at(switchNr).switchState;
|
allSwitchesOrd = allSwitchesOrd || heaterVec.at(switchNr).switchState;
|
||||||
@ -419,7 +433,7 @@ uint32_t HeaterHandler::getSwitchDelayMs(void) const { return 2000; }
|
|||||||
HasHealthIF::HealthState HeaterHandler::getHealth(heater::Switchers heater) {
|
HasHealthIF::HealthState HeaterHandler::getHealth(heater::Switchers heater) {
|
||||||
auto* healthDev = heaterVec.at(heater).healthDevice;
|
auto* healthDev = heaterVec.at(heater).healthDevice;
|
||||||
if (healthDev != nullptr) {
|
if (healthDev != nullptr) {
|
||||||
MutexGuard mg(heaterMutex);
|
MutexGuard mg(heaterHealthAndStateMutex);
|
||||||
return healthDev->getHealth();
|
return healthDev->getHealth();
|
||||||
}
|
}
|
||||||
return HasHealthIF::HealthState::FAULTY;
|
return HasHealthIF::HealthState::FAULTY;
|
||||||
|
@ -135,7 +135,7 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
|
|
||||||
HeaterMap heaterVec = {};
|
HeaterMap heaterVec = {};
|
||||||
|
|
||||||
MutexIF* heaterMutex = nullptr;
|
MutexIF* heaterHealthAndStateMutex = nullptr;
|
||||||
|
|
||||||
HeaterHelper helper;
|
HeaterHelper helper;
|
||||||
ModeHelper modeHelper;
|
ModeHelper modeHelper;
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 556060a3f3e204e7a171385d31a3ec409755c6b1
|
Subproject commit d1f96cb83d287ea6f7714631fa944eb2c7fe17b8
|
Loading…
Reference in New Issue
Block a user