Update to Espalexa v2.4.4
This commit is contained in:
parent
ed560a338e
commit
558811e4f9
@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* @title Espalexa library
|
* @title Espalexa library
|
||||||
* @version 2.4.3
|
* @version 2.4.4
|
||||||
* @author Christian Schwinne
|
* @author Christian Schwinne
|
||||||
* @license MIT
|
* @license MIT
|
||||||
* @contributors d-999
|
* @contributors d-999
|
||||||
@ -49,7 +49,7 @@
|
|||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
#ifdef ESPALEXA_DEBUG
|
#ifdef ESPALEXA_DEBUG
|
||||||
#pragma message "Espalexa 2.4.3 debug mode"
|
#pragma message "Espalexa 2.4.4 debug mode"
|
||||||
#define EA_DEBUG(x) Serial.print (x)
|
#define EA_DEBUG(x) Serial.print (x)
|
||||||
#define EA_DEBUGLN(x) Serial.println (x)
|
#define EA_DEBUGLN(x) Serial.println (x)
|
||||||
#else
|
#else
|
||||||
@ -164,7 +164,7 @@ private:
|
|||||||
json += "\",\"modelid\":\"" + modelidString(dev->getType());
|
json += "\",\"modelid\":\"" + modelidString(dev->getType());
|
||||||
json += "\",\"manufacturername\":\"Philips\",\"productname\":\"E" + String(static_cast<uint8_t>(dev->getType()));
|
json += "\",\"manufacturername\":\"Philips\",\"productname\":\"E" + String(static_cast<uint8_t>(dev->getType()));
|
||||||
json += "\",\"uniqueid\":\"" + String(encodeLightId(deviceId+1));
|
json += "\",\"uniqueid\":\"" + String(encodeLightId(deviceId+1));
|
||||||
json += "\",\"swversion\":\"espalexa-2.4.3\"}";
|
json += "\",\"swversion\":\"espalexa-2.4.4\"}";
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ private:
|
|||||||
}
|
}
|
||||||
res += "\r\nFree Heap: " + (String)ESP.getFreeHeap();
|
res += "\r\nFree Heap: " + (String)ESP.getFreeHeap();
|
||||||
res += "\r\nUptime: " + (String)millis();
|
res += "\r\nUptime: " + (String)millis();
|
||||||
res += "\r\n\r\nEspalexa library v2.4.3 by Christian Schwinne 2019";
|
res += "\r\n\r\nEspalexa library v2.4.4 by Christian Schwinne 2020";
|
||||||
server->send(200, "text/plain", res);
|
server->send(200, "text/plain", res);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -298,7 +298,7 @@ private:
|
|||||||
"SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0\r\n" // _modelName, _modelNumber
|
"SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/1.17.0\r\n" // _modelName, _modelNumber
|
||||||
"hue-bridgeid: "+ escapedMac +"\r\n"
|
"hue-bridgeid: "+ escapedMac +"\r\n"
|
||||||
"ST: urn:schemas-upnp-org:device:basic:1\r\n" // _deviceType
|
"ST: urn:schemas-upnp-org:device:basic:1\r\n" // _deviceType
|
||||||
"USN: uuid:2f402f80-da50-11e1-9b23-"+ escapedMac +"::upnp:rootdevice\r\n" // _uuid::_deviceType
|
"USN: uuid:2f402f80-da50-11e1-9b23-"+ escapedMac +"::ssdp:all\r\n" // _uuid::_deviceType
|
||||||
"\r\n";
|
"\r\n";
|
||||||
|
|
||||||
espalexaUdp.beginPacket(espalexaUdp.remoteIP(), espalexaUdp.remotePort());
|
espalexaUdp.beginPacket(espalexaUdp.remoteIP(), espalexaUdp.remotePort());
|
||||||
@ -372,7 +372,7 @@ public:
|
|||||||
String request = packetBuffer;
|
String request = packetBuffer;
|
||||||
if(request.indexOf("M-SEARCH") >= 0) {
|
if(request.indexOf("M-SEARCH") >= 0) {
|
||||||
EA_DEBUGLN(request);
|
EA_DEBUGLN(request);
|
||||||
if(request.indexOf("upnp:rootdevice") > 0 || request.indexOf("asic:1") > 0) {
|
if(request.indexOf("upnp:rootdevice") > 0 || request.indexOf("asic:1") > 0 || request.indexOf("ssdp:all") > 0) {
|
||||||
EA_DEBUGLN("Responding search req...");
|
EA_DEBUGLN("Responding search req...");
|
||||||
respondToSearch();
|
respondToSearch();
|
||||||
}
|
}
|
||||||
|
@ -130,30 +130,28 @@ uint32_t EspalexaDevice::getRGB()
|
|||||||
case 350: rgb[0]=130,rgb[1]=90,rgb[2]=0;rgb[3]=255;break;
|
case 350: rgb[0]=130,rgb[1]=90,rgb[2]=0;rgb[3]=255;break;
|
||||||
case 383: rgb[0]=255,rgb[1]=153,rgb[2]=0;rgb[3]=255;break;
|
case 383: rgb[0]=255,rgb[1]=153,rgb[2]=0;rgb[3]=255;break;
|
||||||
default: {
|
default: {
|
||||||
|
if( temp <= 66 ){
|
||||||
|
r = 255;
|
||||||
|
g = temp;
|
||||||
|
g = 99.470802 * log(g) - 161.119568;
|
||||||
|
if( temp <= 19){
|
||||||
|
b = 0;
|
||||||
|
} else {
|
||||||
|
b = temp-10;
|
||||||
|
b = 138.517731 * log(b) - 305.044793;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = temp - 60;
|
||||||
|
r = 329.698727 * pow(r, -0.13320476);
|
||||||
|
g = temp - 60;
|
||||||
|
g = 288.12217 * pow(g, -0.07551485 );
|
||||||
|
b = 255;
|
||||||
|
}
|
||||||
|
|
||||||
if( temp <= 66 ){
|
rgb[0] = (byte)constrain(r,0.1,255.1);
|
||||||
r = 255;
|
rgb[1] = (byte)constrain(g,0.1,255.1);
|
||||||
g = temp;
|
rgb[2] = (byte)constrain(b,0.1,255.1);
|
||||||
g = 99.470802 * log(g) - 161.119568;
|
|
||||||
if( temp <= 19){
|
|
||||||
b = 0;
|
|
||||||
} else {
|
|
||||||
b = temp-10;
|
|
||||||
b = 138.517731 * log(b) - 305.044793;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
r = temp - 60;
|
|
||||||
r = 329.698727 * pow(r, -0.13320476);
|
|
||||||
g = temp - 60;
|
|
||||||
g = 288.12217 * pow(g, -0.07551485 );
|
|
||||||
b = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgb[0] = (byte)constrain(r,0.1,255.1);
|
|
||||||
rgb[1] = (byte)constrain(g,0.1,255.1);
|
|
||||||
rgb[2] = (byte)constrain(b,0.1,255.1);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (_mode == EspalexaColorMode::hs)
|
} else if (_mode == EspalexaColorMode::hs)
|
||||||
{
|
{
|
||||||
@ -232,6 +230,12 @@ uint32_t EspalexaDevice::getRGB()
|
|||||||
return _rgb;
|
return _rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//white channel for RGBW lights. Always 0 unless colormode is ct
|
||||||
|
uint8_t EspalexaDevice::getW()
|
||||||
|
{
|
||||||
|
return (getRGB() >> 24) & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t EspalexaDevice::getR()
|
uint8_t EspalexaDevice::getR()
|
||||||
{
|
{
|
||||||
return (getRGB() >> 16) & 0xFF;
|
return (getRGB() >> 16) & 0xFF;
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
uint8_t getR();
|
uint8_t getR();
|
||||||
uint8_t getG();
|
uint8_t getG();
|
||||||
uint8_t getB();
|
uint8_t getB();
|
||||||
|
uint8_t getW();
|
||||||
EspalexaColorMode getColorMode();
|
EspalexaColorMode getColorMode();
|
||||||
EspalexaDeviceType getType();
|
EspalexaDeviceType getType();
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2001052
|
#define VERSION 2001071
|
||||||
char versionString[] = "0.9.0-b2";
|
char versionString[] = "0.9.0-b2";
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user