Added switcher for MGT dummy #651

Merged
muellerr merged 2 commits from mgt-dummy-switcher-fix into v2.1.0-dev 2023-05-25 11:23:57 +02:00
4 changed files with 21 additions and 5 deletions

View File

@ -59,6 +59,7 @@ will consitute of a breaking change warranting a new major release:
- BPX battery handler is added for EM by default.
- ACU dummy HK sets
- IMTQ HK sets
- IMTQ dummy now handles power switch
## Fixed

View File

@ -3,11 +3,12 @@
#include <mission/acs/imtqHelpers.h>
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
bool enableHkSets)
power::Switch_t pwrSwitcher, bool enableHkSets)
: DeviceHandlerBase(objectId, comif, comCookie),
setNoTorque(this),
setWithTorque(this),
enableHkSets(enableHkSets) {}
enableHkSets(enableHkSets),
switcher(pwrSwitcher) {}
ImtqDummy::~ImtqDummy() = default;
@ -15,6 +16,15 @@ void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); }
void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t ImtqDummy::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) {
if (switcher != power::NO_SWITCH) {
*numberOfSwitches = 1;
*switches = &switcher;
return returnvalue::OK;
}
return DeviceHandlerBase::NO_SWITCH;
}
ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {

View File

@ -13,10 +13,12 @@ class ImtqDummy : public DeviceHandlerBase {
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets);
ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
power::Switch_t pwrSwitcher, bool enableHkSets);
~ImtqDummy() override;
protected:
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
imtq::HkDatasetNoTorque setNoTorque;
imtq::HkDatasetWithTorque setWithTorque;
bool enableHkSets;
@ -38,6 +40,8 @@ class ImtqDummy : public DeviceHandlerBase {
PoolEntry<float> mtmRawWithTorque = PoolEntry<float>(3);
PoolEntry<uint8_t> actStatusWithTorque = PoolEntry<uint8_t>(1);
power::Switch_t switcher = power::NO_SWITCH;
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;

View File

@ -75,9 +75,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
}
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
auto* imtqDummy =
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets);
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy,
power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
imtqDummy->enableThermalModule(ThermalStateCfg());
imtqDummy->setPowerSwitcher(&pwrSwitcher);
imtqDummy->connectModeTreeParent(*imtqAssy);
if (cfg.addOnlyAcuDummy) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets);