get rid of strings
This commit is contained in:
parent
03f34976da
commit
ccc1e7dae4
|
@ -480,34 +480,29 @@ namespace ratgdo {
|
||||||
|
|
||||||
void RATGDOComponent::sendDoorStatus()
|
void RATGDOComponent::sendDoorStatus()
|
||||||
{
|
{
|
||||||
DoorState val = static_cast<DoorState>(this->store_.doorState);
|
ESP_LOGD(TAG, "Door state: %s", door_state_to_string(static_cast<DoorState>(this->store_.doorState)));
|
||||||
ESP_LOGD(TAG, "Door state: %s", door_state_to_string(val));
|
|
||||||
this->status_door_pin_->digital_write(this->store_.doorState == 1);
|
this->status_door_pin_->digital_write(this->store_.doorState == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::sendLightStatus()
|
void RATGDOComponent::sendLightStatus()
|
||||||
{
|
{
|
||||||
LightState val = static_cast<LightState>(this->store_.lightState);
|
ESP_LOGD(TAG, "Light state %s", light_state_to_string(static_cast<LightState>(this->store_.lightState)));
|
||||||
ESP_LOGD(TAG, "Light state %s", light_state_to_string(val));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::sendLockStatus()
|
void RATGDOComponent::sendLockStatus()
|
||||||
{
|
{
|
||||||
LockState val = static_cast<LockState>(this->store_.lockState);
|
ESP_LOGD(TAG, "Lock state %s", lock_state_to_string(static_cast<LockState>(this->store_.lockState)));
|
||||||
ESP_LOGD(TAG, "Lock state %s", lock_state_to_string(val));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::sendMotionStatus()
|
void RATGDOComponent::sendMotionStatus()
|
||||||
{
|
{
|
||||||
MotionState val = static_cast<MotionState>(this->store_.motionState);
|
ESP_LOGD(TAG, "Motion state %s", motion_state_to_string(static_cast<MotionState>(this->store_.motionState)));
|
||||||
ESP_LOGD(TAG, "Motion state %s", motion_state_to_string(val));
|
|
||||||
this->store_.motionState = MotionState::MOTION_STATE_CLEAR; // reset motion state
|
this->store_.motionState = MotionState::MOTION_STATE_CLEAR; // reset motion state
|
||||||
}
|
}
|
||||||
|
|
||||||
void RATGDOComponent::sendObstructionStatus()
|
void RATGDOComponent::sendObstructionStatus()
|
||||||
{
|
{
|
||||||
ObstructionState val = static_cast<ObstructionState>(this->store_.obstructionState);
|
ESP_LOGD(TAG, "Obstruction state %s", obstruction_state_to_string(static_cast<ObstructionState>(this->store_.obstructionState)));
|
||||||
ESP_LOGD(TAG, "Obstruction state %s", obstruction_state_to_string(val));
|
|
||||||
this->status_obst_pin_->digital_write(this->store_.obstructionState == 0);
|
this->status_obst_pin_->digital_write(this->store_.obstructionState == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,8 +553,7 @@ namespace ratgdo {
|
||||||
void RATGDOComponent::openDoor()
|
void RATGDOComponent::openDoor()
|
||||||
{
|
{
|
||||||
if (this->store_.doorState == DoorState::DOOR_STATE_OPEN || this->store_.doorState == DoorState::DOOR_STATE_OPENING) {
|
if (this->store_.doorState == DoorState::DOOR_STATE_OPEN || this->store_.doorState == DoorState::DOOR_STATE_OPENING) {
|
||||||
DoorState val = static_cast<DoorState>(this->store_.doorState);
|
ESP_LOGD(TAG, "The door is already %s", door_state_to_string(static_cast<DoorState>(this->store_.doorState)));
|
||||||
ESP_LOGD(TAG, "The door is already %s", door_state_to_string(val));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toggleDoor();
|
toggleDoor();
|
||||||
|
@ -568,8 +562,7 @@ namespace ratgdo {
|
||||||
void RATGDOComponent::closeDoor()
|
void RATGDOComponent::closeDoor()
|
||||||
{
|
{
|
||||||
if (this->store_.doorState == DoorState::DOOR_STATE_CLOSED || this->store_.doorState == DoorState::DOOR_STATE_CLOSING) {
|
if (this->store_.doorState == DoorState::DOOR_STATE_CLOSED || this->store_.doorState == DoorState::DOOR_STATE_CLOSING) {
|
||||||
DoorState val = static_cast<DoorState>(this->store_.doorState);
|
ESP_LOGD(TAG, "The door is already %s", door_state_to_string(static_cast<DoorState>(this->store_.doorState)));
|
||||||
ESP_LOGD(TAG, "The door is already %s", door_state_to_string(val));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
toggleDoor();
|
toggleDoor();
|
||||||
|
|
Loading…
Reference in New Issue