ota update first version, with led management
This commit is contained in:
@@ -12,6 +12,7 @@ namespace drivers
|
||||
pinMode(c_ledPin, OUTPUT);
|
||||
m_blinkTask = NULL;
|
||||
m_flashTimer = NULL;
|
||||
m_enforce = false;
|
||||
}
|
||||
|
||||
Led::~Led()
|
||||
@@ -20,9 +21,16 @@ namespace drivers
|
||||
pinMode(c_ledPin, INPUT);
|
||||
}
|
||||
|
||||
void Led::setEnforce(const bool enf)
|
||||
{
|
||||
m_enforce = enf;
|
||||
}
|
||||
|
||||
void Led::setColor(const color_t color)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_ledMutex);
|
||||
if (m_enforce)
|
||||
return;
|
||||
blinkStop();
|
||||
m_colorDefault = color;
|
||||
rgbLedWrite(c_ledPin, color.g, color.r, color.b);
|
||||
@@ -58,6 +66,8 @@ namespace drivers
|
||||
void Led::blinkColor(const uint16_t tOn, const uint16_t tOff, const color_t color)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_ledMutex);
|
||||
if (m_enforce)
|
||||
return;
|
||||
blinkStop();
|
||||
m_color1 = color;
|
||||
m_color2 = {0, 0, 0};
|
||||
@@ -69,6 +79,8 @@ namespace drivers
|
||||
void Led::blinkAlternate(const uint16_t tOn, const uint16_t tOff, const color_t color1, const color_t color2)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_ledMutex);
|
||||
if (m_enforce)
|
||||
return;
|
||||
blinkStop();
|
||||
m_color1 = color1;
|
||||
m_color2 = color2;
|
||||
|
||||
Reference in New Issue
Block a user