timer test
start transitions some fixes
This commit is contained in:
@@ -19,7 +19,7 @@ Valve::Valve(uint gpio_motor1, uint gpio_motor2, uint gpio_start, uint gpio_end)
|
||||
|
||||
|
||||
void Valve::open() {
|
||||
if (state == State::Opening) {
|
||||
if (state == State::Opening || pending_state == State::Opening) {
|
||||
return;
|
||||
}
|
||||
gpio_put(motor2, 0);
|
||||
@@ -30,7 +30,7 @@ void Valve::open() {
|
||||
|
||||
|
||||
void Valve::close() {
|
||||
if (state == State::Closing) {
|
||||
if (state == State::Closing || pending_state == State::Closing) {
|
||||
return;
|
||||
}
|
||||
gpio_put(motor1, 0);
|
||||
@@ -52,7 +52,7 @@ Valve::State Valve::process() {
|
||||
if (duration_cast<seconds>(steady_clock::now() - start_time) > timeout) {
|
||||
gpio_put(motor1, 0);
|
||||
gpio_put(motor2, 0);
|
||||
state = State::Unknown;
|
||||
state = pending_state = State::Unknown;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user