Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
egorguslyan
Dashboard
Commits
0e68bbbf
Commit
0e68bbbf
authored
3 years ago
by
egorguslyan
Browse files
Options
Downloads
Patches
Plain Diff
Restructured font + working static render
parent
a7dbf3c3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dashboard/Dashboard.ino
+6
-5
6 additions, 5 deletions
Dashboard/Dashboard.ino
Dashboard/font.h
+131
-10
131 additions, 10 deletions
Dashboard/font.h
Dashboard/textbox.h
+14
-33
14 additions, 33 deletions
Dashboard/textbox.h
with
151 additions
and
48 deletions
Dashboard/Dashboard.ino
+
6
−
5
View file @
0e68bbbf
...
...
@@ -47,17 +47,18 @@ MHZ19_uart co2;
void
setup
()
{
Serial
.
begin
(
9600
);
while
(
!
Serial
.
available
())
{}
Serial
.
println
(
"Hello"
);
matrix
.
setBrightness
(
100
);
matrix
.
clear
();
matrix
.
show
();
Serial
.
begin
(
9600
);
while
(
!
Serial
.
available
())
{}
Serial
.
println
(
"Hello"
);
co2
.
begin
(
CO2TX
,
CO2RX
);
co2
.
setAutoCalibration
(
false
);
delay
(
500
);
tb
.
setup
(
"
Hello
"
,
TB_STATIC
,
0
,
0
,
16
);
tb
.
setup
(
"
Mama
"
,
TB_STATIC
,
0
,
0
,
16
);
tb
.
render
();
}
...
...
@@ -77,7 +78,7 @@ void loop()
CO2
=
map
(
CO2
,
300
,
1500
,
0
,
9
);
for
(
uint8_t
i
=
0
;
i
<
CO2
;
i
++
)
{
matrix
.
set
(
matrix
.
getPixNumber
(
15
,
i
)
,
mHEX
(
0x0aa100
));
matrix
.
set
(
15
,
i
,
mHEX
(
0x0aa100
));
}
//matrix.fill(mHEX(0x9aa100));
matrix
.
show
();
...
...
This diff is collapsed.
Click to expand it.
Dashboard/font.h
+
131
−
10
View file @
0e68bbbf
...
...
@@ -5,12 +5,40 @@
// Example char
// const uint8_t char[] PROGMEM = {cords(x, y, b), 0b11111110, 0b11110111, 0b01011101, 0b11101111, 0b11100000};
const
uint8_t
font_space
[]
PROGMEM
=
{
cords
(
1
,
6
,
1
),
0
b00000000
};
const
uint8_t
font_notdef
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b11111110
,
0
b11110111
,
0
b01011101
,
0
b11101111
,
0
b11100000
};
const
uint8_t
font_dot
[]
PROGMEM
=
{
cords
(
2
,
4
,
1
),
0
b11011000
};
const
uint8_t
font_comma
[]
PROGMEM
=
{
cords
(
2
,
4
,
1
),
0
b11011001
};
const
uint8_t
font_space
[]
PROGMEM
=
{
cords
(
1
,
6
,
1
),
0
b00000000
};
const
uint8_t
font_exclamation
[]
PROGMEM
=
{
cords
(
1
,
0
,
1
),
0
b11110100
};
const
uint8_t
font_quote
[]
PROGMEM
=
{
cords
(
3
,
0
,
1
),
0
b10110100
};
const
uint8_t
font_hashtag
[]
PROGMEM
=
{
cords
(
5
,
2
,
3
),
0
b01010111
,
0
b11010101
,
0
b11110101
};
const
uint8_t
font_promt
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b00100011
,
0
b10101000
,
0
b11100010
,
0
b10111000
,
0
b10000000
};
const
uint8_t
font_percent
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b11101101
,
0
b01110100
,
0
b01000101
,
0
b11010110
,
0
b11100000
};
const
uint8_t
font_octopus
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b01100100
,
0
b10100000
,
0
b11001001
,
0
b11001001
,
0
b10100000
};
const
uint8_t
font_singlequote
[]
PROGMEM
=
{
cords
(
1
,
0
,
1
),
0
b11000000
};
const
uint8_t
font_bracketO
[]
PROGMEM
=
{
cords
(
2
,
0
,
2
),
0
b01101010
,
0
b10100100
};
const
uint8_t
font_bracketC
[]
PROGMEM
=
{
cords
(
2
,
0
,
2
),
0
b10010101
,
0
b01011000
};
const
uint8_t
font_multiply
[]
PROGMEM
=
{
cords
(
3
,
2
,
2
),
0
b10101010
,
0
b10000000
};
const
uint8_t
font_plus
[]
PROGMEM
=
{
cords
(
3
,
2
,
1
),
0
b01011101
};
const
uint8_t
font_comma
[]
PROGMEM
=
{
cords
(
2
,
4
,
1
),
0
b11011001
};
const
uint8_t
font_minus
[]
PROGMEM
=
{
cords
(
3
,
3
,
1
),
0
b11100000
};
const
uint8_t
font_dot
[]
PROGMEM
=
{
cords
(
2
,
4
,
1
),
0
b11011000
};
const
uint8_t
font_slash
[]
PROGMEM
=
{
cords
(
3
,
0
,
3
),
0
b00100101
,
0
b00100101
,
0
b00100000
};
const
uint8_t
font_colon
[]
PROGMEM
=
{
cords
(
1
,
2
,
1
),
0
b10100000
};
const
uint8_t
font_semicolon
[]
PROGMEM
=
{
cords
(
2
,
2
,
1
),
0
b01000110
};
const
uint8_t
font_less
[]
PROGMEM
=
{
cords
(
3
,
1
,
2
),
0
b00101010
,
0
b00100010
};
const
uint8_t
font_equal
[]
PROGMEM
=
{
cords
(
3
,
2
,
2
),
0
b11100011
,
0
b10000000
};
const
uint8_t
font_greater
[]
PROGMEM
=
{
cords
(
3
,
1
,
2
),
0
b10001000
,
0
b10101000
};
const
uint8_t
font_question
[]
PROGMEM
=
{
cords
(
3
,
0
,
3
),
0
b01010100
,
0
b10100100
,
0
b00010000
};
const
uint8_t
font_mail
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b01110100
,
0
b01011000
,
0
b10100111
,
0
b01000101
,
0
b10000000
};
const
uint8_t
font_sbracketO
[]
PROGMEM
=
{
cords
(
2
,
0
,
2
),
0
b11101010
,
0
b10101100
};
const
uint8_t
font_bslash
[]
PROGMEM
=
{
cords
(
3
,
0
,
3
),
0
b10010001
,
0
b00100100
,
0
b01000000
};
const
uint8_t
font_sbracketC
[]
PROGMEM
=
{
cords
(
2
,
0
,
2
),
0
b11010101
,
0
b01011100
};
const
uint8_t
font_caret
[]
PROGMEM
=
{
cords
(
3
,
0
,
1
),
0
b01010100
};
const
uint8_t
font_underscore
[]
PROGMEM
=
{
cords
(
3
,
6
,
1
),
0
b11100000
};
const
uint8_t
font_grave
[]
PROGMEM
=
{
cords
(
2
,
0
,
1
),
0
b10010000
};
const
uint8_t
font_fbracketO
[]
PROGMEM
=
{
cords
(
3
,
0
,
2
),
0
b00101001
,
0
b01000100
,
0
b1000100
};
const
uint8_t
font_pipe
[]
PROGMEM
=
{
cords
(
1
,
0
,
1
),
0
b11111110
};
const
uint8_t
font_fbracketC
[]
PROGMEM
=
{
cords
(
2
,
0
,
2
),
0
b10001001
,
0
b00010100
,
0
b1010000
};
const
uint8_t
font_tilda
[]
PROGMEM
=
{
cords
(
5
,
2
,
2
),
0
b01000101
,
0
b01000100
};
// Numbers
const
uint8_t
font_num0
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b01110100
,
0
b11101011
,
0
b01011010
,
0
b11100101
,
0
b11000000
};
const
uint8_t
font_num1
[]
PROGMEM
=
{
cords
(
3
,
0
,
3
),
0
b01011001
,
0
b00100100
,
0
b10111000
};
...
...
@@ -49,7 +77,7 @@ const uint8_t font_W[] PROGMEM = {cords(5, 0, 5), 0b10001100, 0b01101
const
uint8_t
font_X
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b10001010
,
0
b10010100
,
0
b01000101
,
0
b00101010
,
0
b00100000
};
const
uint8_t
font_Y
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b10001010
,
0
b10010100
,
0
b01000010
,
0
b00010000
,
0
b10000000
};
const
uint8_t
font_Z
[]
PROGMEM
=
{
cords
(
5
,
0
,
5
),
0
b11111000
,
0
b01000100
,
0
b01000100
,
0
b01000011
,
0
b11100000
};
const
uint8_t
font_a
[]
PROGMEM
=
{
cords
(
5
,
2
,
3
),
0
b01100001
,
0
b01111001
,
0
b011
0
0000
};
const
uint8_t
font_a
[]
PROGMEM
=
{
cords
(
4
,
2
,
3
),
0
b01100001
,
0
b01111001
,
0
b011
1
0000
};
const
uint8_t
font_b
[]
PROGMEM
=
{
cords
(
4
,
0
,
4
),
0
b10001000
,
0
b10001110
,
0
b10011001
,
0
b11100000
};
const
uint8_t
font_c
[]
PROGMEM
=
{
cords
(
3
,
2
,
2
),
0
b01110010
,
0
b01000110
};
const
uint8_t
font_d
[]
PROGMEM
=
{
cords
(
4
,
0
,
4
),
0
b00010001
,
0
b00010111
,
0
b10011001
,
0
b01110000
};
...
...
@@ -76,9 +104,102 @@ const uint8_t font_x[] PROGMEM = {cords(3, 2, 2), 0b10110101, 0b01011
const
uint8_t
font_y
[]
PROGMEM
=
{
cords
(
3
,
2
,
2
),
0
b10110101
,
0
b10011100
};
const
uint8_t
font_z
[]
PROGMEM
=
{
cords
(
3
,
2
,
2
),
0
b11100101
,
0
b01001110
};
const
uint8_t
*
const
font
[]
PROGMEM
=
{
font_space
,
font_notdef
,
font_dot
,
font_comma
,
font_exclamation
,
font_question
,
font_num0
,
font_num1
,
font_num2
,
font_num3
,
font_num4
,
font_num5
,
font_num6
,
font_num7
,
font_num8
,
font_num9
,
font_A
,
font_a
,
font_B
,
font_b
,
font_C
,
font_c
,
font_D
,
font_d
,
font_E
,
font_e
,
font_F
,
font_f
,
font_G
,
font_g
,
font_H
,
font_h
,
font_I
,
font_i
,
font_J
,
font_j
,
font_K
,
font_k
,
font_L
,
font_l
,
font_M
,
font_m
,
font_N
,
font_n
,
font_O
,
font_o
,
font_P
,
font_p
,
font_Q
,
font_q
,
font_R
,
font_r
,
font_S
,
font_s
,
font_T
,
font_t
,
font_U
,
font_u
,
font_V
,
font_v
,
font_W
,
font_w
,
font_X
,
font_x
,
font_Y
,
font_y
,
font_Z
,
font_z
};
\ No newline at end of file
// Font dictionary Location Char Addres
const
uint8_t
*
const
font
[]
/*PROGMEM*/
=
{
font_notdef
,
// NONE NONE
font_space
,
// 32
font_exclamation
,
//! 33
font_quote
,
// " 34
font_hashtag
,
// # 35
font_promt
,
// $ 36
font_percent
,
// % 37
font_octopus
,
// & 38
font_singlequote
,
//' 39
font_bracketO
,
// ( 40
font_bracketC
,
// ) 41
font_multiply
,
// * 42
font_plus
,
// + 43
font_comma
,
// , 44
font_minus
,
// - 45
font_dot
,
// . 46
font_slash
,
// / 47
font_num0
,
// 0 48
font_num1
,
// 1 49
font_num2
,
// 2 50
font_num3
,
// 3 51
font_num4
,
// 4 52
font_num5
,
// 5 53
font_num6
,
// 6 54
font_num7
,
// 7 55
font_num8
,
// 8 56
font_num9
,
// 9 57
font_colon
,
// : 58
font_semicolon
,
// ; 59
font_less
,
// < 60
font_equal
,
// = 61
font_greater
,
// > 62
font_question
,
// ? 63
font_mail
,
// @ 64
font_A
,
// A 65
font_B
,
// B 66
font_C
,
// C 67
font_D
,
// D 68
font_E
,
// E 69
font_F
,
// F 70
font_G
,
// G 71
font_H
,
// H 72
font_I
,
// I 73
font_J
,
// J 74
font_K
,
// K 75
font_L
,
// L 76
font_M
,
// M 77
font_N
,
// N 78
font_O
,
// O 79
font_P
,
// P 80
font_Q
,
// Q 81
font_R
,
// R 82
font_S
,
// S 83
font_T
,
// T 84
font_U
,
// U 85
font_V
,
// V 86
font_W
,
// W 87
font_X
,
// X 88
font_Y
,
// Y 89
font_Z
,
// Z 90
font_sbracketO
,
// [ 91
font_bslash
,
// \ 92
font_sbracketC
,
// ] 93
font_caret
,
// ^ 94
font_underscore
,
// _ 95
font_grave
,
// ` 96
font_a
,
// a 97
font_b
,
// b 98
font_c
,
// c 99
font_d
,
// d 100
font_e
,
// e 101
font_f
,
// f 102
font_g
,
// g 103
font_h
,
// h 104
font_i
,
// i 105
font_j
,
// j 106
font_k
,
// k 107
font_l
,
// l 108
font_m
,
// m 100
font_n
,
// n 110
font_o
,
// o 111
font_p
,
// p 112
font_q
,
// q 113
font_r
,
// r 114
font_s
,
// s 115
font_t
,
// t 116
font_u
,
// u 117
font_v
,
// v 118
font_w
,
// w 119
font_x
,
// x 120
font_y
,
// y 121
font_z
,
// z 122
font_fbracketO
,
// { 123
font_pipe
,
// | 124
font_fbracketC
,
// } 125
font_tilda
// ~ 126
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dashboard/textbox.h
+
14
−
33
View file @
0e68bbbf
...
...
@@ -43,6 +43,7 @@ textbox::textbox(void)
void
textbox
::
setup
(
char
_text
[],
uint8_t
_mode
,
uint8_t
_x
,
uint8_t
_y
,
uint8_t
_w
,
uint8_t
_speed
=
0
,
uint16_t
_delay
=
0
)
{
memset
(
text
,
NULL
,
64
*
sizeof
(
char
));
strcpy
(
text
,
_text
);
mode
=
_mode
;
x
=
_x
;
...
...
@@ -76,7 +77,7 @@ void textbox::render(void)
if
(
mode
==
TB_DISABLED
)
return
;
uint8_t
index
=
0
;
uint8_t
position
=
0
;
while
(
position
<
16
)
while
(
position
<
16
&&
index
<
strlen
(
text
)
)
{
getLetter
(
text
[
index
]);
uint8_t
y
=
letter
[
1
];
...
...
@@ -90,7 +91,13 @@ void textbox::render(void)
uint8_t
state
=
bitRead
(
letter
[
i
+
3
],
j
);
//sprintf(sprf, "%d %d %d %d %d %d %d\n", index, letter[0], letter[1], letter[2], i, j, state);
//Serial.print(sprf);
matrix
.
set
(
matrix
.
getPixNumber
(
x
+
position
,
y
),
mHSVfast
((
index
+
1
)
*
10
,
255
,
255
));
if
(
state
)
matrix
.
set
(
x
+
position
,
8
-
y
,
mHSVfast
((
i
+
j
+
1
)
*
10
,
255
,
255
));
// matrix.show();
// volatile int val = 666;
// for(volatile int v = 0; v < 5000; v++)
// {
// val = sin(val);
// }
x
++
;
if
(
x
>=
maxX
)
{
...
...
@@ -100,7 +107,7 @@ void textbox::render(void)
}
}
BREAKFORS
:
position
+=
maxX
;
position
+=
maxX
+
1
;
index
++
;
}
...
...
@@ -116,40 +123,14 @@ void textbox::getLetter(char c)
memset
(
letter
,
0
,
8
*
sizeof
(
uint8_t
));
uint8_t
index
;
uint8_t
ctoi
=
(
uint8_t
)
c
;
if
(
ctoi
>=
65
&&
ctoi
<=
90
)
index
=
16
+
2
*
(
ctoi
-
65
);
else
if
(
ctoi
>=
97
&&
ctoi
<=
122
)
index
=
17
+
2
*
(
ctoi
-
97
);
else
if
(
ctoi
>=
48
&&
ctoi
<=
57
)
index
=
ctoi
-
42
;
else
switch
(
ctoi
)
{
case
32
:
index
=
0
;
break
;
case
46
:
index
=
2
;
break
;
case
44
:
index
=
3
;
break
;
case
33
:
index
=
4
;
break
;
case
63
:
index
=
5
;
break
;
default:
index
=
1
;
break
;
}
Serial
.
println
(
index
);
uint8_t
readed
=
pgm_read_byte
(
font
[
index
][
0
]);
Serial
.
println
(
readed
);
if
(
ctoi
>=
32
&&
ctoi
<=
126
)
index
=
ctoi
-
31
;
else
index
=
0
;
uint8_t
readed
=
pgm_read_byte
(
font
[
index
]);
letter
[
0
]
=
readed
/
49
+
1
;
// width
letter
[
1
]
=
readed
%
7
;
// offset
letter
[
2
]
=
readed
/
7
%
7
;
// bytes
for
(
uint8_t
i
=
0
;
i
<
letter
[
2
];
i
++
)
{
letter
[
i
+
3
]
=
pgm_read_byte
(
font
[
index
][
i
+
1
]);
Serial
.
println
(
letter
[
i
+
3
]);
letter
[
i
+
3
]
=
pgm_read_byte
(
font
[
index
]
+
(
i
+
1
)
*
sizeof
(
uint8_t
));
}
Serial
.
println
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment