mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-15 20:02:13 +01:00
Remove my command at the stop if we are seeking to 0 or 100%
This commit is contained in:
parent
20a3cef076
commit
1dbb2f4434
2 changed files with 26 additions and 5 deletions
31
Somfy.cpp
31
Somfy.cpp
|
|
@ -578,12 +578,14 @@ void SomfyShade::checkMovement() {
|
||||||
// If we need to stop the shade do this before we indicate that we are
|
// If we need to stop the shade do this before we indicate that we are
|
||||||
// not moving otherwise the my function will kick in.
|
// not moving otherwise the my function will kick in.
|
||||||
if(this->settingPos) {
|
if(this->settingPos) {
|
||||||
SomfyRemote::sendCommand(somfy_commands::My);
|
|
||||||
if(!isAtTarget()) {
|
if(!isAtTarget()) {
|
||||||
|
if(this->target != 100.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
delay(100);
|
delay(100);
|
||||||
// We now need to move the tilt to the position we requested.
|
// We now need to move the tilt to the position we requested.
|
||||||
this->moveToTiltTarget(this->tiltTarget);
|
this->moveToTiltTarget(this->tiltTarget);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(this->target != 100.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
}
|
}
|
||||||
this->direction = 0;
|
this->direction = 0;
|
||||||
this->tiltStart = millis();
|
this->tiltStart = millis();
|
||||||
|
|
@ -621,12 +623,14 @@ void SomfyShade::checkMovement() {
|
||||||
// If we need to stop the shade do this before we indicate that we are
|
// If we need to stop the shade do this before we indicate that we are
|
||||||
// not moving otherwise the my function will kick in.
|
// not moving otherwise the my function will kick in.
|
||||||
if(this->settingPos) {
|
if(this->settingPos) {
|
||||||
SomfyRemote::sendCommand(somfy_commands::My);
|
|
||||||
if(!isAtTarget()) {
|
if(!isAtTarget()) {
|
||||||
|
if(this->target != 0.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
delay(100);
|
delay(100);
|
||||||
// We now need to move the tilt to the position we requested.
|
// We now need to move the tilt to the position we requested.
|
||||||
this->moveToTiltTarget(this->tiltTarget);
|
this->moveToTiltTarget(this->tiltTarget);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if(this->target != 0.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
}
|
}
|
||||||
this->direction = 0;
|
this->direction = 0;
|
||||||
this->tiltStart = millis();
|
this->tiltStart = millis();
|
||||||
|
|
@ -662,7 +666,16 @@ void SomfyShade::checkMovement() {
|
||||||
this->currentTiltPos = this->tiltTarget;
|
this->currentTiltPos = this->tiltTarget;
|
||||||
// If we need to stop the shade do this before we indicate that we are
|
// If we need to stop the shade do this before we indicate that we are
|
||||||
// not moving otherwise the my function will kick in.
|
// not moving otherwise the my function will kick in.
|
||||||
if(this->settingTiltPos) SomfyRemote::sendCommand(somfy_commands::My);
|
if(this->settingTiltPos) {
|
||||||
|
if(this->tiltType == tilt_types::integrated) {
|
||||||
|
// If this is an integrated tilt mechanism the we will simply let it finish. If it is not then we will stop it.
|
||||||
|
if(this->tiltTarget != 100.0 || this->currentPos != 100.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This is a tilt motor so let it complete if it is going to 0.
|
||||||
|
if(this->tiltTarget != 100.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->tiltDirection = 0;
|
this->tiltDirection = 0;
|
||||||
this->settingTiltPos = false;
|
this->settingTiltPos = false;
|
||||||
if(this->isAtTarget()) this->commitShadePosition();
|
if(this->isAtTarget()) this->commitShadePosition();
|
||||||
|
|
@ -695,14 +708,22 @@ void SomfyShade::checkMovement() {
|
||||||
this->moveStart = millis();
|
this->moveStart = millis();
|
||||||
this->startPos = this->currentPos;
|
this->startPos = this->currentPos;
|
||||||
this->tiltDirection = 0;
|
this->tiltDirection = 0;
|
||||||
//Serial.println("Processed tilt first UP");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this->currentTiltPos <= this->tiltTarget) {
|
else if(this->currentTiltPos <= this->tiltTarget) {
|
||||||
this->currentTiltPos = this->tiltTarget;
|
this->currentTiltPos = this->tiltTarget;
|
||||||
// If we need to stop the shade do this before we indicate that we are
|
// If we need to stop the shade do this before we indicate that we are
|
||||||
// not moving otherwise the my function will kick in.
|
// not moving otherwise the my function will kick in.
|
||||||
if(this->settingTiltPos) SomfyRemote::sendCommand(somfy_commands::My);
|
if(this->settingTiltPos) {
|
||||||
|
if(this->tiltType == tilt_types::integrated) {
|
||||||
|
// If this is an integrated tilt mechanism the we will simply let it finish. If it is not then we will stop it.
|
||||||
|
if(this->tiltTarget != 0.0 || this->currentPos != 0.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This is a tilt motor so let it complete if it is going to 0.
|
||||||
|
if(this->tiltTarget != 0.0) SomfyRemote::sendCommand(somfy_commands::My);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->tiltDirection = 0;
|
this->tiltDirection = 0;
|
||||||
this->settingTiltPos = false;
|
this->settingTiltPos = false;
|
||||||
Serial.println("Stopping at tilt position");
|
Serial.println("Stopping at tilt position");
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue