Delete duplicated min and max functions

This commit is contained in:
Adrian Scillato 2018-12-01 19:16:32 -03:00 committed by GitHub
parent 4ced9c0647
commit 7e09195083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define min(a,b) ((a)<(b)?(a):(b)) //#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b)) //#define max(a,b) ((a)>(b)?(a):(b))
#if defined(USE_WEBSERVER) && defined(USE_EMULATION) #if defined(USE_WEBSERVER) && defined(USE_EMULATION)
/*********************************************************************************************\ /*********************************************************************************************\
@ -692,8 +692,8 @@ void HueLights(String *path)
if (hue_json.containsKey("bri")) { // Brightness is a scale from 1 (the minimum the light is capable of) to 254 (the maximum). Note: a brightness of 1 is not off. if (hue_json.containsKey("bri")) { // Brightness is a scale from 1 (the minimum the light is capable of) to 254 (the maximum). Note: a brightness of 1 is not off.
tmp = hue_json["bri"]; tmp = hue_json["bri"];
tmp = max(tmp, 1); tmp = tmax(tmp, 1);
tmp = min(tmp, 254); tmp = tmin(tmp, 254);
bri = (float)tmp / 254.0f; bri = (float)tmp / 254.0f;
if (resp) { if (resp) {
response += ","; response += ",";
@ -721,8 +721,8 @@ void HueLights(String *path)
} }
if (hue_json.containsKey("sat")) { // Saturation of the light. 254 is the most saturated (colored) and 0 is the least saturated (white). if (hue_json.containsKey("sat")) { // Saturation of the light. 254 is the most saturated (colored) and 0 is the least saturated (white).
tmp = hue_json["sat"]; tmp = hue_json["sat"];
tmp = max(tmp, 0); tmp = tmax(tmp, 0);
tmp = min(tmp, 254); tmp = tmin(tmp, 254);
sat = (float)tmp / 254.0f; sat = (float)tmp / 254.0f;
if (resp) { if (resp) {
response += ","; response += ",";