A Few Fixes

Removed debug serial output
Fix bug in animator where it would stop processing animations too early
Added NeoGrbwFeature for common RGBW strips
Cleaned up a sample that misbehaves if you change the pixel count
This commit is contained in:
Makuna
2016-04-02 16:09:10 -07:00
parent 89dcbb7648
commit 9ae3aee7be
5 changed files with 50 additions and 32 deletions
+40 -12
View File
@@ -55,7 +55,7 @@ public:
class NeoGrbFeature : public Neo3Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, Neo3Elements::ColorObject color)
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
@@ -64,9 +64,9 @@ public:
*p = color.B;
}
static Neo3Elements::ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
{
Neo3Elements::ColorObject color;
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.G = *p++;
@@ -77,10 +77,38 @@ public:
}
};
class NeoGrbwFeature : public Neo4Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
*p++ = color.G;
*p++ = color.R;
*p++ = color.B;
*p = color.W;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.G = *p++;
color.R = *p++;
color.B = *p++;
color.W = *p;
return color;
}
};
class NeoRgbwFeature : public Neo4Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, Neo4Elements::ColorObject color)
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
@@ -90,9 +118,9 @@ public:
*p = color.W;
}
static Neo4Elements::ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
{
Neo4Elements::ColorObject color;
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.R = *p++;
@@ -107,7 +135,7 @@ public:
class NeoRgbFeature : public Neo3Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, Neo3Elements::ColorObject color)
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
@@ -116,9 +144,9 @@ public:
*p = color.B;
}
static Neo3Elements::ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
{
Neo3Elements::ColorObject color;
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.R = *p++;
@@ -132,7 +160,7 @@ public:
class NeoBrgFeature : public Neo3Elements
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, Neo3Elements::ColorObject color)
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint8_t* p = getPixelAddress(pPixels, indexPixel);
@@ -141,9 +169,9 @@ public:
*p = color.G;
}
static Neo3Elements::ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
{
Neo3Elements::ColorObject color;
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.B = *p++;
-8
View File
@@ -150,14 +150,6 @@ public:
_i2sBufDesc[indexDesc].unused = 0;
_i2sBufDesc[indexDesc].next_link_ptr = (uint32_t)&(_i2sBufDesc[indexDesc + 1]);
Serial.print("block #");
Serial.print(indexDesc);
Serial.print(" 0x");
Serial.print(_i2sBufDesc[indexDesc].buf_ptr, HEX);
Serial.print(" (");
Serial.print(_i2sBufDesc[indexDesc].blocksize);
Serial.println(")");
is2Buffer += blockSize;
is2BufferSize -= blockSize;
}
+1 -6
View File
@@ -117,12 +117,11 @@ void NeoPixelAnimator::UpdateAnimations()
if (delta >= _timeScale)
{
uint16_t countAnimations = _activeAnimations;
AnimationContext* pAnim;
delta /= _timeScale; // scale delta into animation time
for (uint16_t iAnim = 0; iAnim < _countAnimations && countAnimations > 0; iAnim++)
for (uint16_t iAnim = 0; iAnim < _countAnimations; iAnim++)
{
pAnim = &_animations[iAnim];
AnimUpdateCallback fnUpdate = pAnim->_fnCallback;
@@ -138,8 +137,6 @@ void NeoPixelAnimator::UpdateAnimations()
fnUpdate(param);
pAnim->_remaining -= delta;
countAnimations--;
}
else if (pAnim->_remaining > 0)
{
@@ -150,8 +147,6 @@ void NeoPixelAnimator::UpdateAnimations()
pAnim->StopAnimation();
fnUpdate(param);
countAnimations--;
}
}