You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an ESP32 WT32-ETH01 V1.4 and compiling using Arduino IDE, this board has the ethernet interface embedded.
Since it's an ESP32 I need to use the ArtnetETH, it can connect without problem and the device gets detected on any light control programs without problem.
Eventually I'll use the data to light up a led strip, but first I wanted to stress test how many universes I could process.
The library works wonders up to 6 universes, but when doing 7 or more the callback for those wasn't being called as often.
So I tried making this code to represent what I'm facing.
On this code it shows the frequency that the device receives all the expected universes, so if we expect 6 universes it uses a mask to save which universes we already got callbacks and when it reaches all 6 we calculate the frequency.
The mask is set to show up to 12 universes, so when parsing universe index 2 it would show 000000000100, when expecting 6 universes the mask needs to fill to 000000111111 and only then it will calculate the frequency, expecting 12 universes would need to fill all of the mask 111111111111.
#include<ArtnetETH.h>
#include<Arduino.h>const IPAddress ip(192, 168, 0, 30);
const IPAddress gateway(192, 168, 0, 1);
const IPAddress subnet(255, 255, 255, 0);
ArtnetReceiver artnet;
// Bitmask to track which universes have been receiveduint16_t receivedUniversesMask = 0;
constuint8_t numUniverses = 7;
constuint8_t startUniverse = 0;
uint16_t allUniversesMask = ((1 << numUniverses) - 1) << startUniverse;
// Variable to track frequencyunsignedlong lastPrintTime = 0;
voidsetup() {
Serial.begin(115200);
delay(500);
ETH.begin();
ETH.config(ip, gateway, subnet);
artnet.begin();
for (uint16_t i = startUniverse; i < startUniverse + numUniverses; i++) {
artnet.subscribeArtDmxUniverse(i, callback);
}
}
voidloop() {
artnet.parse(); // Check for Art-Net packets and process them// Check if all universes have been receivedif (receivedUniversesMask == allUniversesMask) {
unsignedlong currentTime = millis();
unsignedlong timeElapsed = currentTime - lastPrintTime;
lastPrintTime = currentTime;
// Calculate frequency in Hz and FPSfloat frequencyHz = 1000.0 / timeElapsed;
// Print the time and frequency
Serial.print("Time since all universes were received: ");
Serial.print(timeElapsed);
Serial.print(" ms, Frequency: ");
Serial.print(frequencyHz);
Serial.println(" Hz");
receivedUniversesMask = 0; // Reset the bitmask
}
}
voidcallback(constuint8_t *data, constuint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) {
// Update the bitmask to indicate this universe has been received
receivedUniversesMask |= (1 << metadata.universe);
printReceivedUniversesMask(metadata.universe, receivedUniversesMask);
}
voidprintReceivedUniversesMask(uint8_t universe, uint16_t mask) {
Serial.print("Parsed universe/current mask: ");
// Print the universe as a bitmaskfor (int i = 11; i >= 0; i--) { // 12 bits (for 12 universes)
Serial.print((universe == i) ? '1' : '0');
}
Serial.print("/");
// Loop through each bit in the mask from the most significant to the least significantfor (int i = 11; i >= 0; i--) { // 12 bits (for 12 universes)
Serial.print((receivedUniversesMask & (1 << i)) ? '1' : '0');
}
Serial.println();
}
My preferred fixture program uses 25hz as default and when doing 6 universes I get that consistent frequency.
But when I add the 7th universe I still only get the consistent 6 universes while the 7th one fails to get callbacks.
Going up to 12 universes the problem persists.
Changing the starting universe makes no difference, the first 6 universes will update properly, but the 7th forward would get inconsistent callbacks.
I know that the ESP32 is capable of handling more universes, after all there's a lot of chinese artnet interfaces using ESP32 that can handle way more than 6 universes.
Looking at the closed issues list I could see that there might be limitations on the device memory, I don't think this is the case since checking the free heap memory states there's more than 200k available, also the chinese devices corroborate that this doesn't seem to be the problem.
Since I've read people being able to use this library to process more universes I believe that it's indeed a problem with the ETH library and I'll probably post it to espressif github eventually, but decided to report my findings here just in case because this info might be helpful to someone in the future.
The text was updated successfully, but these errors were encountered:
I'm using an ESP32 WT32-ETH01 V1.4 and compiling using Arduino IDE, this board has the ethernet interface embedded.
Since it's an ESP32 I need to use the ArtnetETH, it can connect without problem and the device gets detected on any light control programs without problem.
Eventually I'll use the data to light up a led strip, but first I wanted to stress test how many universes I could process.
The library works wonders up to 6 universes, but when doing 7 or more the callback for those wasn't being called as often.
So I tried making this code to represent what I'm facing.
On this code it shows the frequency that the device receives all the expected universes, so if we expect 6 universes it uses a mask to save which universes we already got callbacks and when it reaches all 6 we calculate the frequency.
The mask is set to show up to 12 universes, so when parsing universe index 2 it would show 000000000100, when expecting 6 universes the mask needs to fill to 000000111111 and only then it will calculate the frequency, expecting 12 universes would need to fill all of the mask 111111111111.
My preferred fixture program uses 25hz as default and when doing 6 universes I get that consistent frequency.
But when I add the 7th universe I still only get the consistent 6 universes while the 7th one fails to get callbacks.
Going up to 12 universes the problem persists.
Changing the starting universe makes no difference, the first 6 universes will update properly, but the 7th forward would get inconsistent callbacks.
I know that the ESP32 is capable of handling more universes, after all there's a lot of chinese artnet interfaces using ESP32 that can handle way more than 6 universes.
Looking at the closed issues list I could see that there might be limitations on the device memory, I don't think this is the case since checking the free heap memory states there's more than 200k available, also the chinese devices corroborate that this doesn't seem to be the problem.
One similar problem was posted by damienrivoal on Nov 13, 2021 but that solution is for the arduino Ethernet library and doesn't apply to the espressif ETH library.
Since I've read people being able to use this library to process more universes I believe that it's indeed a problem with the ETH library and I'll probably post it to espressif github eventually, but decided to report my findings here just in case because this info might be helpful to someone in the future.
The text was updated successfully, but these errors were encountered: