Checkpoint commit with fauxmoESP in the firmware folder, rather than the library version. This is to test with a possibly newer library version.

This commit is contained in:
David
2021-10-07 17:48:59 +00:00
parent 74543a99f8
commit c47c37a891
3 changed files with 17 additions and 12 deletions

View File

@@ -93,8 +93,10 @@ void fauxmoESP::_nextUDPResponse() {
void fauxmoESP::_onUDPData(IPAddress remoteIP, unsigned int remotePort, void *data, size_t len) {
if (!_enabled) return;
if (!_enabled) {
DEBUG_MSG_FAUXMO("onUDPData\n");
return;
}
char * p = (char *) data;
p[len] = 0;
@@ -258,7 +260,10 @@ void fauxmoESP::_handleIcon(AsyncClient *client, unsigned int device_id, void *d
void fauxmoESP::_onTCPData(AsyncClient *client, unsigned int device_id, void *data, size_t len) {
if (!_enabled) return;
if (!_enabled) {
DEBUG_MSG_FAUXMO("onTCPData ! _enabled\n");
return;
}
#ifdef DEBUG_FAUXMO
char * p = (char *) data;
@@ -387,12 +392,12 @@ unsigned char fauxmoESP::addDevice(const char * device_name) {
// Create UUID
char uuid[15];
snprintf_P(uuid, sizeof(uuid), PSTR("444556%06X%02X\0"), chip_id, device_id); // "DEV" + CHIPID + DEV_ID
snprintf_P(uuid, sizeof(uuid), PSTR("444776%06X%02X\0"), chip_id, device_id); // "DEV" + CHIPID + DEV_ID
new_device.uuid = strdup(uuid);
// Create Serialnumber
char serial[15];
sprintf(serial, "221703K0%06X", (uint32)chip_id); // "221703K0" + CHIPID
sprintf(serial, "221793K0%06X", (uint32)chip_id); // "221703K0" + CHIPID
new_device.serial = strdup(serial);
// TCP Server
@@ -439,6 +444,7 @@ void fauxmoESP::handle() {
int len = _udp.parsePacket();
if (len > 0) {
DEBUG_MSG_FAUXMO("[FAUXMO] handle %d bytes\n", len);
IPAddress remoteIP = _udp.remoteIP();
unsigned int remotePort = _udp.remotePort();
uint8_t data[len];
@@ -464,16 +470,15 @@ void fauxmoESP::enable(bool enable) {
}
fauxmoESP::fauxmoESP(unsigned int port) {
_base_port = port;
#ifdef ESP8266
// Start UDP server on STA connection
_handler = WiFi.onStationModeGotIP([this](WiFiEventStationModeGotIP ipInfo) {
(void) ipInfo;
// Start UDP server on STA connection
_handler = WiFi.onStationModeGotIP([this](WiFiEventStationModeGotIP ipInfo) {
(void) ipInfo;
_udp.beginMulticast(WiFi.localIP(), UDP_MULTICAST_IP, UDP_MULTICAST_PORT);
DEBUG_MSG_FAUXMO("[FAUXMO] UDP server started\n");
});
});
#endif
}