update for updated gpio API
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:
@ -77,7 +77,13 @@ ReturnValue_t HeaterHandler::initialize() {
|
||||
|
||||
ReturnValue_t HeaterHandler::initializeHeaterMap() {
|
||||
for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) {
|
||||
heaterVec.push_back(HeaterWrapper(helper.heaters[switchNr]));
|
||||
gpio::Levels level;
|
||||
gpioInterface->readGpio(helper.heaters[switchNr].second, level);
|
||||
SwitchState initState = SwitchState::OFF;
|
||||
if(level == gpio::Levels::HIGH) {
|
||||
|
||||
}
|
||||
heaterVec.push_back(HeaterWrapper(helper.heaters[switchNr], initState));
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
@ -107,11 +113,11 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t
|
||||
if (actionId != SWITCH_HEATER) {
|
||||
return COMMAND_NOT_SUPPORTED;
|
||||
}
|
||||
auto switchNr = *data;
|
||||
auto switchNr = data[0];
|
||||
if (switchNr > 7) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
auto heater = heaterVec.at(switchNr);
|
||||
auto& heater = heaterVec.at(switchNr);
|
||||
HasHealthIF::HealthState health = heater.healthDevice->getHealth();
|
||||
if (health == HasHealthIF::FAULTY or health == HasHealthIF::PERMANENT_FAULTY or
|
||||
health == HasHealthIF::NEEDS_RECOVERY) {
|
||||
@ -202,7 +208,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
||||
// Check state of main line switch
|
||||
ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch);
|
||||
if (mainSwitchState == PowerSwitchIF::SWITCH_ON) {
|
||||
if (!checkSwitchState(heaterIdx)) {
|
||||
if (checkSwitchState(heaterIdx) == SwitchState::ON) {
|
||||
gpioId_t gpioId = heater.gpioId;
|
||||
result = gpioInterface->pullHigh(gpioId);
|
||||
if (result != RETURN_OK) {
|
||||
@ -210,6 +216,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
||||
<< " high" << std::endl;
|
||||
triggerEvent(GPIO_PULL_HIGH_FAILED, result);
|
||||
} else {
|
||||
triggerEvent(HEATER_WENT_ON, heaterIdx, 0);
|
||||
heater.switchState = ON;
|
||||
}
|
||||
} else {
|
||||
@ -256,6 +263,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) {
|
||||
triggerEvent(GPIO_PULL_LOW_FAILED, result);
|
||||
} else {
|
||||
heater.switchState = OFF;
|
||||
triggerEvent(HEATER_WENT_OFF, heaterIdx, 0);
|
||||
// When all switches are off, also main line switch will be turned off
|
||||
if (allSwitchesOff()) {
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
|
Reference in New Issue
Block a user