Add KNX DALI Gateway Module and Message Queue Implementation
- Introduced KnxDaliModule class for handling DALI message queuing, commissioning, and KNX group-object dispatch. - Implemented Message and MessageQueue classes for managing message operations. - Removed obsolete OpenKNX IDF component files and CMake configurations. - Updated submodule reference for KNX. Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
#include "dali_helper.h"
|
||||
|
||||
uint8_t DaliHelper::percentToArc(uint8_t value)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//Todo also include _max
|
||||
uint8_t arc = roundToInt(((253/3.0)*(std::log10(value)+1)) + 1);
|
||||
return arc;
|
||||
}
|
||||
|
||||
uint8_t DaliHelper::arcToPercent(uint8_t value)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//Todo also include _max
|
||||
double arc = std::pow(10, ((value-1) / (253/3.0)) - 1);
|
||||
return roundToInt(arc);
|
||||
}
|
||||
|
||||
float DaliHelper::arcToPercentFloat(uint8_t value)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//Todo also include _max
|
||||
float arc = std::pow(10, ((value-1) / (253/3.0)) - 1);
|
||||
return arc;
|
||||
}
|
||||
|
||||
uint8_t DaliHelper::roundToInt(double input)
|
||||
{
|
||||
double temp = input + 0.5;
|
||||
return (uint8_t)temp;
|
||||
}
|
||||
Reference in New Issue
Block a user