diff --git a/data/config.json b/data/config.json index 88fa28c5..b229dd48 100644 --- a/data/config.json +++ b/data/config.json @@ -3,8 +3,8 @@ "chipID": "", "apssid": "IoTmanager", "appass": "", - "routerssid": "VOLODYA", - "routerpass": "BELCHENKO", + "routerssid": "rise", + "routerpass": "hostel3333", "timezone": 1, "ntp": "pool.ntp.org", "mqttServer": "m12.cloudmqtt.com", diff --git a/data/widgets/chart.json b/data/widgets/chart.json index 9ecc61e3..878ce0e4 100644 --- a/data/widgets/chart.json +++ b/data/widgets/chart.json @@ -1,4 +1,5 @@ { "widget": "chart", - "dateFormat": "HH:mm" + "dateFormat": "HH:mm", + "pointRadius": 0 } \ No newline at end of file diff --git a/include/Consts.h b/include/Consts.h index e0679110..e22011ba 100644 --- a/include/Consts.h +++ b/include/Consts.h @@ -31,7 +31,7 @@ //#define MDNS_ENABLED //#define WEBSOCKET_ENABLED //#define LAYOUT_IN_RAM -//#define UDP_ENABLED +#define UDP_ENABLED //#define SSDP_ENABLED //=========Sensors enable/disable================================================================================================================================= diff --git a/src/RemoteOrdersUdp.cpp b/src/RemoteOrdersUdp.cpp index 6187d0bd..b91cd642 100644 --- a/src/RemoteOrdersUdp.cpp +++ b/src/RemoteOrdersUdp.cpp @@ -6,22 +6,21 @@ AsyncUDP asyncUdp; void asyncUdpInit() { - //if (asyncUdp.listen(1234)) { - if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 1234)) { + if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 4210)) { asyncUdp.onPacket([](AsyncUDPPacket packet) { - //Serial.print("UDP Packet Type: "); - //Serial.print(packet.isBroadcast() ? "Broadcast" : packet.isMulticast() ? "Multicast" : "Unicast"); - // - //Serial.print(", From: "); - //Serial.print(packet.remoteIP()); - //Serial.print(":"); - //Serial.print(packet.remotePort()); - // - //Serial.print(", To: "); - //Serial.print(packet.localIP()); - //Serial.print(":"); - //Serial.print(packet.localPort()); - // + Serial.print("UDP Packet Type: "); + Serial.println(packet.isBroadcast() ? "Broadcast" : packet.isMulticast() ? "Multicast" : "Unicast"); + + Serial.print("From: "); + Serial.print(packet.remoteIP()); + Serial.print(":"); + Serial.println(packet.remotePort()); + + Serial.print("To: "); + Serial.print(packet.localIP()); + Serial.print(":"); + Serial.println(packet.localPort()); + //Serial.print(", Length: "); //Serial.print(packet.length()); // @@ -34,15 +33,33 @@ void asyncUdpInit() { if (udpPacketValidation(data)) { udpPacketParse(data); //Serial.println("', Packet valid"); - } else { + } + else { //Serial.println("', Packet invalid"); } //reply to the client - packet.printf("Got %u bytes of data", packet.length()); + String ip = WiFi.localIP().toString(); + asyncUdp.broadcastTo(ip.c_str(), packet.remotePort()); + + //packet.printf(ip.c_str(), packet.length()); + }); } + + //ts.add( + // UDP, 10000, [&](void*) { + // + // //Serial.println("sended"); + // + // //asyncUdp.broadcastTo("Anyone here?", 5351); + // //asyncUdp.broadcast("test"); + // //asyncUdp.print("Hello Server!"); + // + // }, + // nullptr, true); + } String uint8tToString(uint8_t* data, size_t len) { @@ -56,7 +73,8 @@ String uint8tToString(uint8_t* data, size_t len) { bool udpPacketValidation(String& data) { if (data.indexOf("iotm;") != -1 && data.indexOf(getChipId()) != -1) { return true; - } else { + } + else { return false; } }