mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-16 04:12:13 +01:00
Add files via upload
Checks for division by zero
This commit is contained in:
parent
d0cb8c6ad7
commit
4a72c6badc
1 changed files with 4 additions and 4 deletions
|
|
@ -3052,10 +3052,10 @@ void SomfyShade::moveToTarget(float pos, float tilt) {
|
||||||
pos = 100;
|
pos = 100;
|
||||||
if(tilt < this->currentTiltPos) {
|
if(tilt < this->currentTiltPos) {
|
||||||
cmd = somfy_commands::StepUp; //Converted to somfy_commands::Up in sendCommand for non-80-bits shades
|
cmd = somfy_commands::StepUp; //Converted to somfy_commands::Up in sendCommand for non-80-bits shades
|
||||||
step = (this->currentTiltPos - tilt) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (this->currentTiltPos - tilt) * this->tiltTime / this->stepSize / 100;
|
||||||
} else if(tilt > this->currentTiltPos) {
|
} else if(tilt > this->currentTiltPos) {
|
||||||
cmd = somfy_commands::StepDown; //Converted to somfy_commands::Down in sendCommand for non-80-bits shades
|
cmd = somfy_commands::StepDown; //Converted to somfy_commands::Down in sendCommand for non-80-bits shades
|
||||||
step = (tilt - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (tilt - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -3065,10 +3065,10 @@ void SomfyShade::moveToTarget(float pos, float tilt) {
|
||||||
cmd = somfy_commands::Down;
|
cmd = somfy_commands::Down;
|
||||||
else if(tilt >= 0 && tilt < this->currentTiltPos){
|
else if(tilt >= 0 && tilt < this->currentTiltPos){
|
||||||
cmd = somfy_commands::StepUp; //Converted to somfy_commands::Up in sendCommand for non-80-bits shades
|
cmd = somfy_commands::StepUp; //Converted to somfy_commands::Up in sendCommand for non-80-bits shades
|
||||||
step = (this->currentTiltPos - tilt) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (this->currentTiltPos - tilt) * this->tiltTime / this->stepSize / 100;
|
||||||
} else if(tilt >= 0 && tilt > this->currentTiltPos){
|
} else if(tilt >= 0 && tilt > this->currentTiltPos){
|
||||||
cmd = somfy_commands::StepDown; //Converted to somfy_commands::Down in sendCommand for non-80-bits shades
|
cmd = somfy_commands::StepDown; //Converted to somfy_commands::Down in sendCommand for non-80-bits shades
|
||||||
step = (tilt - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (tilt - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cmd != somfy_commands::Stop) {
|
if(cmd != somfy_commands::Stop) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue