Example #1
0
void
LTBDots::addPat(Pattern *pat)
{
	// find end of pattern chain
	if (pats == NULL)
		pats = pat;				// just set this as the first pat in the strip
	else
	{
		Pattern *ptr = pats;
		while (!ptr->isLast())
		{
			ptr = ptr->Nxt();
		}
		ptr->Append(pat);
	}
}
Example #2
0
void
LTBDots::setOnLvl(uint8_t pct)
{
	//	dim each pattern in strip

	if (pats == NULL)
		return;					// empty strip, just return
	else
	{
		Pattern *ptr = pats;
		do
		{
			ptr->setOnLvl(pct);
			ptr = ptr->Nxt();
		} while (!ptr->isLast());
		ptr->setOnLvl(pct);		// take care of the last one
	}
}
Example #3
0
void
LTBDots::printStrip(char *title, bool dotsOnly)
{
	Serial.print("\n<<STRIP -   "); Serial.print(title); Serial.println(" - STRIP >> ");
	if (dotsOnly)
		Serial.println("*** DOTS ONLY ***");
	else
	{
		Serial.print("this    = 0x"); Serial.println((uint16_t)this, 16);
		Serial.print("MaxPix  =   "); Serial.println(nPix);
		Serial.print("dots  =   0x"); Serial.println((uint16_t)dots);
		Serial.print("lastMS  =   "); Serial.println(lastMsec);
	}
	Serial.println("Pix\tTag\tBlu\tGrn\tRed");
	for (int i = 0; i < nPix; i++)
	{
		Serial.print(""); Serial.print(i);
		Serial.print("\t0x"); Serial.print(  dots[i * 4 +0], HEX);
		Serial.print("\t0x"); Serial.print(  dots[i * 4 +1], HEX);
		Serial.print("\t0x"); Serial.print(  dots[i * 4 +2], HEX);
		Serial.print("\t0x"); Serial.println(dots[i * 4 +3], HEX);
	}

	if (pats == NULL)
		Serial.println("No Patterns");
	else
	{
		Pattern *ptr = pats;

		while (true)
		{
			ptr->printPat(title);
			if (ptr->isLast())
				break;
			ptr = ptr->Nxt();
		}
	}
}
Example #4
0
void
LTBDots::showLights(bool force)
{
	Pattern *ptr = pats;
	bool changed = false;

	uint16_t deltaMsec = millis() - lastMsec;
	lastMsec = millis();
	/**  Loop through all pats and update timed actions **/
	//	while(ptr)			// first loop through all patterns and update timed actions
	//	{
	//		changed = (changed || ptr->doActions(deltaMsec));
	//		ptr=ptr->Nxt();
	//	}	

	if (changed || force)
	{
		ptr = pats;
		curStrip= dots;
		/**  Loop through all pats and light them **/
		while (ptr)
		{
			curStrip = ptr->fillRGB(curStrip);
			ptr = ptr->Nxt();
		}
	}
	printStrip("prePaint");
	sendLeader();
	dp= dots;

	while (dp != curStrip)
		SPI.transfer(*dp++);
	sendTrailer();

	return;
}