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
|
#ifndef configsettings_h
|
||||||
#define configsettings_h
|
#define configsettings_h
|
||||||
|
|
||||||
#define FW_VERSION "v2.1.8"
|
#define FW_VERSION "v2.1.9"
|
||||||
enum DeviceStatus {
|
enum DeviceStatus {
|
||||||
DS_OK = 0,
|
DS_OK = 0,
|
||||||
DS_ERROR = 1,
|
DS_ERROR = 1,
|
||||||
|
|
|
||||||
72
Somfy.cpp
72
Somfy.cpp
|
|
@ -1411,6 +1411,32 @@ void SomfyShade::processWaitingFrame() {
|
||||||
this->emitCommand(cmd, "remote", this->lastFrame.remoteAddress);
|
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;
|
break;
|
||||||
case somfy_commands::My:
|
case somfy_commands::My:
|
||||||
if(this->lastFrame.repeats >= SETMY_REPEATS && this->isIdle()) {
|
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;
|
this->lastFrame.processed = true;
|
||||||
return;
|
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.
|
// Wait another half second just in case we are potentially processing a tilt.
|
||||||
if(!internal) this->lastFrame.await = curTime + 500;
|
if(!internal) this->lastFrame.await = curTime + 500;
|
||||||
else this->lastFrame.processed = true;
|
else this->lastFrame.processed = true;
|
||||||
|
|
@ -1625,7 +1651,7 @@ void SomfyShade::processFrame(somfy_frame_t &frame, bool internal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this->windLast || (curTime - this->windLast) >= SOMFY_NO_WIND_REMOTE_TIMEOUT) {
|
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.
|
// Wait another half seccond just in case we are potentially processing a tilt.
|
||||||
if(!internal) this->lastFrame.await = curTime + 500;
|
if(!internal) this->lastFrame.await = curTime + 500;
|
||||||
else this->lastFrame.processed = true;
|
else this->lastFrame.processed = true;
|
||||||
|
|
@ -2026,22 +2052,38 @@ void SomfyShade::sendCommand(somfy_commands cmd, uint8_t repeat) {
|
||||||
// is expected to be called internally when the motor needs commanded.
|
// is expected to be called internally when the motor needs commanded.
|
||||||
if(this->bitLength == 0) this->bitLength = somfy.transceiver.config.type;
|
if(this->bitLength == 0) this->bitLength = somfy.transceiver.config.type;
|
||||||
if(cmd == somfy_commands::Up) {
|
if(cmd == somfy_commands::Up) {
|
||||||
SomfyRemote::sendCommand(cmd, repeat);
|
if(this->tiltType == tilt_types::euromode) {
|
||||||
if(this->tiltType != tilt_types::tiltonly) this->target = 0.0f;
|
// In euromode we need to long press for 2 seconds on the
|
||||||
else {
|
// up command.
|
||||||
this->myPos = this->currentPos = this->target = 100.0f;
|
SomfyRemote::sendCommand(cmd, TILT_REPEATS);
|
||||||
this->tiltTarget = 0.0f;
|
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;
|
||||||
}
|
}
|
||||||
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 0.0f;
|
|
||||||
}
|
}
|
||||||
else if(cmd == somfy_commands::Down) {
|
else if(cmd == somfy_commands::Down) {
|
||||||
SomfyRemote::sendCommand(cmd, repeat);
|
if(this->tiltType == tilt_types::euromode) {
|
||||||
if(this->tiltType != tilt_types::tiltonly) this->target = 100.0f;
|
// In euromode we need to long press for 2 seconds on the
|
||||||
else {
|
// down command.
|
||||||
this->myPos = this->currentPos = this->target = 100.0f;
|
SomfyRemote::sendCommand(cmd, TILT_REPEATS);
|
||||||
this->tiltTarget = 100.0f;
|
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;
|
||||||
|
}
|
||||||
|
else this->target = 100.0f;
|
||||||
|
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 100.0f;
|
||||||
}
|
}
|
||||||
if(this->tiltType == tilt_types::integrated) this->tiltTarget = 100.0f;
|
|
||||||
}
|
}
|
||||||
else if(cmd == somfy_commands::My) {
|
else if(cmd == somfy_commands::My) {
|
||||||
if(this->shadeType == shade_types::garage1 || this->shadeType == shade_types::drycontact)
|
if(this->shadeType == shade_types::garage1 || this->shadeType == shade_types::drycontact)
|
||||||
|
|
@ -2172,7 +2214,7 @@ void SomfyShade::moveToTarget(float pos, float tilt) {
|
||||||
}
|
}
|
||||||
Serial.print("% using ");
|
Serial.print("% using ");
|
||||||
Serial.println(translateSomfyCommand(cmd));
|
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->settingPos = true;
|
||||||
this->target = pos;
|
this->target = pos;
|
||||||
if(tilt >= 0) {
|
if(tilt >= 0) {
|
||||||
|
|
|
||||||
1
Somfy.h
1
Somfy.h
|
|
@ -66,6 +66,7 @@ enum class tilt_types : byte {
|
||||||
tiltmotor = 0x01,
|
tiltmotor = 0x01,
|
||||||
integrated = 0x02,
|
integrated = 0x02,
|
||||||
tiltonly = 0x03,
|
tiltonly = 0x03,
|
||||||
|
euromode = 0x04
|
||||||
};
|
};
|
||||||
String translateSomfyCommand(const somfy_commands cmd);
|
String translateSomfyCommand(const somfy_commands cmd);
|
||||||
somfy_commands translateSomfyCommand(const String& string);
|
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>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="main.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.8" 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.8" 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" />
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="divContainer" class="container main" data-auth="false">
|
<div id="divContainer" class="container main" data-auth="false">
|
||||||
|
|
@ -357,6 +357,7 @@
|
||||||
<option value="1">Tilt Motor</option>
|
<option value="1">Tilt Motor</option>
|
||||||
<option value="2">Integrated</option>
|
<option value="2">Integrated</option>
|
||||||
<option value="3">Tilt Only</option>
|
<option value="3">Tilt Only</option>
|
||||||
|
<option value="4">Euro Tilt</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="selTiltType" style="cursor:pointer;">Tilt Type</label>
|
<label for="selTiltType" style="cursor:pointer;">Tilt Type</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1201,7 +1201,7 @@ var security = new Security();
|
||||||
|
|
||||||
class General {
|
class General {
|
||||||
initialized = false;
|
initialized = false;
|
||||||
appVersion = 'v2.1.8';
|
appVersion = 'v2.1.9';
|
||||||
reloadApp = false;
|
reloadApp = false;
|
||||||
init() {
|
init() {
|
||||||
if (this.initialized) return;
|
if (this.initialized) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue