#include "dmx.h" //#include //#include //#include uint8_t * DMXin = NULL; int D_State=0; unsigned long D_checkT=0; Artnet *artnet = NULL; aJsonObject *dmxArr = NULL; void DMXImmediateUpdate(short tch,short r, short g, short b, short w) { //Here only safe re-interable code for quick passthrow between DMX IN and DMX OUT if (dmxArr && (dmxArr->type==aJson_Array)) { char* itemname = aJson.getArrayItem(dmxArr,tch)->valuestring; itemCtrl2(itemname,r,g,b,w); } } void DMXSemiImmediateUpdate(short tch,short trh, int val) { //Here any code for passthrow between DMX IN and DMX OUT in idle state } void DMXput(void) { int t; for (short tch=0; tch<=3 ; tch++) { short base = tch*4; DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]); } }; void DMXUpdate(void) { int t; for (short tch=0; tch<=3 ; tch++) { short base = tch*4; bool updated = 0; for (short trh=0; trh<4 ; trh++) if ((t=DMXSerial.read(base+trh+1)) != DMXin[base+trh]) { D_State |= (1< "); Serial.print(t);Serial.println(); DMXin[base+trh]=t; //DMXImmediateUpdate(tch,trh,t); //break; } if (updated) { DMXImmediateUpdate(tch,DMXin[base],DMXin[base+1],DMXin[base+2],DMXin[base+3]); D_checkT=millis()+D_CHECKT; } } //Serial.print(D_State,BIN);Serial.println(); } void DMXCheck(void) { // CHSV hsv; // CRGB rgb; short t,tch; //Here code for semi-immediate update for (t=1,tch=0; t<=8 ; t<<=1,tch++) if (D_State & t) { // Serial.print(D_State,BIN);Serial.print(":"); D_State &= ~t; for (short trh=0; trh<4 ; trh++) DMXSemiImmediateUpdate(tch,trh,DMXin[tch*4+trh]); } if ((millis()setArtDmxCallback(onDmxFrame); } void ArtnetSetup() { if (!artnet) artnet = new Artnet; // this will be called for each packet received if (artnet) artnet->setArtDmxCallback(onDmxFrame); }