DUE DMX-IN fix

This commit is contained in:
2018-04-17 23:24:29 +03:00
parent 4f340d780f
commit 3a66d916dd
2 changed files with 58 additions and 50 deletions

View File

@@ -49,6 +49,7 @@ extern aJsonObject *dmxArr;
int itemCtrl2(char* name,int r,int g, int b, int w)
{
if (!items) return 0;
aJsonObject *itemArr= aJson.getObjectItem(items, name);
if (itemArr && (itemArr->type==aJson_Array))
@@ -88,6 +89,7 @@ int itemCtrl2(char* name,int r,int g, int b, int w)
} //itemtype
// break;
} //if have correct array
return 1;
}
@@ -97,7 +99,7 @@ void DMXImmediateUpdate(short tch,short r, short g, short b, short w) {
{
char* itemname = aJson.getArrayItem(dmxArr,tch)->valuestring;
itemCtrl2(itemname,r,g,b,w);
if (itemname) itemCtrl2(itemname,r,g,b,w);
}
}
@@ -121,6 +123,10 @@ void DMXUpdate(void)
{
#if defined(_dmxin)
int t;
if(!DMXin) return;
#if defined(__SAM3X8E__)
if (dmxin.getRxLength()<16) return;
#endif
for (short tch=0; tch<=3 ; tch++)
{
short base = tch*4;
@@ -207,9 +213,8 @@ void DMXinSetup(int channels)
#endif
#if defined(__SAM3X8E__)
dmxin.begin();
dmxin.setRxEvent(DMXUpdate);
dmxin.begin();
#endif
#endif

View File

@@ -1,3 +1,8 @@
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved.
*
Licensed under the Apache License, Version 2.0 (the "License");
@@ -550,7 +555,6 @@ void applyConfig() {
Serial.println(maxChannels);
}
#endif
#ifdef _dmxin
int itemsCount;
dmxArr = aJson.getObjectItem(root, "dmxin");
@@ -560,7 +564,6 @@ void applyConfig() {
Serial.println(itemsCount * 4);
}
#endif
#ifdef _modbus
modbusArr = aJson.getObjectItem(root, "modbus");
#endif