mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
DUE DMX-IN fix
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user