2021-01-08 09:34:43 +01:00
|
|
|
#include "ThermalController.h"
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2022-02-14 13:49:12 +01:00
|
|
|
ThermalController::ThermalController(object_id_t objectId, object_id_t parentId)
|
|
|
|
: ExtendedControllerBase(objectId, parentId),
|
|
|
|
sensorTemperatures(this),
|
|
|
|
componentTemperatures(this) {}
|
2021-01-08 09:34:43 +01:00
|
|
|
|
2022-02-17 16:29:22 +01:00
|
|
|
ReturnValue_t ThermalController::initialize() { return ControllerBase::initialize(); }
|
2022-02-10 18:54:09 +01:00
|
|
|
|
|
|
|
ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) {
|
|
|
|
return RETURN_FAILED;
|
|
|
|
}
|
2022-02-14 13:49:12 +01:00
|
|
|
void ThermalController::performControlOperation() {
|
|
|
|
ReturnValue_t result = sensorTemperatures.read();
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
result = componentTemperatures.read();
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
componentTemperatures.rw = (sensorTemperatures.rw.value + sensorTemperatures.gps.value) / 2;
|
|
|
|
|
|
|
|
sensorTemperatures.commit();
|
|
|
|
componentTemperatures.commit();
|
|
|
|
}
|
|
|
|
|
2022-02-10 18:54:09 +01:00
|
|
|
ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
|
|
|
LocalDataPoolManager& poolManager) {
|
2022-02-14 13:49:12 +01:00
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_RW, new PoolEntry<float>({0.0}));
|
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_GPS, new PoolEntry<float>({0.0}));
|
|
|
|
localDataPoolMap.emplace(thermalControllerDefinitions::COMPONENT_RW, new PoolEntry<float>({0.0}));
|
|
|
|
|
2022-02-10 18:54:09 +01:00
|
|
|
return RETURN_OK;
|
|
|
|
}
|
|
|
|
LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) { return nullptr; }
|
|
|
|
|
|
|
|
ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode,
|
|
|
|
uint32_t* msToReachTheMode) {
|
2022-02-14 13:49:12 +01:00
|
|
|
if (submode != SUBMODE_NONE) {
|
|
|
|
return INVALID_SUBMODE;
|
|
|
|
}
|
|
|
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
|
|
|
return INVALID_MODE;
|
|
|
|
}
|
|
|
|
return RETURN_OK;
|
2022-02-10 18:29:28 +01:00
|
|
|
}
|