mtongnz / ESP8266_ArtNetNode_v2

ESP8266 based WiFi ArtNet to DMX, RDM and LED Pixels
GNU General Public License v3.0
606 stars 158 forks source link

random glitches on DMX received data #138

Open antoniomechas opened 2 years ago

antoniomechas commented 2 years ago

Hello, I'm using the library as a DMX receiver from an ENTTEC USB PRO. It kind of works, but I get random values time to time, even when the values I'm sending stay stable without modification.

The relevant code I'm using:

void setup() 
  {

    WiFiOff();

    dmxA.begin();
    dmxA.dmxIn(true);

    dmxA.setInputCallback(dmxIn);

    delay(1000);

  } // setup

  void dmxIn(uint16_t num) {
      // Double buffer switch
      //byte* tmp = dataIn;
      dataIn = dmxA.getChans();
      //dmxA.setBuffer(tmp);

      newDmxIn = true;
  }

  void loop() {

      //dmxA.handler();
      if (newDmxIn)
      {
          analogWrite(PIN_LASER, dataIn[1]);
          newDmxIn = false;
          lastDMX = millis();
          singleGreen();
      }

      if (millis() - lastDMX > 2000)
          singleRed();

      delay(1);

  } // loop

I get the laser glitching even when the value of the channel stays to 255.

If I put all the channels at the same value, it seems to get a bit more stable.

Any thoughts what could I test?

Thanks! Antonio.

antoniomechas commented 2 years ago

Digging a little bit more... it happens with the Lolin Wemos D1 pro... if I use a wemos D1 mini, the glitches dissapear. I have no clue why it happens. Antonio.