Add invert options for commands and position #69

This commit is contained in:
Robert Strouse 2023-06-16 17:42:56 -07:00
parent 536bf839a1
commit ec499cbec4
11 changed files with 138 additions and 67 deletions

10
Web.cpp
View file

@ -167,7 +167,7 @@ void Web::begin() {
Serial.println(apiServer.arg("plain"));
// Send the command to the shade.
if(target <= 100)
shade->moveToTarget(target);
shade->moveToTarget(shade->transformPosition(target));
else
shade->sendCommand(command, repeat);
DynamicJsonDocument sdoc(512);
@ -231,7 +231,7 @@ void Web::begin() {
Serial.println(apiServer.arg("plain"));
// Send the command to the shade.
if(target <= 100)
shade->moveToTiltTarget(target);
shade->moveToTiltTarget(shade->transformPosition(target));
else
shade->sendTiltCommand(command);
DynamicJsonDocument sdoc(512);
@ -688,7 +688,7 @@ void Web::begin() {
Serial.println(server.arg("plain"));
// Send the command to the shade.
if(target <= 100)
shade->moveToTiltTarget(target);
shade->moveToTiltTarget(shade->transformPosition(target));
else
shade->sendTiltCommand(command);
DynamicJsonDocument sdoc(512);
@ -755,7 +755,7 @@ void Web::begin() {
Serial.println(server.arg("plain"));
// Send the command to the shade.
if(target <= 100)
shade->moveToTarget(target);
shade->moveToTarget(shade->transformPosition(target));
else
shade->sendCommand(command, repeat);
DynamicJsonDocument sdoc(512);
@ -813,7 +813,7 @@ void Web::begin() {
if(tilt < 0) tilt = shade->myPos;
if(shade->tiltType == tilt_types::none) tilt = -1;
if(pos >= 0 && pos <= 100)
shade->setMyPosition(pos, tilt);
shade->setMyPosition(shade->transformPosition(pos), shade->transformPosition(tilt));
DynamicJsonDocument sdoc(512);
JsonObject sobj = sdoc.to<JsonObject>();
shade->toJSON(sobj);