Merge branch 'main' into seg-groups

This commit is contained in:
Blaz Kristan 2023-04-20 17:21:20 +02:00
commit 02d4f9cbba
6 changed files with 22 additions and 19 deletions

View File

@ -247,6 +247,7 @@ lib_deps =
platform = espressif32@5.2.0 platform = espressif32@5.2.0
platform_packages = platform_packages =
build_flags = -g build_flags = -g
-Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
-DARDUINO_ARCH_ESP32 -DESP32 -DARDUINO_ARCH_ESP32 -DESP32
#-DCONFIG_LITTLEFS_FOR_IDF_3_2 #-DCONFIG_LITTLEFS_FOR_IDF_3_2
-D CONFIG_ASYNC_TCP_USE_WDT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
@ -314,7 +315,7 @@ build_flags = -g
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
;; NeoPixelBus 2.7.1 is the first that has official support for ESP32-S3 ;; NeoPixelBus 2.7.1 is the first that has official support for ESP32-S3
makuna/NeoPixelBus @ ~2.7.3 makuna/NeoPixelBus @ 2.7.3
https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0

View File

@ -4653,8 +4653,8 @@ uint16_t mode_2DColoredBursts() { // By: ldirko https://editor.so
byte ysteps = abs8(x2 - y2) + 1; byte ysteps = abs8(x2 - y2) + 1;
byte steps = xsteps >= ysteps ? xsteps : ysteps; byte steps = xsteps >= ysteps ? xsteps : ysteps;
//Draw gradient line //Draw gradient line
for (size_t i = 1; i <= steps; i++) { for (size_t j = 1; j <= steps; j++) {
uint8_t rate = i * 255 / steps; uint8_t rate = j * 255 / steps;
byte dx = lerp8by8(x1, y1, rate); byte dx = lerp8by8(x1, y1, rate);
byte dy = lerp8by8(x2, y2, rate); byte dy = lerp8by8(x2, y2, rate);
//SEGMENT.setPixelColorXY(dx, dy, grad ? color.nscale8_video(255-rate) : color); // use addPixelColorXY for different look //SEGMENT.setPixelColorXY(dx, dy, grad ? color.nscale8_video(255-rate) : color); // use addPixelColorXY for different look

View File

@ -1181,12 +1181,12 @@ void WS2812FX::estimateCurrentAndLimitBri() {
uint32_t powerSum = 0; uint32_t powerSum = 0;
for (uint8_t b = 0; b < busses.getNumBusses(); b++) { for (uint_fast8_t bNum = 0; bNum < busses.getNumBusses(); bNum++) {
Bus *bus = busses.getBus(b); Bus *bus = busses.getBus(bNum);
if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses if (bus->getType() >= TYPE_NET_DDP_RGB) continue; //exclude non-physical network busses
uint16_t len = bus->getLength(); uint16_t len = bus->getLength();
uint32_t busPowerSum = 0; uint32_t busPowerSum = 0;
for (uint16_t i = 0; i < len; i++) { //sum up the usage of each LED for (uint_fast16_t i = 0; i < len; i++) { //sum up the usage of each LED
uint32_t c = bus->getPixelColor(i); uint32_t c = bus->getPixelColor(i);
byte r = R(c), g = G(c), b = B(c), w = W(c); byte r = R(c), g = G(c), b = B(c), w = W(c);

View File

@ -225,7 +225,6 @@ void handleButton()
{ {
static unsigned long lastRead = 0UL; static unsigned long lastRead = 0UL;
static unsigned long lastRun = 0UL; static unsigned long lastRun = 0UL;
bool analog = false;
unsigned long now = millis(); unsigned long now = millis();
//if (strip.isUpdating()) return; // don't interfere with strip updates. Our button will still be there in 1ms (next cycle) //if (strip.isUpdating()) return; // don't interfere with strip updates. Our button will still be there in 1ms (next cycle)
@ -241,14 +240,18 @@ void handleButton()
if (usermods.handleButton(b)) continue; // did usermod handle buttons if (usermods.handleButton(b)) continue; // did usermod handle buttons
if ((buttonType[b] == BTN_TYPE_ANALOG || buttonType[b] == BTN_TYPE_ANALOG_INVERTED) && now - lastRead > ANALOG_BTN_READ_CYCLE) { // button is not a button but a potentiometer if (buttonType[b] == BTN_TYPE_ANALOG || buttonType[b] == BTN_TYPE_ANALOG_INVERTED) { // button is not a button but a potentiometer
analog = true; if (now - lastRead > ANALOG_BTN_READ_CYCLE) {
handleAnalog(b); continue; handleAnalog(b);
lastRead = now;
}
continue;
} }
//button is not momentary, but switch. This is only suitable on pins whose on-boot state does not matter (NOT gpio0) //button is not momentary, but switch. This is only suitable on pins whose on-boot state does not matter (NOT gpio0)
if (buttonType[b] == BTN_TYPE_SWITCH || buttonType[b] == BTN_TYPE_PIR_SENSOR) { if (buttonType[b] == BTN_TYPE_SWITCH || buttonType[b] == BTN_TYPE_PIR_SENSOR) {
handleSwitch(b); continue; handleSwitch(b);
continue;
} }
//momentary button logic //momentary button logic
@ -305,7 +308,6 @@ void handleButton()
shortPressAction(b); shortPressAction(b);
} }
} }
if (analog) lastRead = now;
} }
// If enabled, RMT idle level is set to HIGH when off // If enabled, RMT idle level is set to HIGH when off

View File

@ -300,10 +300,10 @@ byte PinManagerClass::allocateLedc(byte channels)
if (ca >= channels) { //enough free channels if (ca >= channels) { //enough free channels
byte in = (i + 1) - ca; byte in = (i + 1) - ca;
for (byte j = 0; j < ca; j++) { for (byte j = 0; j < ca; j++) {
byte b = in + j; byte bChan = in + j;
byte by = b >> 3; byte byChan = bChan >> 3;
byte bi = b - 8*by; byte biChan = bChan - 8*byChan;
bitWrite(ledcAlloc[by], bi, true); bitWrite(ledcAlloc[byChan], biChan, true);
} }
return in; return in;
} }

View File

@ -821,9 +821,9 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8
} }
} }
byte buffer[ART_NET_HEADER_SIZE]; byte header_buffer[ART_NET_HEADER_SIZE];
memcpy_P(buffer, ART_NET_HEADER, ART_NET_HEADER_SIZE); memcpy_P(header_buffer, ART_NET_HEADER, ART_NET_HEADER_SIZE);
ddpUdp.write(buffer, ART_NET_HEADER_SIZE); // This doesn't change. Hard coded ID, OpCode, and protocol version. ddpUdp.write(header_buffer, ART_NET_HEADER_SIZE); // This doesn't change. Hard coded ID, OpCode, and protocol version.
ddpUdp.write(sequenceNumber & 0xFF); // sequence number. 1..255 ddpUdp.write(sequenceNumber & 0xFF); // sequence number. 1..255
ddpUdp.write(0x00); // physical - more an FYI, not really used for anything. 0..3 ddpUdp.write(0x00); // physical - more an FYI, not really used for anything. 0..3
ddpUdp.write((currentPacket) & 0xFF); // Universe LSB. 1 full packet == 1 full universe, so just use current packet number. ddpUdp.write((currentPacket) & 0xFF); // Universe LSB. 1 full packet == 1 full universe, so just use current packet number.