Missing bugfix added.

This commit is contained in:
Kai Lauterbach 2014-06-22 13:30:58 +02:00
parent 4c97e0a5f5
commit 119e9889c9

View file

@ -81,8 +81,8 @@ ISR (TIMER1_COMPA_vect)
delay = (frame >> 24) & 0xf8;
}
// PORTD = __, 9, C, B, A,D+,D-,__
PORTD &= 0b10000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2; bit 6 = wire 9 to the LEDs)
// !!!Don't touch the 6th bit (9th LED wire)!!!
PORTD &= 0b11000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2
uint8_t tmp = level * 9; // calculate the position in the frame
@ -91,13 +91,20 @@ ISR (TIMER1_COMPA_vect)
PORTB = ~((frame >> tmp) & 0xff);
if ( (((frame >> tmp) >> 8) & 0x01) )
PORTD &= ~(1 << 6); // turn the 9th LED on if required
PORTD &= ~(1 << 6); // turn the 9th LED on
else
PORTD |= (1 << 6); // turn the 9th LED off
PORTD |= (1 << 6) | ((1 << level) << 3); // set the current level and pin 6 to high (9th LEDs off)
// set the current level to high
// at this point the LED pins are up to date so it's
// safe to reenable the level wire (A/B/C)
// this prevents wierd LED flashing which is not defined
// in the animation frame
PORTD |= ((1 << level) << 3);
// rotate through the 3 level
level++;
if (level > 2) level = 0;
if (level > 2)
level = 0;
}