improved linux libgpiod interface
This commit is contained in:
@ -213,15 +213,22 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) {
|
||||
if (!checkSwitchState(switchNr)) {
|
||||
gpioId_t gpioId = getGpioIdFromSwitchNr(switchNr);
|
||||
result = gpioInterface->pullHigh(gpioId);
|
||||
result = RETURN_OK;
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "HeaterHandler::handleSwitchOffCommand: Failed to pull gpio with id"
|
||||
sif::error << "HeaterHandler::handleSwitchOnCommand: Failed to pull gpio with id"
|
||||
<< gpioId << "high" << std::endl;
|
||||
triggerEvent(GPIO_PULL_HIGH_FAILED, result);
|
||||
}
|
||||
else {
|
||||
switchStates[switchNr] = ON;
|
||||
}
|
||||
int gpioState;
|
||||
result = gpioInterface->readGpio(gpioId, &gpioState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "HeaterHandler::handleSwitchOnCommand: Failed to read gpio"
|
||||
<< std::endl;
|
||||
}
|
||||
sif::debug << "HeaterHandler::handleSwitchOnCommand: GPIO state: " << gpioState
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
triggerEvent(SWITCH_ALREADY_ON, switchNr);
|
||||
@ -264,7 +271,6 @@ void HeaterHandler::handleSwitchOffCommand(HeaterMapIter heaterMapIter) {
|
||||
if (checkSwitchState(switchNr)) {
|
||||
gpioId_t gpioId = getGpioIdFromSwitchNr(switchNr);
|
||||
result = gpioInterface->pullLow(gpioId);
|
||||
result = RETURN_OK;
|
||||
if (result != RETURN_OK) {
|
||||
sif::error << "HeaterHandler::handleSwitchOffCommand: Failed to pull gpio with id"
|
||||
<< gpioId << " low" << std::endl;
|
||||
@ -277,6 +283,14 @@ void HeaterHandler::handleSwitchOffCommand(HeaterMapIter heaterMapIter) {
|
||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||
}
|
||||
}
|
||||
int gpioState;
|
||||
result = gpioInterface->readGpio(gpioId, &gpioState);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "HeaterHandler::handleSwitchOnCommand: Failed to read gpio"
|
||||
<< std::endl;
|
||||
}
|
||||
sif::debug << "HeaterHandler::handleSwitchOnCommand: GPIO state: " << gpioState
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
sif::info << "HeaterHandler::handleSwitchOffCommand: Switch already off" << std::endl;
|
||||
|
Reference in New Issue
Block a user