some bugfixes for the DNA-animation

This commit is contained in:
Stefan Kinzel 2014-08-14 23:46:45 +02:00
parent 306ad40288
commit b435b52217
1 changed files with 7 additions and 6 deletions

View File

@ -77,12 +77,14 @@ void dna(){
uint8_t top_color = 3; uint8_t top_color = 3;
uint8_t bottom_color = 2; uint8_t bottom_color = 2;
uint32_t c = 10000; uint32_t c = 600;
uint8_t sinpos = 0; uint8_t sinpos = 0;
uint8_t direction = 1; uint8_t direction = 1;
clear_screen(0);
while(c--){ while(c--){
top = mid - sintab[sinpos]; top = mid - sintab[sinpos];
bottom = mid + sintab[sinpos]; bottom = mid + sintab[sinpos];
@ -98,7 +100,7 @@ void dna(){
} }
if(draw_line == 0){ if(draw_line == 0){
if(top <= 1){ if(top <= 0){
direction = 1; direction = 1;
} }
if(bottom >= NUM_ROWS-1){ if(bottom >= NUM_ROWS-1){
@ -116,9 +118,8 @@ void dna(){
bottom_color = tmp_color; bottom_color = tmp_color;
} }
wait(50);
move(); move();
wait(40);
} }
@ -130,8 +131,8 @@ void dna(){
void move(){ void move(){
unsigned char plane, row, byte; unsigned char plane, row, byte;
for(plane=0; plane<=NUMPLANE; plane++){ for(plane=0; plane<NUMPLANE; plane++){
for(row=NUM_COLS;row>0; row--){ for(row=NUM_ROWS; row--;){
for(byte=0; byte < LINEBYTES; byte++){ for(byte=0; byte < LINEBYTES; byte++){
pixmap[plane][row][byte] = pixmap[plane][row][byte] >> 1; pixmap[plane][row][byte] = pixmap[plane][row][byte] >> 1;
if(byte < LINEBYTES-1){ if(byte < LINEBYTES-1){