diff --git a/ConfigSettings.h b/ConfigSettings.h index a22aad8..5dd839b 100644 --- a/ConfigSettings.h +++ b/ConfigSettings.h @@ -3,7 +3,7 @@ #ifndef configsettings_h #define configsettings_h -#define FW_VERSION "v1.5.1" +#define FW_VERSION "v1.5.2beta" enum DeviceStatus { DS_OK = 0, DS_ERROR = 1, diff --git a/Somfy.cpp b/Somfy.cpp index 3979792..8c36958 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -1021,39 +1021,33 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) { } } break; + case somfy_commands::MyUp: case somfy_commands::StepUp: dir = 0; this->lastFrame.processed = true; // With the step commands and integrated shades // the motor must tilt in the direction first then move // so we have to calculate the target with this in mind. - if(this->tiltType == tilt_types::integrated) { - // First check to see if the tilt is 0. If it is not then we need to tilt. - if(this->currentTiltPos > 0.0f) { - this->tiltTarget = max(0.0f, this->currentTiltPos - 1.0f); - } - else if(this->currentPos > 0.0f) { - this->target = max(0.0f, this->currentPos - 1.0f); - } + if(this->tiltType == tilt_types::integrated && this->currentTiltPos > 0.0f) { + this->tiltTarget = max(0.0f, this->currentTiltPos - (100.0f/(static_cast(this->tiltTime/100.0f)))); + } + else if(this->currentPos > 0.0f) { + this->target = max(0.0f, this->currentPos - (100.0f/(static_cast(this->upTime/100.0f)))); } - else if(this->currentPos > 0.0f) this->target = max(0.0f, this->currentPos - 1.0f); break; + case somfy_commands::MyDown: case somfy_commands::StepDown: dir = 1; this->lastFrame.processed = true; // With the step commands and integrated shades // the motor must tilt in the direction first then move // so we have to calculate the target with this in mind. - if(this->tiltType == tilt_types::integrated) { - // First check to see if the tilt is 0. If it is not then we need to tilt. - if(this->currentTiltPos < 100.0f) { - this->tiltTarget = min(100.0f, this->currentTiltPos + 1.0f); - } - else if(this->currentPos > 100.0f) { - this->target = min(100.0f, this->currentPos + 1.0f); - } + if(this->tiltType == tilt_types::integrated && this->currentTiltPos < 100.0f) { + this->tiltTarget = min(100.0f, this->currentTiltPos + (100.0f/(static_cast(this->tiltTime/100.0f)))); + } + else if(this->currentPos < 100.0f) { + this->target = min(100.0f, this->currentPos + (100.0f/(static_cast(this->downTime/100.0f)))); } - else if(this->currentPos < 100.0f) this->target = min(100.0f, this->currentPos + 1.0f); break; default: dir = 0; diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index b82b694..15f358d 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ