src/display.cpp

Sat, 07 Nov 2020 19:23:21 +0100

author
David Douard <david.douard@sdf3.org>
date
Sat, 07 Nov 2020 19:23:21 +0100
changeset 47
11c57010e4f9
parent 46
a4a007b3c42e
child 51
d8042bff0e00
permissions
-rw-r--r--

Attempt to improve the detection of packet collisions (not fixed yet)

37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
1 #include "stdio.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
2 #include <mbed.h>
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
3 #include <rtos.h>
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
4 #include "display.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
5
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
6
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
7 Display::Display(int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
8 const char* name)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
9 : SSD1322(Hz, mosi, miso, sclk, CS, reset, DC, name)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
10 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
11 must_refresh = 0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
12 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
13
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
14 Display::~Display()
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
15 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
16 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
17
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
18 void Display::show_splashscreen()
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
19 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
20 locate(30, 10);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
21 set_font((unsigned char*)Mono19x27);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
22 this->printf("HP34970A");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
23 set_font((unsigned char*)Terminal6x8);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
24 locate(90, 40);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
25 this->printf("David Douard");
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
26 copy_to_lcd();
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
27 }
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
28
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
29 void Display::show_byescreen()
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
30 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
31 cls();
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
32 background(0x00);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
33 foreground(0xFF);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
34 locate(30, 10);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
35 set_font((unsigned char*)Mono19x27);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
36 this->printf("Bye...");
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
37 copy_to_lcd();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
38 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
39
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
40 void Display::dimm_char(uint8_t n)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
41 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
42 // dimm the char number of the currently displayed string of the main area;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
43 // do this by printing a modifed version of the last displayed string
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
44 // but only alphanumeric chars should be counted (not the punctuation)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
45 char c;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
46 uint8_t len, i, j;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
47 // for which we need to look for the entry in the table
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
48 for (i=0; i<sizeof(table)/sizeof(table[0]); ++i) {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
49 if (table[i].cmd == 0x00) {
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
50
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
51 background(table[i].bgcolor);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
52 foreground(table[i].color / 2); // dimmed
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
53 set_font((unsigned char*) table[i].font);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
54 locate(table[i].x0, table[i].y0);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
55
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
56 len = strlen(table[i].buffer);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
57 if (n >= len)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
58 break; // nothing to do
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
59 //::printf("DIMM CHAR %d\n", n);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
60 //::printf(" in (len=%d) '%s'\n", len, table[i].buffer);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
61
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
62 for (j=0; (j<len); j++)
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
63 {
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
64 // advae the location up to the char to dimm
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
65 c = table[i].buffer[j];
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
66 if ((c == ',') || (c == '.') || (c == ';') || (c == ':'))
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
67 // it's a "zero" width char, skip it
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
68 n++;
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
69 if (n == 0)
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
70 {
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
71 //::printf(" Found at pos %d char '%c'\n", j, c);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
72 // found it
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
73 character(c);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
74 break;
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
75 }
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
76 // otherwise, just advance the char_x
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
77 //::printf(" move %d for '%c' [%X]\n", , c, c);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
78 char_width(c, true);
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
79 n--;
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
80 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
81 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
82 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
83 }
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
84
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
85 void Display::show(uint8_t cmd, const char *intxt, uint8_t nchar=0)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
86 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
87 uint8_t i;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
88 // uint8_t len;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
89 uint16_t bgcolor, fgcolor;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
90 char *oldv;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
91 // char *txt;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
92 char *txtp;
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
93 static char txt[64];
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
94
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
95
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
96 if (cmd == 0xFF) // cls
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
97 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
98 clrbuff();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
99 }
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
100 else if (cmd == 0x0D)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
101 { // dimm a character of the main area
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
102 dimm_char(intxt[0]);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
103 }
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
104 else
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
105 {
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
106 pixel_buffer_mutex.lock();
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
107 for (i=0; i<sizeof(table)/sizeof(table[0]); ++i) {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
108 if (table[i].cmd == cmd) {
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
109 strcpy(txt, intxt);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
110 txtp = txt;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
111
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
112 bgcolor = table[i].bgcolor;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
113 fgcolor = table[i].color;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
114 background(bgcolor);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
115 foreground(fgcolor);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
116 set_font((unsigned char*) table[i].font);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
117 oldv = table[i].buffer;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
118
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
119 locate(table[i].x0, table[i].y0);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
120
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
121 if (table[i].fmt & FMT_ASCII) // ASCII text
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
122 {
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
123 // check if the string has changed since last time
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
124 if (true) //(strncmp(oldv, txt, table[i].maxsize) != 0)
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
125 {
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
126 // clear the text area
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
127 if (table[i].width > 0)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
128 fillrect(table[i].x0,
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
129 table[i].y0,
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
130 table[i].x0 + table[i].width,
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
131 table[i].y0 + table[i].font[2] - 1,
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
132 bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
133 // draw chars by portions of string separated by \t (highlight)
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
134 for (uint8_t k=0; ;k++)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
135 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
136 if (txtp[k] == 0x00)
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
137 { // end of string, display it
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
138 this->printf(txtp);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
139 break;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
140 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
141 if (txtp[k] == 0x09)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
142 { // \t is a special char for 'unselected' display value
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
143 // first disply the beginning of the string
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
144 txtp[k] = 0x00;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
145 this->printf(txtp);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
146
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
147 // swap the fg color (dimm/bright)
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
148 if (fgcolor == table[i].color)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
149 fgcolor /= 2;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
150 else
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
151 fgcolor = table[i].color;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
152 foreground(fgcolor);
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
153 // continue on the next with part of the string
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
154 txtp = &(txtp[k+1]);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
155 k = 0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
156 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
157 }
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
158 must_refresh = 1;
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
159 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
160 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
161 /*
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
162 if (table[i].fmt & FMT_HEX ) {
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
163 // hex
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
164 for (uint8_t j=0;; j++) {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
165 if (txt[j] == 0x00)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
166 break;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
167 this->printf("%02X ", txt[j]);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
168 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
169 for (uint8_t j=3*strlen(txt); j<table[i].maxsize; j++)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
170 this->printf(" ");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
171 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
172 */
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
173 if (table[i].fmt & FMT_FLAGS ) // flag indicators
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
174 {
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
175 uint8_t nbyte;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
176 uint8_t nbit;
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
177 uint16_t color;
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
178 // flags
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
179 for (uint8_t l=0; l<(sizeof(flags)/sizeof(flags[0])); ++l)
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
180 {
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
181 nbyte = flags[l].flag / 8;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
182 nbit = flags[l].flag % 8;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
183
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
184 if (intxt[nbyte] & (1 << nbit))
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
185 { // draw the flag, possibly reversed fg/bg
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
186 foreground(flags[l].reverse ? bgcolor : fgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
187 background(flags[l].reverse ? fgcolor : bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
188 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
189 else
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
190 { // erase the flag
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
191 foreground(bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
192 background(bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
193 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
194 if (flags[l].msg != NULL)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
195 { // flag is a string
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
196 locate(flags[l].x, flags[l].y);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
197 this->printf(flags[l].msg);}
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
198 else
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
199 { // flag is an icon
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
200 Bitmap_s pic = {9, 10, 2, (char*) flags[l].icon};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
201 Bitmap_BW(pic, flags[l].x, flags[l].y);
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
202 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
203 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
204
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
205 // draw frames (Alarm and Channel)
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
206 for (uint8_t l=0; l<(sizeof(frames)/sizeof(frames[0])); ++l)
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
207 {
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
208 nbyte = frames[l].flag / 8;
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
209 nbit = frames[l].flag % 8;
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
210 if (intxt[nbyte] & (1 << nbit))
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
211 color = fgcolor/6;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
212 else
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
213 color = bgcolor;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
214 hline(frames[l].x0+1, frames[l].x0+3, frames[l].y0, color);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
215 hline(frames[l].x1-3, frames[l].x1-1, frames[l].y0, color);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
216 hline(frames[l].x0+1, frames[l].x1-1, frames[l].y1, color);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
217
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
218 vline(frames[l].x0, frames[l].y0+1, frames[l].y1-1, color);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
219 vline(frames[l].x1, frames[l].y0+1, frames[l].y1-1, color);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
220 }
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
221 must_refresh = 1; //|= zones[m].flag;
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
222 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
223
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
224 for(uint8_t j=0; j<table[i].maxsize; j++)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
225 oldv[j] = txt[j];
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
226 break;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
227 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
228 }
46
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
229 pixel_buffer_mutex.unlock();
a4a007b3c42e Fix display of flags and improve dimm char handling
David Douard <david.douard@sdf3.org>
parents: 44
diff changeset
230
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
231 //free(txt);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
232 //this->copy_to_lcd();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
233 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
234 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
235
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
236
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
237 void Display::set_flag(uint8_t flag, bool show=true)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
238 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
239 uint8_t i;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
240 uint8_t bgcolor = 0x00, fgcolor = 0xFF;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
241
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
242 for (uint8_t l=0; l<(sizeof(flags)/sizeof(flags[0])); ++l)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
243 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
244 if (flag == flags[l].flag)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
245 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
246
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
247 if (show)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
248 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
249 foreground(flags[l].reverse ? bgcolor : fgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
250 background(flags[l].reverse ? fgcolor : bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
251 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
252 else
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
253 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
254 foreground(bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
255 background(bgcolor);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
256 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
257 if (flags[l].msg != NULL)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
258 { // flag is a string
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
259 locate(flags[l].x, flags[l].y);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
260 set_font((unsigned char*)Terminal6x8);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
261 this->printf(flags[l].msg);}
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
262 else
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
263 { // flag is an icon
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
264 Bitmap_s pic = {9, 10, 2, (char*) flags[l].icon};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
265 Bitmap_BW(pic, flags[l].x, flags[l].y);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
266 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
267 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
268 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
269
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
270 // draw frames (Alarm and Channel)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
271 for (uint8_t l=0; l<(sizeof(frames)/sizeof(frames[0])); ++l)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
272 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
273 if (flag == frames[l].flag)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
274 {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
275 uint16_t color;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
276 if (show)
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
277 color = fgcolor/6;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
278 else
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
279 color = bgcolor;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
280 hline(frames[l].x0+1, frames[l].x0+3, frames[l].y0, color);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
281 hline(frames[l].x1-3, frames[l].x1-1, frames[l].y0, color);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
282 hline(frames[l].x0+1, frames[l].x1-1, frames[l].y1, color);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
283
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
284 vline(frames[l].x0, frames[l].y0+1, frames[l].y1-1, color);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
285 vline(frames[l].x1, frames[l].y0+1, frames[l].y1-1, color);
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
286 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
287 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
288 must_refresh = 1;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
289 }
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
290
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
291
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
292 void Display::test_dsp()
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
293 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
294 const FRAME *z;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
295 printf("TEST DSP\r\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
296 cls();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
297 printf("TEST DSP #2\r\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
298 show(0x00, "8g8g8g8g8g8g8", 13); // main dsp
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
299 show(0x0C, "888", 3); // channel dsp
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
300 show(0x0A, "\xFF\xFF\xFF\xFF", 4); // all flags
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
301 copy_to_lcd();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
302 ThisThread::sleep_for(3ms);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
303 cls();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
304 printf("TEST DSP #3\r\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
305
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
306 for (uint8_t i=0; i<(sizeof(zones)/sizeof(zones[0])); i++)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
307 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
308 z = &zones[i];
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
309 fillrect(z->x0, z->y0, z->x1, z->y1, 4+i);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
310 locate(z->x0+1, z->y0+1);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
311 this->printf("%d", i);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
312 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
313
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
314 /*
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
315 for (uint8_t i=0; i<(sizeof(zones)/sizeof(zones[0])); i++)
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
316 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
317 z = &zones[i];
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
318 printf("Zone %d [%x]: %d, %d, %d, %d\n", i, z->flag,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
319 z->x0, z->y0, z->x1, z->y1);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
320 must_refresh = z->flag;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
321 wait(1);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
322 }
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
323 printf("Done\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
324 wait(2);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
325 printf("Copy ALL\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
326 copy_to_lcd();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
327 */
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
328 ThisThread::sleep_for(2ms);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
329 cls();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
330 printf("TEST DSP DONE\r\n");
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
331 }

mercurial