tweaks for dummy power switcher

This commit is contained in:
Robin Müller 2022-03-28 12:59:32 +02:00
parent 60972228ef
commit 79f3c7324a
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -1,8 +1,8 @@
#include "DummyPowerSwitcher.h" #include "DummyPowerSwitcher.h"
DummyPowerSwitcher::DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses, uint32_t switchDelayMs) DummyPowerSwitcher::DummyPowerSwitcher(size_t numberOfSwitches, size_t numberOfFuses,
: switcherList(numberOfSwitches), fuseList(numberOfFuses), switchDelayMs(switchDelayMs) { uint32_t switchDelayMs)
} : switcherList(numberOfSwitches), fuseList(numberOfFuses), switchDelayMs(switchDelayMs) {}
void DummyPowerSwitcher::setInitialSwitcherList(std::vector<ReturnValue_t> switcherList) { void DummyPowerSwitcher::setInitialSwitcherList(std::vector<ReturnValue_t> switcherList) {
this->switcherList = switcherList; this->switcherList = switcherList;
@ -20,7 +20,7 @@ ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, Re
} }
ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) { ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) {
if(fuseNr < fuseList.capacity()) { if (fuseNr < fuseList.capacity()) {
fuseList[fuseNr] = FUSE_ON; fuseList[fuseNr] = FUSE_ON;
} }
return RETURN_FAILED; return RETURN_FAILED;
@ -34,9 +34,10 @@ ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const
} }
ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const {
return RETURN_OK; if (fuseNr < fuseList.capacity()) {
return fuseList[fuseNr];
}
return HasReturnvaluesIF::RETURN_FAILED;
} }
uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { uint32_t DummyPowerSwitcher::getSwitchDelayMs(void) const { return switchDelayMs; }
return 5000;
}