Merge branch 'tcs-heater-upper-limit' into tcs-observability
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-07-10 14:58:16 +02:00
commit a61d7901bf
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
10 changed files with 54 additions and 28 deletions

View File

@ -24,6 +24,8 @@ will consitute of a breaking change warranting a new major release:
runtime now. This makes it possible to check the firmware version earlier. runtime now. This makes it possible to check the firmware version earlier.
- The TCS controller will now always command heaters OFF when being blind for thermal - The TCS controller will now always command heaters OFF when being blind for thermal
components (no sensors available), irrespective of current switch state. components (no sensors available), irrespective of current switch state.
- Make OBSW compatible to prospective FW version v5.0.0, where the Q7 I2C devices were
moved to a PL I2C block and the TMP sensor devices were moved to the PS I2C0.
## Fixed ## Fixed

View File

@ -12,6 +12,9 @@ static constexpr char SPI_RW_DEV[] = "/dev/spi_rw";
static constexpr char I2C_PL_EIVE[] = "/dev/i2c_pl"; static constexpr char I2C_PL_EIVE[] = "/dev/i2c_pl";
//! I2C bus using the I2C peripheral of the ARM processing system (PS) //! I2C bus using the I2C peripheral of the ARM processing system (PS)
static constexpr char I2C_PS_EIVE[] = "/dev/i2c_ps"; static constexpr char I2C_PS_EIVE[] = "/dev/i2c_ps";
//! I2C bus using the first I2C peripheral of the ARM processing system (PS).
//! Named like this because it is used by default for the Q7 devices.
static constexpr char I2C_Q7_EIVE[] = "/dev/i2c_q7";
static constexpr char UART_GNSS_DEV[] = "/dev/gps0"; static constexpr char UART_GNSS_DEV[] = "/dev/gps0";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc";

View File

@ -68,11 +68,7 @@ void ObjectFactory::produce(void* args) {
{objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}}; }};
const char* tmpI2cDev = q7s::I2C_PS_EIVE; createTmpComponents(tmpDevsToAdd);
if (core::FW_VERSION_MAJOR >= 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
dummy::Tmp1075Cfg tmpCfg{}; dummy::Tmp1075Cfg tmpCfg{};
tmpCfg.addTcsBrd0 = true; tmpCfg.addTcsBrd0 = true;
tmpCfg.addTcsBrd1 = true; tmpCfg.addTcsBrd1 = true;

View File

@ -77,11 +77,8 @@ void ObjectFactory::produce(void* args) {
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, // {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}}; }};
const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR >= 4) { createTmpComponents(tmpDevsToAdd);
tmpI2cDev = q7s::I2C_PL_EIVE;
}
createTmpComponents(tmpDevsToAdd, tmpI2cDev);
#endif #endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF); createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);

View File

@ -161,13 +161,19 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
void ObjectFactory::createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd, void ObjectFactory::createTmpComponents(
const char* i2cDev) { std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd) {
const char* tmpI2cDev = q7s::I2C_PS_EIVE;
if (core::FW_VERSION_MAJOR == 4) {
tmpI2cDev = q7s::I2C_PL_EIVE;
} else if (core::FW_VERSION_MAJOR >= 5) {
tmpI2cDev = q7s::I2C_Q7_EIVE;
}
std::vector<I2cCookie*> tmpDevCookies; std::vector<I2cCookie*> tmpDevCookies;
for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) { for (size_t idx = 0; idx < tmpDevsToAdd.size(); idx++) {
tmpDevCookies.push_back( tmpDevCookies.push_back(
new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, i2cDev)); new I2cCookie(tmpDevsToAdd[idx].second, TMP1075::MAX_REPLY_LENGTH, tmpI2cDev));
auto* tmpDevHandler = auto* tmpDevHandler =
new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); new Tmp1075Handler(tmpDevsToAdd[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]);
tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first)); tmpDevHandler->setCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first));

View File

@ -58,8 +58,7 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
bool enableHkSets); bool enableHkSets);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler); PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd, void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd);
const char* i2cDev);
void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF); void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF);
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler); ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
void createAcsBoardGpios(GpioCookie& cookie); void createAcsBoardGpios(GpioCookie& cookie);

View File

@ -15,7 +15,7 @@ TemperatureSensorInserter::TemperatureSensorInserter(
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {} tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
ReturnValue_t TemperatureSensorInserter::initialize() { ReturnValue_t TemperatureSensorInserter::initialize() {
testCase = TestCase::NONE; testCase = TestCase::COLD_CAMERA_STAYS_COLD;
return returnvalue::OK; return returnvalue::OK;
} }
@ -126,6 +126,21 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
sif::debug << "Setting CAM temperature back to normal" << std::endl; sif::debug << "Setting CAM temperature back to normal" << std::endl;
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(0, true); max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(0, true);
} }
break;
}
case (TestCase::COLD_PLOC_STAYS_COLD): {
if (cycles == 15) {
sif::debug << "Setting cold PLOC temperature" << std::endl;
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(-40, true);
}
break;
}
case (TestCase::COLD_CAMERA_STAYS_COLD): {
if (cycles == 15) {
sif::debug << "Setting cold PLOC temperature" << std::endl;
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(-40, true);
}
break;
} }
} }
cycles++; cycles++;

View File

@ -33,6 +33,8 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
COLD_STR_CONSECUTIVE = 5, COLD_STR_CONSECUTIVE = 5,
COLD_CAMERA = 6, COLD_CAMERA = 6,
COLD_PLOC_CONSECUTIVE = 7, COLD_PLOC_CONSECUTIVE = 7,
COLD_PLOC_STAYS_COLD = 8,
COLD_CAMERA_STAYS_COLD = 9
}; };
int iteration = 0; int iteration = 0;
uint32_t cycles = 0; uint32_t cycles = 0;

View File

@ -1814,14 +1814,13 @@ void ThermalController::heaterMaxDurationControl(
heaterStates[i].switchTransition = false; heaterStates[i].switchTransition = false;
heaterStates[i].heaterSwitchControlCycles = 0; heaterStates[i].heaterSwitchControlCycles = 0;
heaterStates[i].trackHeaterMaxBurnTime = false; heaterStates[i].trackHeaterMaxBurnTime = false;
heaterHandler.switchHeater(static_cast<heater::Switch>(i), heater::SwitchState::OFF);
triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i), triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i),
MAX_HEATER_ON_DURATIONS_MS[i]); MAX_HEATER_ON_DURATIONS_MS[i]);
heaterSwitchHelper(static_cast<heater::Switch>(i), heater::SwitchState::OFF,
std::nullopt);
// The heater might still be one for some thermal components, so cross-check // The heater might still be one for some thermal components, so cross-check
// those components // those components
crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i)); crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i));
} else if (currentHeaterStates[i] == heater::SwitchState::OFF) {
heaterStates[i].heaterOnMaxBurnTime.resetTimer();
} }
} }
} }
@ -1868,24 +1867,30 @@ void ThermalController::resetThermalStates() {
} }
} }
void ThermalController::heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState targetState, void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
unsigned componentIdx) { heater::SwitchState targetState,
std::optional<unsigned> componentIdx) {
timeval currentTime; timeval currentTime;
Clock::getClockMonotonic(&currentTime); Clock::getClockMonotonic(&currentTime);
if (targetState == heater::SwitchState::ON) { if (targetState == heater::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, targetState); heaterHandler.switchHeater(switchNr, targetState);
heaterStates[switchNr].target = heater::SwitchState::ON; heaterStates[switchNr].target = heater::SwitchState::ON;
heaterStates[switchNr].switchTransition = true; heaterStates[switchNr].switchTransition = true;
thermalStates[componentIdx].sensorIndex = ctrlCtx.currentSensorIndex; if (componentIdx.has_value()) {
thermalStates[componentIdx].heaterSwitch = switchNr; unsigned componentIdxVal = componentIdx.value();
thermalStates[componentIdx].heating = true; thermalStates[componentIdxVal].sensorIndex = ctrlCtx.currentSensorIndex;
thermalStates[componentIdx].heaterStartTime = currentTime.tv_sec; thermalStates[componentIdxVal].heaterSwitch = switchNr;
thermalStates[componentIdxVal].heating = true;
thermalStates[componentIdxVal].heaterStartTime = currentTime.tv_sec;
}
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(ctrlCtx.thermalComponent), triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(ctrlCtx.thermalComponent),
static_cast<uint32_t>(switchNr)); static_cast<uint32_t>(switchNr));
} else { } else {
heaterHandler.switchHeater(switchNr, targetState); heaterHandler.switchHeater(switchNr, targetState);
thermalStates[componentIdx].heating = false; if (componentIdx.has_value()) {
thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec; thermalStates[componentIdx.value()].heating = false;
thermalStates[componentIdx.value()].heaterEndTime = currentTime.tv_sec;
}
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(ctrlCtx.thermalComponent), triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(ctrlCtx.thermalComponent),
static_cast<uint32_t>(switchNr)); static_cast<uint32_t>(switchNr));
} }

View File

@ -24,6 +24,7 @@
#include <atomic> #include <atomic>
#include <list> #include <list>
#include <optional>
class ThermalController : public ExtendedControllerBase { class ThermalController : public ExtendedControllerBase {
public: public:
@ -288,7 +289,7 @@ class ThermalController : public ExtendedControllerBase {
void heaterSwitchHelperAllOff(); void heaterSwitchHelperAllOff();
void heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState state, void heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState state,
unsigned componentIdx); std::optional<unsigned> componentIdx);
void ctrlAcsBoard(); void ctrlAcsBoard();
void ctrlMgt(); void ctrlMgt();