Subversion Repositories Projects

Rev

Rev 111 | Blame | Compare with Previous | Last modification | View Log | RSS feed


#include <avr/io.h>
#include <inttypes.h>
#include <stdlib.h>
#include <avr/pgmspace.h>

#include "main.h"
#include "lcd.h"
#include "rs232.h"
#include "base64.h"
#include "parameter.h"
#include "menu.h"

uint8_t read_display (uint8_t command)                  //
{
        uint8_t timeout;
       
        timeout = 0;
        p_buffer[0] = '#';                                                      // Display-Zeile anfordern
        p_buffer[1] = 'a';
        p_buffer[2] = 'h';
        p_buffer[3] = command;
        p_buffer[4] = 0;
        p_buffer[5] = 0;
        base64_send(6);
       
        do                                                                                      // warten, bis die Parameter gesendet werden
        {
                if (get_message() == 1)
                        timeout = 10;
                timeout ++;
        }
        while (((r_buffer[1] < '0') || (r_buffer[1] > '4')) && (timeout < 10));
       
        if (timeout >= 10)
                return 1;
        else
                return 0;
}

void display_data (void)
{
        uint8_t line;
        uint8_t text[10];

        lcd_cls();
        lcd_printp(PSTR("Display"),0);
        do
        {
                while (key != 0x00);
                if (read_display(0) == 1)
                {
                        lcd_printp(PSTR("\r\nTimeout!"),0);
                        timer = 200;
                        while (timer > 0);
                        break;
                }
                else
                {
                        line = r_buffer[1];
                        text[0] = line;
                        text[1] = 0x00;
                        lcd_print_at(10,0,text,0);
                       
                        lcd_print_at(0,line+1,p_buffer,0);
                       
                        timer = 10;
                        while(timer > 0);
               
                        if (key == 0x01)
                                read_display(1);
                        if (key == 0x02)
                                read_display(2);
                }
       
        }
        while (key != 0x04);
}