Bugfixes for saving and loading IP address.
Debug info for UDP.
This commit is contained in:
parent
284e748449
commit
54eac18eea
@ -10,6 +10,20 @@
|
||||
#include "bus_wrapper.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
// enable additional debug output
|
||||
#ifdef WLED_DEBUG
|
||||
#ifndef ESP8266
|
||||
#include <rom/rtc.h>
|
||||
#endif
|
||||
#define DEBUG_PRINT(x) Serial.print(x)
|
||||
#define DEBUG_PRINTLN(x) Serial.println(x)
|
||||
#define DEBUG_PRINTF(x...) Serial.printf(x)
|
||||
#else
|
||||
#define DEBUG_PRINT(x)
|
||||
#define DEBUG_PRINTLN(x)
|
||||
#define DEBUG_PRINTF(x...)
|
||||
#endif
|
||||
|
||||
#define GET_BIT(var,bit) (((var)>>(bit))&0x01)
|
||||
#define SET_BIT(var,bit) ((var)|=(uint16_t)(0x0001<<(bit)))
|
||||
#define UNSET_BIT(var,bit) ((var)&=(~(uint16_t)(0x0001<<(bit))))
|
||||
@ -29,7 +43,8 @@ struct BusConfig {
|
||||
type = busType & 0x7F; // bit 7 may be/is hacked to include RGBW info (1=RGBW, 0=RGB)
|
||||
count = len; start = pstart; colorOrder = pcolorOrder; reversed = rev; skipAmount = skip;
|
||||
uint8_t nPins = 1;
|
||||
if (type > 47) nPins = 2;
|
||||
if (type == 2 || type == 3) nPins = 4;
|
||||
else if (type > 47) nPins = 2;
|
||||
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
||||
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];
|
||||
}
|
||||
@ -404,6 +419,13 @@ class BusVirtual : public Bus {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getPins(uint8_t* pinArray) {
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
pinArray[i] = _client[i];
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
inline bool isRgbw() {
|
||||
return _rgbw;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
var nm = LCs[i].name.substring(0,2);
|
||||
// ignore IP address
|
||||
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
|
||||
var n =s[i].name.substring(2);
|
||||
var n = LCs[i].name.substring(2);
|
||||
var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT
|
||||
if (t==2 || t==3) continue;
|
||||
}
|
||||
@ -50,13 +50,14 @@
|
||||
for (j=i+1; j<LCs.length; j++)
|
||||
{
|
||||
var n2 = LCs[j].name.substring(0,2);
|
||||
if (n2=="L0" || n2=="L1" || n2=="L2" || n2=="L3" || n2=="L4" || n2=="RL" || n2=="BT" || n2=="IR")
|
||||
if (n2=="L0" || n2=="L1" || n2=="L2" || n2=="L3" || n2=="L4" || n2=="RL" || n2=="BT" || n2=="IR") {
|
||||
if (n2.substring(0,1)==="L") {
|
||||
var m = LCs[j].name.substring(2);
|
||||
var t2 = parseInt(d.getElementsByName("LT"+m)[0].value, 10);
|
||||
if (t2==2 || t2==3) continue;
|
||||
}
|
||||
if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert(`Pin conflict between ${LCs[i].name}/${LCs[j].name}!`);LCs[j].value="";LCs[j].focus();return false;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,7 +206,14 @@
|
||||
// ignore IP address
|
||||
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3") {
|
||||
var t = parseInt(d.getElementsByName("LT"+n)[0].value, 10); // LED type SELECT
|
||||
if (t==2 || t==3) continue;
|
||||
if (t==2 || t==3) {
|
||||
LCs[i].max = 255;
|
||||
LCs[i].min = 0;
|
||||
continue;
|
||||
} else {
|
||||
LCs[i].max = 33;
|
||||
LCs[i].min = -1;
|
||||
}
|
||||
}
|
||||
// check for pin conflicts
|
||||
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR")
|
||||
|
File diff suppressed because one or more lines are too long
@ -558,6 +558,21 @@ uint8_t realtimeBroadcast(IPAddress client, uint16_t length, uint8_t *buffer, bo
|
||||
if (channelCount % DDP_CHANNELS_PER_PACKET) {
|
||||
packetCount++;
|
||||
}
|
||||
DEBUG_PRINT(F("RT: "));
|
||||
DEBUG_PRINT(client[0]);
|
||||
DEBUG_PRINT(".");
|
||||
DEBUG_PRINT(client[1]);
|
||||
DEBUG_PRINT(".");
|
||||
DEBUG_PRINT(client[2]);
|
||||
DEBUG_PRINT(".");
|
||||
DEBUG_PRINT(client[3]);
|
||||
DEBUG_PRINT(" (");
|
||||
DEBUG_PRINT(length);
|
||||
DEBUG_PRINTLN(")");
|
||||
DEBUG_PRINT("Channels: ");
|
||||
DEBUG_PRINTLN(channelCount);
|
||||
DEBUG_PRINT("Packets: ");
|
||||
DEBUG_PRINTLN(packetCount);
|
||||
|
||||
// there are 3 channels per RGB pixel
|
||||
uint16_t channel = 0; // TODO: allow specifying the start channel
|
||||
@ -567,9 +582,13 @@ uint8_t realtimeBroadcast(IPAddress client, uint16_t length, uint8_t *buffer, bo
|
||||
for (uint16_t currentPacket = 0; currentPacket < packetCount; currentPacket++) {
|
||||
if (sequenceNumber > 15) sequenceNumber = 0;
|
||||
|
||||
DEBUG_PRINTLN(F("Opening UDP."));
|
||||
return 0;
|
||||
// the following will reboot ESP since when 1st called WiFi is not yet connected
|
||||
|
||||
int rc = ddpUdp.beginPacket(client, DDP_PORT);
|
||||
if (rc == 0) {
|
||||
//DEBUG_PRINTLN("WiFiUDP.beginPacket returned an error");
|
||||
DEBUG_PRINTLN(F("WiFiUDP.beginPacket returned an error"));
|
||||
return 1; // problem
|
||||
}
|
||||
|
||||
@ -586,6 +605,7 @@ uint8_t realtimeBroadcast(IPAddress client, uint16_t length, uint8_t *buffer, bo
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINTLN(F("Preparing packet."));
|
||||
// write the header
|
||||
/*0*/ddpUdp.write(flags);
|
||||
/*1*/ddpUdp.write(sequenceNumber++ & 0xF);
|
||||
@ -609,9 +629,10 @@ uint8_t realtimeBroadcast(IPAddress client, uint16_t length, uint8_t *buffer, bo
|
||||
if (isRGBW) bufferOffset++;
|
||||
}
|
||||
|
||||
DEBUG_PRINTLN(F("Sending packet."));
|
||||
rc = ddpUdp.endPacket();
|
||||
if (rc == 0) {
|
||||
//DEBUG_PRINTLN("WiFiUDP.endPacket returned an error");
|
||||
DEBUG_PRINTLN("WiFiUDP.endPacket returned an error");
|
||||
return 1; // problem
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
uint8_t nPins = bus->getPins(pins);
|
||||
for (uint8_t i = 0; i < nPins; i++) {
|
||||
lp[1] = 48+i;
|
||||
if (pinManager.isPinOk(pins[i])) sappend('v',lp,pins[i]);
|
||||
if (pinManager.isPinOk(pins[i]) || bus->getType()<20) sappend('v',lp,pins[i]);
|
||||
}
|
||||
sappend('v',lc,bus->getLength());
|
||||
sappend('v',lt,bus->getType());
|
||||
|
Loading…
Reference in New Issue
Block a user