The video buffer is already pre-cleared by virtue of being in the BSS, so

don't bother to do it in Init().
It's harmless to allow a Flip() in single-buffer mode.
Saves another 62 bytes of code.
This commit is contained in:
root
2013-08-30 02:31:32 +00:00
parent 1d80dc2d45
commit a570bd9546
+8 -15
View File
@@ -267,10 +267,7 @@ void LedSign::Init(uint8_t mode)
backTimer = &timer[1];
frontTimer = &timer[0];
SetBrightness(127);
// Clear the buffer and display it
LedSign::Clear(0);
LedSign::SetBrightness(127);
// Then start the display
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
@@ -303,16 +300,13 @@ void LedSign::Init(uint8_t mode)
*/
void LedSign::Flip(bool blocking)
{
if (displayMode & DOUBLE_BUFFER)
{
// Just set the flip flag, the buffer will flip between redraws
videoFlipPage = true;
// Just set the flip flag, the buffer will flip between redraws
videoFlipPage = true;
// If we are blocking, sit here until the page flips.
if (blocking)
while (videoFlipPage)
;
}
// If we are blocking, sit here until the page flips.
if (blocking)
while (videoFlipPage)
;
}
#endif
@@ -546,9 +540,8 @@ ISR(TIMER1_COMPA_vect) {
#ifdef DOUBLE_BUFFER
// If the page should be flipped, do it here.
if (videoFlipPage && (displayMode & DOUBLE_BUFFER))
if (videoFlipPage)
{
// TODO: is this an atomic operation?
videoFlipPage = false;
videoPage* temp = displayBuffer;