mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Added functionality for euro lift tilt mechanisms.
This commit is contained in:
parent
93656f9478
commit
1cb9746cc8
8 changed files with 66 additions and 22 deletions
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef configsettings_h
|
||||
#define configsettings_h
|
||||
|
||||
#define FW_VERSION "v2.1.8"
|
||||
#define FW_VERSION "v2.1.9"
|
||||
enum DeviceStatus {
|
||||
DS_OK = 0,
|
||||
DS_ERROR = 1,
|
||||
|
|
|
|||
70
Somfy.cpp
70
Somfy.cpp
|
|
@ -1411,6 +1411,32 @@ void SomfyShade::processWaitingFrame() {
|
|||
this->emitCommand(cmd, "remote", this->lastFrame.remoteAddress);
|
||||
}
|
||||
}
|
||||
else if(this->tiltType == tilt_types::euromode) {
|
||||
if(this->lastFrame.repeats >= TILT_REPEATS) {
|
||||
int8_t dir = this->lastFrame.cmd == somfy_commands::Up ? -1 : 1;
|
||||
this->target = dir > 0 ? 100.0f : 0.0f;
|
||||
this->setMovement(dir);
|
||||
this->lastFrame.processed = true;
|
||||
Serial.print(this->name);
|
||||
Serial.print(" Processing ");
|
||||
Serial.print(translateSomfyCommand(this->lastFrame.cmd));
|
||||
Serial.print(" after ");
|
||||
Serial.print(this->lastFrame.repeats);
|
||||
Serial.println(" repeats");
|
||||
this->emitCommand(cmd, "remote", this->lastFrame.remoteAddress);
|
||||
}
|
||||
else {
|
||||
int8_t dir = this->lastFrame.cmd == somfy_commands::Up ? -1 : 1;
|
||||
this->tiltTarget = dir > 0 ? 100 : 0;
|
||||
this->setTiltMovement(dir);
|
||||
this->lastFrame.processed = true;
|
||||
this->emitCommand(cmd, "remote", this->lastFrame.remoteAddress);
|
||||
}
|
||||
if(this->lastFrame.repeats > TILT_REPEATS + 2) {
|
||||
this->lastFrame.processed = true;
|
||||
this->emitCommand(cmd, "remote", this->lastFrame.remoteAddress);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case somfy_commands::My:
|
||||
if(this->lastFrame.repeats >= SETMY_REPEATS && this->isIdle()) {
|
||||
|
|
@ -1603,7 +1629,7 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) {
|
|||
this->lastFrame.processed = true;
|
||||
return;
|
||||
}
|
||||
if(this->tiltType == tilt_types::tiltmotor) {
|
||||
if(this->tiltType == tilt_types::tiltmotor || this->tiltType == tilt_types::euromode) {
|
||||
// Wait another half second just in case we are potentially processing a tilt.
|
||||
if(!internal) this->lastFrame.await = curTime + 500;
|
||||
else this->lastFrame.processed = true;
|
||||
|
|
@ -1625,7 +1651,7 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) {
|
|||
return;
|
||||
}
|
||||
if (!this->windLast || (curTime - this->windLast) >= SOMFY_NO_WIND_REMOTE_TIMEOUT) {
|
||||
if(this->tiltType == tilt_types::tiltmotor) {
|
||||
if(this->tiltType == tilt_types::tiltmotor || this->tiltType == tilt_types::euromode) {
|
||||
// Wait another half seccond just in case we are potentially processing a tilt.
|
||||
if(!internal) this->lastFrame.await = curTime + 500;
|
||||
else this->lastFrame.processed = true;
|
||||
|
|
@ -2026,23 +2052,39 @@ void SomfyShade::sendCommand(somfy_commands cmd, uint8_t repeat) {
|
|||
// is expected to be called internally when the motor needs commanded.
|
||||
if(this->bitLength == 0) this->bitLength = somfy.transceiver.config.type;
|
||||
if(cmd == somfy_commands::Up) {
|
||||
SomfyRemote::sendCommand(cmd, repeat);
|
||||
if(this->tiltType != tilt_types::tiltonly) this->target = 0.0f;
|
||||
if(this->tiltType == tilt_types::euromode) {
|
||||
// In euromode we need to long press for 2 seconds on the
|
||||
// up command.
|
||||
SomfyRemote::sendCommand(cmd, TILT_REPEATS);
|
||||
this->target = 0.0f;
|
||||
}
|
||||
else {
|
||||
SomfyRemote::sendCommand(cmd, repeat);
|
||||
if(this->tiltType == tilt_types::tiltonly) {
|
||||
this->myPos = this->currentPos = this->target = 0.0f;
|
||||
this->tiltTarget = 0.0f;
|
||||
}
|
||||
else this->target = 0.0f;
|
||||
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 0.0f;
|
||||
}
|
||||
}
|
||||
else if(cmd == somfy_commands::Down) {
|
||||
if(this->tiltType == tilt_types::euromode) {
|
||||
// In euromode we need to long press for 2 seconds on the
|
||||
// down command.
|
||||
SomfyRemote::sendCommand(cmd, TILT_REPEATS);
|
||||
this->target = 100.0f;
|
||||
}
|
||||
else {
|
||||
SomfyRemote::sendCommand(cmd, repeat);
|
||||
if(this->tiltType == tilt_types::tiltonly) {
|
||||
this->myPos = this->currentPos = this->target = 100.0f;
|
||||
this->tiltTarget = 0.0f;
|
||||
}
|
||||
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 0.0f;
|
||||
}
|
||||
else if(cmd == somfy_commands::Down) {
|
||||
SomfyRemote::sendCommand(cmd, repeat);
|
||||
if(this->tiltType != tilt_types::tiltonly) this->target = 100.0f;
|
||||
else {
|
||||
this->myPos = this->currentPos = this->target = 100.0f;
|
||||
this->tiltTarget = 100.0f;
|
||||
}
|
||||
else this->target = 100.0f;
|
||||
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 100.0f;
|
||||
}
|
||||
}
|
||||
else if(cmd == somfy_commands::My) {
|
||||
if(this->shadeType == shade_types::garage1 || this->shadeType == shade_types::drycontact)
|
||||
SomfyRemote::sendCommand(cmd, repeat);
|
||||
|
|
@ -2172,7 +2214,7 @@ void SomfyShade::moveToTarget(float pos, float tilt) {
|
|||
}
|
||||
Serial.print("% using ");
|
||||
Serial.println(translateSomfyCommand(cmd));
|
||||
SomfyRemote::sendCommand(cmd, this->repeats);
|
||||
SomfyRemote::sendCommand(cmd, this->tiltType == tilt_types::euromode ? TILT_REPEATS : this->repeats);
|
||||
this->settingPos = true;
|
||||
this->target = pos;
|
||||
if(tilt >= 0) {
|
||||
|
|
|
|||
1
Somfy.h
1
Somfy.h
|
|
@ -66,6 +66,7 @@ enum class tilt_types : byte {
|
|||
tiltmotor = 0x01,
|
||||
integrated = 0x02,
|
||||
tiltonly = 0x03,
|
||||
euromode = 0x04
|
||||
};
|
||||
String translateSomfyCommand(const somfy_commands cmd);
|
||||
somfy_commands translateSomfyCommand(const String& string);
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
2.1.8
|
||||
2.1.9
|
||||
|
|
@ -3,11 +3,11 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="main.css?v=2.1.8" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.1.8" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.1.8" type="text/css" />
|
||||
<link rel="stylesheet" href="main.css?v=2.1.9" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.1.9" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.1.9" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<script type="text/javascript" src="index.js?v=2.1.8"></script>
|
||||
<script type="text/javascript" src="index.js?v=2.1.9"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divContainer" class="container main" data-auth="false">
|
||||
|
|
@ -357,6 +357,7 @@
|
|||
<option value="1">Tilt Motor</option>
|
||||
<option value="2">Integrated</option>
|
||||
<option value="3">Tilt Only</option>
|
||||
<option value="4">Euro Tilt</option>
|
||||
</select>
|
||||
<label for="selTiltType" style="cursor:pointer;">Tilt Type</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1201,7 +1201,7 @@ var security = new Security();
|
|||
|
||||
class General {
|
||||
initialized = false;
|
||||
appVersion = 'v2.1.8';
|
||||
appVersion = 'v2.1.9';
|
||||
reloadApp = false;
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue