-
Notifications
You must be signed in to change notification settings - Fork 0
/
oled.h
99 lines (86 loc) · 1.89 KB
/
oled.h
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
#include "U8glib.h"
#include "pictures.h"
//https://diyusthad.com/image2cpp
// (x ini, y ini, width/8, height)
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);
bool debug = true;
void welcome_display()
{
// (x ini, y ini, width/8, height)
u8g.firstPage();
do
{
u8g.drawBitmapP(0, 0, 16, 64, allegion_logo);
} while( u8g.nextPage() );
}
void short_circuit_error(int ch, float dataV)
{
int pin = short_ch_to_pin(ch);
//Convert pin to char
char pin_char[16];
sprintf(pin_char, "%d", pin);
if(debug)
{
//Serial warning
Serial.println("");
Serial.print("Short Circuit in Pin ");
Serial.print(pin);
Serial.print(" || ");
Serial.print(dataV);
Serial.println(" V");
Serial.println("");
}
//Screen warning
u8g.firstPage();
do
{
u8g.setFont(u8g_font_unifont);
u8g.drawStr(2, 19, "Short Circuit");
u8g.drawStr(2, 38, "in Pin");
u8g.setFont(u8g_font_fub25);
u8g.drawStr(60, 55, pin_char);
} while( u8g.nextPage() );
}
void continuity_error(int ch, float dataV, bool first_mux)
{
int pin = continuity_ch_to_pin(ch, first_mux);
//Convert pin to char
char pin_char[16];
sprintf(pin_char, "%d", pin);
if(debug){
Serial.println("");
Serial.print("No Continuity in Pin ");
Serial.print(pin);
Serial.print(" || ");
Serial.print(dataV);
Serial.println(" V");
}
//Screen warning
u8g.firstPage();
do
{
u8g.setFont(u8g_font_unifont);
u8g.drawStr(2, 19, "No Continuity");
u8g.drawStr(2, 38, "in Pin");
u8g.setFont(u8g_font_fub25);
u8g.drawStr(60, 55, pin_char);
} while( u8g.nextPage() );
}
void test_success()
{
u8g.firstPage();
do
{
u8g.setFont(u8g_font_fub25);
u8g.drawStr(0, 38, "OK");
} while( u8g.nextPage() );
}
void test_failed()
{
u8g.firstPage();
do
{
u8g.setFont(u8g_font_fub25);
u8g.drawStr(2, 30, "Failed");
} while( u8g.nextPage() );
}