-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmisc.ino
executable file
·101 lines (75 loc) · 1.77 KB
/
misc.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
void set_backlight()
// Setting the LCD backlight.
{
analogWrite(PIN_LCD_LED, 255 - Backlight[g.backlight]);
return;
}
void message(char * str1, char * str2)
// Printing help messages
{
g.t_message = g.t;
g.message = 1;
lcd.setCursor(0, 4 * ROW);
lcd.print(str1);
lcd.setCursor(0, 5 * ROW);
lcd.print(str2);
}
void Display(int code)
// Displaying stuff
{
lcd.clearDisplay();
// Row 1:
lcd.setCursor(0, 0);
sprintf(g.buffer, "t=%d.%1d", g.reg.dt_shots / 10, g.reg.dt_shots % 10);
lcd.print(g.buffer);
lcd.setCursor(8 * COL, 0);
sprintf(g.buffer, "N=%d", g.reg.N_shots);
lcd.print(g.buffer);
// Row 2:
lcd.setCursor(0, 1 * ROW);
sprintf(g.buffer, "Reg=%1d", g.ireg);
lcd.print(g.buffer);
lcd.setCursor(8 * COL, 1 * ROW);
sprintf(g.buffer, "dN=%d", g.reg.extra_shots);
lcd.print(g.buffer);
// Row 3:
lcd.setCursor(0, 2 * ROW);
sprintf(g.buffer, "BL=%1d", g.backlight);
lcd.print(g.buffer);
#ifdef DEBUG
lcd.setCursor(8*COL, 2 * ROW);
sprintf(g.buffer, "%4d", g.flash_delay/1000);
lcd.print(g.buffer);
#endif
switch (code)
{
case 0: // Display memory register
message("Memory",
"register");
break;
case 1: // Display dt_shots
message("Time between",
"shots");
break;
case 2: // Display N_shots
message("Shots per",
"rotation");
break;
case 3: // Display extra_shots
message("Extra shots",
"");
break;
case 4: // Display backlight
message("Backlight",
"level");
break;
case 5:
message("A test shot",
"");
break;
}
// Drawing some lines:
lcd.drawLine(0, 26, LCDWIDTH - 1, 26, BLACK);
lcd.drawLine(42, 0, 42, 25, BLACK);
lcd.display();
}