Missing bugfix added.
This commit is contained in:
parent
4c97e0a5f5
commit
119e9889c9
1 changed files with 13 additions and 6 deletions
|
@ -81,8 +81,8 @@ ISR (TIMER1_COMPA_vect)
|
||||||
delay = (frame >> 24) & 0xf8;
|
delay = (frame >> 24) & 0xf8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PORTD = __, 9, C, B, A,D+,D-,__
|
// !!!Don't touch the 6th bit (9th LED wire)!!!
|
||||||
PORTD &= 0b10000111; // delete bit 3 to 6 (bit 3 to 5 = layer 0 to 2; bit 6 = wire 9 to the LEDs)
|
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
|
uint8_t tmp = level * 9; // calculate the position in the frame
|
||||||
|
|
||||||
|
@ -91,13 +91,20 @@ ISR (TIMER1_COMPA_vect)
|
||||||
PORTB = ~((frame >> tmp) & 0xff);
|
PORTB = ~((frame >> tmp) & 0xff);
|
||||||
|
|
||||||
if ( (((frame >> tmp) >> 8) & 0x01) )
|
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
|
// rotate through the 3 level
|
||||||
level++;
|
level++;
|
||||||
if (level > 2) level = 0;
|
if (level > 2)
|
||||||
|
level = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue