mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-15 03:52:11 +01:00
Check for division by zero
This commit is contained in:
parent
4a72c6badc
commit
f3e7dd5a9e
1 changed files with 2 additions and 2 deletions
|
|
@ -3009,10 +3009,10 @@ void SomfyShade::moveToTiltTarget(float target) {
|
||||||
uint8_t step = 1;
|
uint8_t step = 1;
|
||||||
if(target < this->currentTiltPos){
|
if(target < 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 - target) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (this->currentTiltPos - target) * this->tiltTime / this->stepSize / 100;
|
||||||
} else if(target > this->currentTiltPos){
|
} else if(target > 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 = (target - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
if (this->stepSize > 0) step = (target - this->currentTiltPos) * this->tiltTime / this->stepSize / 100;
|
||||||
}
|
}
|
||||||
if(target >= 0.0f && target <= 100.0f) {
|
if(target >= 0.0f && target <= 100.0f) {
|
||||||
// Only send a command if the lift is not moving.
|
// Only send a command if the lift is not moving.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue