mirror of
https://github.com/anklimov/lighthub
synced 2025-12-09 13:19:50 +03:00
DMX flickering bug fixed, RGB on PWM
This commit is contained in:
@@ -358,8 +358,8 @@ if (store->pollingRegisters && !modbusBusy && (Status() == CST_INITIALIZED) && i
|
||||
debugSerial<<F("endPoll ")<< item->itemArr->name << endl;
|
||||
|
||||
//Non blocking waiting to release line
|
||||
uint32_t time = millis()+50;
|
||||
while (millis()<time)
|
||||
uint32_t time = millis();
|
||||
while (!isTimeOver(time,millis(),50))
|
||||
modbusIdle();
|
||||
|
||||
modbusBusy =0;
|
||||
|
||||
@@ -102,10 +102,14 @@ int out_pwm::getChanType()
|
||||
switch (numArgs)
|
||||
{
|
||||
case 3:
|
||||
debugSerial<<F("RGB PWM")<<endl;
|
||||
return CH_RGB;
|
||||
|
||||
case 4:
|
||||
debugSerial<<F("RGBW PWM")<<endl;
|
||||
return CH_RGBW;
|
||||
default:
|
||||
debugSerial<<item->itemType<<F(" PWM")<<endl;
|
||||
return item->itemType;
|
||||
}
|
||||
}
|
||||
@@ -118,6 +122,7 @@ if (!item || !iaddr || !show) return 0;
|
||||
|
||||
bool inverse = (item->getArg()<0);
|
||||
short cType = getChanType();
|
||||
uint8_t storageType;
|
||||
|
||||
switch (cmd.getCmd()){
|
||||
case CMD_OFF:
|
||||
@@ -125,14 +130,27 @@ switch (cmd.getCmd()){
|
||||
break;
|
||||
}
|
||||
|
||||
if (cType=CH_PWM)
|
||||
|
||||
switch (cType)
|
||||
{
|
||||
case CH_PWM:
|
||||
{ short k;
|
||||
analogWrite(iaddr, k=cmd.getPercents255(inverse));
|
||||
debugSerial<<F("Pin:")<<iaddr<<F("=")<<k<<endl;
|
||||
return 1;
|
||||
}
|
||||
case CH_RGB:
|
||||
storageType=ST_RGB;
|
||||
break;
|
||||
case CH_RGBW:
|
||||
storageType=ST_RGBW;
|
||||
break;
|
||||
default:
|
||||
storageType=ST_PERCENTS;
|
||||
}
|
||||
|
||||
itemCmd st(storageType,CMD_VOID);
|
||||
|
||||
itemCmd st(ST_RGB,CMD_VOID);
|
||||
st.assignFrom(cmd);
|
||||
|
||||
switch (cType)
|
||||
|
||||
Reference in New Issue
Block a user