diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 781573e..11c80f6 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -445,7 +445,9 @@ namespace ratgdo { sendLockStatus(); if (this->obstructionState != this->previousObstructionState) sendObstructionStatus(); - + if (this->motorState != this->previousMotorState) { + sendMotorStatus(); + } if (this->motionState == MotionState::MOTION_STATE_DETECTED) { sendMotionStatus(); this->motionState = MotionState::MOTION_STATE_CLEAR; diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index c7b8a7a..3060dbf 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -80,10 +80,11 @@ namespace ratgdo { uint8_t previousLightState { LightState::LIGHT_STATE_UNKNOWN }; uint8_t previousLockState { LockState::LOCK_STATE_UNKNOWN }; uint8_t previousObstructionState { ObstructionState::OBSTRUCTION_STATE_UNKNOWN }; + uint8_t previousMotorState { MotorState::MOTOR_STATE_UNKNOWN }; uint8_t obstructionState { ObstructionState::OBSTRUCTION_STATE_UNKNOWN }; uint8_t motionState { MotionState::MOTION_STATE_CLEAR }; - uint8_t motorState { MotorState::MOTOR_STATE_OFF }; + uint8_t motorState { MotorState::MOTOR_STATE_UNKNOWN }; uint8_t lockState { LockState::LOCK_STATE_UNKNOWN }; uint8_t lightState { LightState::LIGHT_STATE_UNKNOWN }; uint8_t doorState { DoorState::DOOR_STATE_UNKNOWN }; diff --git a/components/ratgdo/ratgdo_state.cpp b/components/ratgdo/ratgdo_state.cpp index 3155f23..df04284 100644 --- a/components/ratgdo/ratgdo_state.cpp +++ b/components/ratgdo/ratgdo_state.cpp @@ -68,8 +68,9 @@ namespace ratgdo { case MOTOR_STATE_ON: return "ON"; case MOTOR_STATE_OFF: - default: return "OFF"; + default: + return "UNKNOWN"; } } diff --git a/components/ratgdo/ratgdo_state.h b/components/ratgdo/ratgdo_state.h index cf6d6a2..169dc8a 100644 --- a/components/ratgdo/ratgdo_state.h +++ b/components/ratgdo/ratgdo_state.h @@ -66,6 +66,7 @@ namespace ratgdo { enum MotorState : uint8_t { MOTOR_STATE_OFF = 0, MOTOR_STATE_ON = 1, + MOTOR_STATE_UNKNOWN = 2, }; const char* motor_state_to_string(MotorState state);