This commit is contained in:
J. Nick Koston 2023-06-07 21:48:15 -05:00
parent b2a7f2ab20
commit ffd024bf23
No known key found for this signature in database
4 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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 };

View File

@ -68,8 +68,9 @@ namespace ratgdo {
case MOTOR_STATE_ON:
return "ON";
case MOTOR_STATE_OFF:
default:
return "OFF";
default:
return "UNKNOWN";
}
}

View File

@ -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);