v.0.3.1 font 3x5 pretty
This commit is contained in:
@@ -1,90 +1,98 @@
|
|||||||
font_3x5 = {
|
font_3x5 = {
|
||||||
# Uppercase Letters
|
' ': [0x00, 0x00, 0x00, 0x00, 0x00],
|
||||||
'A': [0x07, 0x05, 0x07],
|
'!': [0x01, 0x01, 0x01, 0x00, 0x01],
|
||||||
'B': [0x07, 0x07, 0x07],
|
'"': [0x05, 0x05, 0x00, 0x00, 0x00],
|
||||||
'C': [0x07, 0x01, 0x07],
|
'#': [0x05, 0x07, 0x05, 0x07, 0x05],
|
||||||
'D': [0x06, 0x05, 0x06],
|
'$': [0x07, 0x06, 0x07, 0x03, 0x07],
|
||||||
'E': [0x07, 0x03, 0x07],
|
'%': [0x05, 0x01, 0x02, 0x04, 0x05],
|
||||||
'F': [0x07, 0x03, 0x01],
|
'&': [0x02, 0x05, 0x02, 0x05, 0x03],
|
||||||
'G': [0x07, 0x05, 0x07],
|
"'": [0x01, 0x01, 0x00, 0x00, 0x00],
|
||||||
'H': [0x05, 0x07, 0x05],
|
'(': [0x01, 0x02, 0x02, 0x02, 0x01],
|
||||||
'I': [0x07, 0x02, 0x07],
|
')': [0x02, 0x01, 0x01, 0x01, 0x02],
|
||||||
'J': [0x04, 0x05, 0x07],
|
'*': [0x00, 0x05, 0x02, 0x05, 0x00],
|
||||||
'K': [0x05, 0x03, 0x05],
|
'+': [0x00, 0x02, 0x07, 0x02, 0x00],
|
||||||
'L': [0x01, 0x01, 0x07],
|
',': [0x00, 0x00, 0x00, 0x01, 0x02],
|
||||||
'M': [0x07, 0x07, 0x05],
|
'-': [0x00, 0x00, 0x07, 0x00, 0x00],
|
||||||
'N': [0x07, 0x05, 0x05],
|
'.': [0x00, 0x00, 0x00, 0x00, 0x01],
|
||||||
'O': [0x07, 0x05, 0x07],
|
'/': [0x01, 0x01, 0x02, 0x04, 0x04],
|
||||||
'P': [0x07, 0x07, 0x01],
|
'0': [0x07, 0x05, 0x05, 0x05, 0x07],
|
||||||
'Q': [0x07, 0x05, 0x07],
|
'1': [0x02, 0x06, 0x02, 0x02, 0x07],
|
||||||
'R': [0x07, 0x07, 0x05],
|
'2': [0x07, 0x01, 0x07, 0x04, 0x07],
|
||||||
'S': [0x07, 0x07, 0x07],
|
'3': [0x07, 0x01, 0x07, 0x01, 0x07],
|
||||||
'T': [0x07, 0x02, 0x02],
|
'4': [0x05, 0x05, 0x07, 0x01, 0x01],
|
||||||
'U': [0x05, 0x05, 0x07],
|
'5': [0x07, 0x04, 0x07, 0x01, 0x07],
|
||||||
'V': [0x05, 0x05, 0x02],
|
'6': [0x07, 0x04, 0x07, 0x05, 0x07],
|
||||||
'W': [0x05, 0x07, 0x07],
|
'7': [0x07, 0x01, 0x01, 0x01, 0x01],
|
||||||
'X': [0x05, 0x02, 0x05],
|
'8': [0x07, 0x05, 0x07, 0x05, 0x07],
|
||||||
'Y': [0x05, 0x07, 0x02],
|
'9': [0x07, 0x05, 0x07, 0x01, 0x07],
|
||||||
'Z': [0x07, 0x02, 0x07],
|
':': [0x00, 0x01, 0x00, 0x01, 0x00],
|
||||||
# Numbers
|
';': [0x00, 0x01, 0x00, 0x01, 0x02],
|
||||||
'0': [0x07, 0x05, 0x07],
|
'<': [0x01, 0x02, 0x04, 0x02, 0x01],
|
||||||
'1': [0x02, 0x02, 0x02],
|
'=': [0x00, 0x07, 0x00, 0x07, 0x00],
|
||||||
'2': [0x07, 0x07, 0x07],
|
'>': [0x04, 0x02, 0x01, 0x02, 0x04],
|
||||||
'3': [0x07, 0x07, 0x07],
|
'?': [0x07, 0x01, 0x02, 0x00, 0x02],
|
||||||
'4': [0x05, 0x07, 0x04],
|
'@': [0x07, 0x05, 0x07, 0x04, 0x07],
|
||||||
'5': [0x07, 0x07, 0x07],
|
'A': [0x02, 0x05, 0x07, 0x05, 0x05],
|
||||||
'6': [0x07, 0x07, 0x07],
|
'B': [0x06, 0x05, 0x06, 0x05, 0x06],
|
||||||
'7': [0x07, 0x04, 0x04],
|
'C': [0x07, 0x04, 0x04, 0x04, 0x07],
|
||||||
'8': [0x07, 0x07, 0x07],
|
'D': [0x06, 0x05, 0x05, 0x05, 0x06],
|
||||||
'9': [0x07, 0x07, 0x07],
|
'E': [0x07, 0x04, 0x06, 0x04, 0x07],
|
||||||
# Lowercase (limited)
|
'F': [0x07, 0x04, 0x06, 0x04, 0x04],
|
||||||
'a': [0x06, 0x07, 0x07],
|
'G': [0x07, 0x04, 0x05, 0x05, 0x07],
|
||||||
'b': [0x01, 0x07, 0x07],
|
'H': [0x05, 0x05, 0x07, 0x05, 0x05],
|
||||||
'c': [0x07, 0x01, 0x07],
|
'I': [0x07, 0x02, 0x02, 0x02, 0x07],
|
||||||
'd': [0x04, 0x07, 0x07],
|
'J': [0x01, 0x01, 0x01, 0x05, 0x02],
|
||||||
'e': [0x07, 0x07, 0x03],
|
'K': [0x05, 0x05, 0x06, 0x05, 0x05],
|
||||||
'f': [0x06, 0x07, 0x02],
|
'L': [0x04, 0x04, 0x04, 0x04, 0x07],
|
||||||
'g': [0x07, 0x07, 0x06],
|
'M': [0x05, 0x07, 0x07, 0x05, 0x05],
|
||||||
'h': [0x01, 0x07, 0x05],
|
'N': [0x05, 0x07, 0x07, 0x07, 0x05],
|
||||||
'i': [0x02, 0x00, 0x02],
|
'O': [0x02, 0x05, 0x05, 0x05, 0x02],
|
||||||
'j': [0x04, 0x00, 0x06],
|
'P': [0x06, 0x05, 0x06, 0x04, 0x04],
|
||||||
'k': [0x01, 0x06, 0x05],
|
'Q': [0x02, 0x05, 0x05, 0x06, 0x03],
|
||||||
'l': [0x02, 0x02, 0x02],
|
'R': [0x06, 0x05, 0x06, 0x05, 0x05],
|
||||||
'm': [0x07, 0x07, 0x05],
|
'S': [0x07, 0x04, 0x02, 0x01, 0x07],
|
||||||
'n': [0x07, 0x05, 0x05],
|
'T': [0x07, 0x02, 0x02, 0x02, 0x02],
|
||||||
'o': [0x07, 0x05, 0x07],
|
'U': [0x05, 0x05, 0x05, 0x05, 0x07],
|
||||||
'p': [0x07, 0x07, 0x01],
|
'V': [0x05, 0x05, 0x05, 0x05, 0x02],
|
||||||
'q': [0x07, 0x07, 0x04],
|
'W': [0x05, 0x05, 0x07, 0x07, 0x05],
|
||||||
'r': [0x07, 0x01, 0x01],
|
'X': [0x05, 0x05, 0x02, 0x05, 0x05],
|
||||||
's': [0x07, 0x07, 0x07],
|
'Y': [0x05, 0x05, 0x02, 0x02, 0x02],
|
||||||
't': [0x02, 0x07, 0x02],
|
'Z': [0x07, 0x01, 0x02, 0x04, 0x07],
|
||||||
'u': [0x05, 0x05, 0x07],
|
'[': [0x03, 0x02, 0x02, 0x02, 0x03],
|
||||||
'v': [0x05, 0x05, 0x02],
|
'\\': [0x04, 0x04, 0x02, 0x01, 0x01],
|
||||||
'w': [0x05, 0x07, 0x07],
|
']': [0x03, 0x01, 0x01, 0x01, 0x03],
|
||||||
'x': [0x05, 0x02, 0x05],
|
'^': [0x02, 0x05, 0x00, 0x00, 0x00],
|
||||||
'y': [0x05, 0x07, 0x02],
|
'_': [0x00, 0x00, 0x00, 0x00, 0x07],
|
||||||
'z': [0x07, 0x02, 0x07],
|
'`': [0x02, 0x01, 0x00, 0x00, 0x00],
|
||||||
# Punctuation
|
'a': [0x00, 0x07, 0x05, 0x05, 0x03],
|
||||||
' ': [0x00, 0x00, 0x00],
|
'b': [0x04, 0x04, 0x06, 0x05, 0x06],
|
||||||
'.': [0x00, 0x00, 0x02],
|
'c': [0x00, 0x07, 0x04, 0x04, 0x07],
|
||||||
',': [0x00, 0x00, 0x02],
|
'd': [0x01, 0x01, 0x07, 0x05, 0x07],
|
||||||
'!': [0x02, 0x02, 0x00],
|
'e': [0x00, 0x07, 0x07, 0x04, 0x07],
|
||||||
'?': [0x07, 0x06, 0x02],
|
'f': [0x03, 0x04, 0x06, 0x04, 0x04],
|
||||||
':': [0x00, 0x02, 0x00],
|
'g': [0x00, 0x07, 0x05, 0x07, 0x01],
|
||||||
';': [0x00, 0x02, 0x02],
|
'h': [0x04, 0x04, 0x06, 0x05, 0x05],
|
||||||
'-': [0x00, 0x07, 0x00],
|
'i': [0x01, 0x00, 0x01, 0x01, 0x01],
|
||||||
'_': [0x00, 0x00, 0x07],
|
'j': [0x01, 0x00, 0x01, 0x01, 0x06],
|
||||||
'+': [0x02, 0x07, 0x02],
|
'k': [0x04, 0x05, 0x06, 0x05, 0x05],
|
||||||
'=': [0x07, 0x00, 0x07],
|
'l': [0x06, 0x02, 0x02, 0x02, 0x07],
|
||||||
'(': [0x02, 0x01, 0x02],
|
'm': [0x00, 0x05, 0x07, 0x05, 0x05],
|
||||||
')': [0x02, 0x04, 0x02],
|
'n': [0x00, 0x06, 0x05, 0x05, 0x05],
|
||||||
'[': [0x03, 0x01, 0x03],
|
'o': [0x00, 0x02, 0x05, 0x05, 0x02],
|
||||||
']': [0x06, 0x04, 0x06],
|
'p': [0x00, 0x06, 0x05, 0x06, 0x04],
|
||||||
'/': [0x04, 0x02, 0x01],
|
'q': [0x00, 0x07, 0x05, 0x07, 0x01],
|
||||||
'\\': [0x01, 0x02, 0x04],
|
'r': [0x00, 0x03, 0x04, 0x04, 0x04],
|
||||||
'*': [0x05, 0x02, 0x05],
|
's': [0x00, 0x07, 0x06, 0x03, 0x07],
|
||||||
'"': [0x05, 0x00, 0x00],
|
't': [0x04, 0x07, 0x04, 0x04, 0x03],
|
||||||
"'": [0x02, 0x00, 0x00],
|
'u': [0x00, 0x05, 0x05, 0x05, 0x07],
|
||||||
'°': [0x02, 0x05, 0x02], # Degree symbol
|
'v': [0x00, 0x05, 0x05, 0x05, 0x02],
|
||||||
'|': [0x02, 0x02, 0x02], # Vertical bar
|
'w': [0x00, 0x05, 0x05, 0x07, 0x05],
|
||||||
|
'x': [0x00, 0x05, 0x02, 0x02, 0x05],
|
||||||
|
'y': [0x00, 0x05, 0x05, 0x07, 0x01],
|
||||||
|
'z': [0x00, 0x07, 0x02, 0x04, 0x07],
|
||||||
|
'|': [0x01, 0x01, 0x01, 0x01, 0x01],
|
||||||
|
'~': [0x00, 0x03, 0x06, 0x00, 0x00],
|
||||||
|
'°': [0x02, 0x05, 0x02, 0x00, 0x00],
|
||||||
|
'¶': [0x07, 0x05, 0x05, 0x05, 0x05],
|
||||||
|
'•': [0x00, 0x00, 0x01, 0x00, 0x00],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,109 +1,114 @@
|
|||||||
# fonts.py - Ready-to-use fonts for LED matrix
|
# fonts.py - Optimized fonts for LED matrix with character width adjustment
|
||||||
|
|
||||||
|
# 5x7 Font (Optimized Width)
|
||||||
# 5x7 Font (Medium)
|
|
||||||
font_5x7 = {
|
font_5x7 = {
|
||||||
# Uppercase letters (A-Z)
|
# Uppercase letters (A-Z) - Optimized for better spacing
|
||||||
'A': [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
|
'A': [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], # Width: 5
|
||||||
'B': [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E],
|
'B': [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E], # Width: 5
|
||||||
'C': [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E],
|
'C': [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E], # Width: 5
|
||||||
'D': [0x1E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1E],
|
'D': [0x1E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1E], # Width: 5
|
||||||
'E': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F],
|
'E': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F], # Width: 5
|
||||||
'F': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10],
|
'F': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10], # Width: 5
|
||||||
'G': [0x0E, 0x11, 0x10, 0x13, 0x11, 0x11, 0x0F],
|
'G': [0x0E, 0x11, 0x10, 0x13, 0x11, 0x11, 0x0F], # Width: 5
|
||||||
'H': [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
|
'H': [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], # Width: 5
|
||||||
'I': [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
|
# 'I': [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
||||||
'J': [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C],
|
'I': [0x07, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
||||||
'K': [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11],
|
'J': [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C], # Width: 4
|
||||||
'L': [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F],
|
'K': [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11], # Width: 5
|
||||||
'M': [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11],
|
'L': [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F], # Width: 5
|
||||||
'N': [0x11, 0x19, 0x19, 0x15, 0x13, 0x13, 0x11],
|
'M': [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11], # Width: 5
|
||||||
'O': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
|
'N': [0x11, 0x19, 0x19, 0x15, 0x13, 0x13, 0x11], # Width: 5
|
||||||
'P': [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10],
|
'O': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Width: 5
|
||||||
'Q': [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D],
|
'P': [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10], # Width: 5
|
||||||
'R': [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11],
|
'Q': [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D], # Width: 5
|
||||||
'S': [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E],
|
'R': [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11], # Width: 5
|
||||||
'T': [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04],
|
'S': [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E], # Width: 5
|
||||||
'U': [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
|
'T': [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04], # Width: 5
|
||||||
'V': [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04],
|
'U': [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Width: 5
|
||||||
'W': [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A],
|
'V': [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04], # Width: 5
|
||||||
'X': [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11],
|
'W': [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A], # Width: 5
|
||||||
'Y': [0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04],
|
'X': [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11], # Width: 5
|
||||||
'Z': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F],
|
'Y': [0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04], # Width: 5
|
||||||
# Lowercase letters (a-z)
|
'Z': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F], # Width: 5
|
||||||
'a': [0x00, 0x00, 0x0E, 0x01, 0x0F, 0x11, 0x0F],
|
# Lowercase letters (a-z) - Optimized for compact display
|
||||||
'b': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E],
|
'a': [0x00, 0x00, 0x0E, 0x01, 0x0F, 0x11, 0x0F], # Width: 4
|
||||||
'c': [0x00, 0x00, 0x0E, 0x11, 0x10, 0x11, 0x0E],
|
'b': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E], # Width: 5
|
||||||
'd': [0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x0F],
|
'c': [0x00, 0x00, 0x0E, 0x11, 0x10, 0x11, 0x0E], # Width: 4
|
||||||
'e': [0x00, 0x00, 0x0E, 0x11, 0x1F, 0x10, 0x0E],
|
'd': [0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x0F], # Width: 5
|
||||||
'f': [0x06, 0x09, 0x08, 0x1C, 0x08, 0x08, 0x08],
|
'e': [0x00, 0x00, 0x0E, 0x11, 0x1F, 0x10, 0x0E], # Width: 4
|
||||||
'g': [0x00, 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x0E],
|
'f': [0x06, 0x09, 0x08, 0x1C, 0x08, 0x08, 0x08], # Width: 4
|
||||||
'h': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x11],
|
'g': [0x00, 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x0E], # Width: 5
|
||||||
'i': [0x04, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x0E],
|
'h': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x11], # Width: 5
|
||||||
'j': [0x02, 0x00, 0x06, 0x02, 0x02, 0x12, 0x0C],
|
# 'i': [0x00, 0x04, 0x00, 0x0C, 0x04, 0x04, 0x0E], # Width: 2
|
||||||
'k': [0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12],
|
'i': [0x00, 0x02, 0x00, 0x06, 0x02, 0x02, 0x07], # Width: 2
|
||||||
'l': [0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
|
'j': [0x00, 0x02, 0x00, 0x06, 0x02, 0x12, 0x0C], # Width: 3
|
||||||
'm': [0x00, 0x00, 0x1A, 0x15, 0x15, 0x15, 0x15],
|
'k': [0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12], # Width: 4
|
||||||
'n': [0x00, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11],
|
# 'l': [0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
||||||
'o': [0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E],
|
'l': [0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
||||||
'p': [0x00, 0x00, 0x1E, 0x11, 0x1E, 0x10, 0x10],
|
'm': [0x00, 0x00, 0x1A, 0x15, 0x15, 0x15, 0x15], # Width: 5
|
||||||
'q': [0x00, 0x00, 0x0D, 0x13, 0x0F, 0x01, 0x01],
|
'n': [0x00, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11], # Width: 5
|
||||||
'r': [0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10],
|
'o': [0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E], # Width: 4
|
||||||
's': [0x00, 0x00, 0x0E, 0x10, 0x0E, 0x01, 0x1E],
|
'p': [0x00, 0x00, 0x1E, 0x11, 0x1E, 0x10, 0x10], # Width: 5
|
||||||
't': [0x08, 0x08, 0x1C, 0x08, 0x08, 0x09, 0x06],
|
'q': [0x00, 0x00, 0x0D, 0x13, 0x0F, 0x01, 0x01], # Width: 5
|
||||||
'u': [0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0D],
|
'r': [0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10], # Width: 5
|
||||||
'v': [0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04],
|
's': [0x00, 0x00, 0x0E, 0x10, 0x0E, 0x01, 0x1E], # Width: 4
|
||||||
'w': [0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A],
|
't': [0x08, 0x08, 0x1C, 0x08, 0x08, 0x09, 0x06], # Width: 4
|
||||||
'x': [0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11],
|
'u': [0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0D], # Width: 5
|
||||||
'y': [0x00, 0x00, 0x11, 0x11, 0x0F, 0x01, 0x0E],
|
'v': [0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04], # Width: 5
|
||||||
'z': [0x00, 0x00, 0x1F, 0x02, 0x04, 0x08, 0x1F],
|
'w': [0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A], # Width: 5
|
||||||
# Numbers (0-9)
|
'x': [0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11], # Width: 5
|
||||||
'0': [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E],
|
'y': [0x00, 0x00, 0x11, 0x11, 0x0F, 0x01, 0x0E], # Width: 5
|
||||||
'1': [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E],
|
'z': [0x00, 0x00, 0x1F, 0x02, 0x04, 0x08, 0x1F], # Width: 5
|
||||||
'2': [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F],
|
# Numbers (0-9) - Optimized for consistent width
|
||||||
'3': [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E],
|
'0': [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E], # Width: 5
|
||||||
'4': [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02],
|
'1': [0x02, 0x06, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
||||||
'5': [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E],
|
# '1': [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
||||||
'6': [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E],
|
# '1': [0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C], # Width: 3
|
||||||
'7': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08],
|
'2': [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F], # Width: 5
|
||||||
'8': [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E],
|
'3': [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E], # Width: 5
|
||||||
'9': [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C],
|
'4': [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02], # Width: 5
|
||||||
# Punctuation and symbols
|
'5': [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E], # Width: 5
|
||||||
' ': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
'6': [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E], # Width: 5
|
||||||
'!': [0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04],
|
'7': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08], # Width: 5
|
||||||
'?': [0x0E, 0x11, 0x02, 0x04, 0x04, 0x00, 0x04],
|
'8': [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E], # Width: 5
|
||||||
'.': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04],
|
'9': [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C], # Width: 5
|
||||||
',': [0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08],
|
# Punctuation and symbols - Optimized widths
|
||||||
':': [0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00],
|
' ': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 2
|
||||||
';': [0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x08],
|
# '!': [0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04], # Width: 1
|
||||||
"'": [0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00],
|
'!': [0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01], # Width: 1
|
||||||
'"': [0x0A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00],
|
'?': [0x0E, 0x11, 0x02, 0x04, 0x04, 0x00, 0x04], # Width: 5
|
||||||
'-': [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00],
|
'.': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], # Width: 1
|
||||||
'_': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F],
|
',': [0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02], # Width: 1
|
||||||
'+': [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00],
|
':': [0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00], # Width: 1
|
||||||
'=': [0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00],
|
';': [0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02], # Width: 1
|
||||||
'*': [0x00, 0x0A, 0x04, 0x1F, 0x04, 0x0A, 0x00],
|
"'": [0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 1
|
||||||
'/': [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00],
|
'"': [0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 3
|
||||||
'\\': [0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00],
|
'-': [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00], # Width: 5
|
||||||
'(': [0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02],
|
'_': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F], # Width: 5
|
||||||
')': [0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08],
|
'+': [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00], # Width: 5
|
||||||
'[': [0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E],
|
'=': [0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00], # Width: 5
|
||||||
']': [0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E],
|
'*': [0x00, 0x0A, 0x04, 0x1F, 0x04, 0x0A, 0x00], # Width: 5
|
||||||
'{': [0x06, 0x04, 0x04, 0x08, 0x04, 0x04, 0x06],
|
'/': [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00], # Width: 5
|
||||||
'}': [0x0C, 0x04, 0x04, 0x02, 0x04, 0x04, 0x0C],
|
'\\': [0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00], # Width: 5
|
||||||
'<': [0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00],
|
'(': [0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01], # Width: 3
|
||||||
'>': [0x00, 0x08, 0x04, 0x02, 0x04, 0x08, 0x00],
|
')': [0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04], # Width: 3
|
||||||
'@': [0x0E, 0x11, 0x17, 0x15, 0x17, 0x10, 0x0E],
|
'[': [0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07], # Width: 3
|
||||||
'#': [0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A],
|
']': [0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07], # Width: 3
|
||||||
'$': [0x04, 0x0F, 0x14, 0x0E, 0x05, 0x1E, 0x04],
|
'{': [0x03, 0x02, 0x02, 0x04, 0x02, 0x02, 0x03], # Width: 3
|
||||||
'%': [0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03],
|
'}': [0x06, 0x02, 0x02, 0x01, 0x02, 0x02, 0x06], # Width: 3
|
||||||
'&': [0x0C, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0D],
|
'<': [0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00], # Width: 4
|
||||||
'^': [0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00],
|
'>': [0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x00], # Width: 4
|
||||||
'~': [0x00, 0x00, 0x00, 0x0D, 0x12, 0x00, 0x00],
|
'@': [0x0E, 0x11, 0x17, 0x15, 0x17, 0x10, 0x0E], # Width: 5
|
||||||
|
'#': [0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A], # Width: 5
|
||||||
|
'$': [0x04, 0x0F, 0x14, 0x0E, 0x05, 0x1E, 0x04], # Width: 5
|
||||||
|
'%': [0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03], # Width: 5
|
||||||
|
'&': [0x0C, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0D], # Width: 5
|
||||||
|
'^': [0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00], # Width: 5
|
||||||
|
'~': [0x00, 0x00, 0x00, 0x0D, 0x12, 0x00, 0x00], # Width: 5
|
||||||
# Special characters
|
# Special characters
|
||||||
'°': [0x0E, 0x0A, 0x0E, 0x00, 0x00, 0x00, 0x00], # Degree symbol
|
'°': [0x07, 0x05, 0x07, 0x00, 0x00, 0x00, 0x00], # Width: 3 (Degree symbol)
|
||||||
'|': [0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04], # Vertical bar
|
'|': [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01], # Width: 1 (Vertical bar)
|
||||||
'`': [0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00], # Backtick
|
'`': [0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 2 (Backtick)
|
||||||
'¶': [0x1E, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A], # Paragraph symbol
|
'¶': [0x0F, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D], # Width: 5 (Paragraph symbol)
|
||||||
'•': [0x00, 0x00, 0x04, 0x0E, 0x04, 0x00, 0x00], # Bullet point
|
'•': [0x00, 0x00, 0x02, 0x07, 0x02, 0x00, 0x00], # Width: 3 (Bullet point)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,237 +0,0 @@
|
|||||||
# fonts.py - Optimized fonts for LED matrix with character width adjustment
|
|
||||||
|
|
||||||
# 5x7 Font (Optimized Width)
|
|
||||||
font_5x7 = {
|
|
||||||
# Uppercase letters (A-Z) - Optimized for better spacing
|
|
||||||
'A': [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], # Width: 5
|
|
||||||
'B': [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E], # Width: 5
|
|
||||||
'C': [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E], # Width: 5
|
|
||||||
'D': [0x1E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1E], # Width: 5
|
|
||||||
'E': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F], # Width: 5
|
|
||||||
'F': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10], # Width: 5
|
|
||||||
'G': [0x0E, 0x11, 0x10, 0x13, 0x11, 0x11, 0x0F], # Width: 5
|
|
||||||
'H': [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], # Width: 5
|
|
||||||
# 'I': [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
|
||||||
'I': [0x07, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
|
||||||
'J': [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C], # Width: 4
|
|
||||||
'K': [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11], # Width: 5
|
|
||||||
'L': [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F], # Width: 5
|
|
||||||
'M': [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11], # Width: 5
|
|
||||||
'N': [0x11, 0x19, 0x19, 0x15, 0x13, 0x13, 0x11], # Width: 5
|
|
||||||
'O': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Width: 5
|
|
||||||
'P': [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10], # Width: 5
|
|
||||||
'Q': [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D], # Width: 5
|
|
||||||
'R': [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11], # Width: 5
|
|
||||||
'S': [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E], # Width: 5
|
|
||||||
'T': [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04], # Width: 5
|
|
||||||
'U': [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Width: 5
|
|
||||||
'V': [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04], # Width: 5
|
|
||||||
'W': [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A], # Width: 5
|
|
||||||
'X': [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11], # Width: 5
|
|
||||||
'Y': [0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04], # Width: 5
|
|
||||||
'Z': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F], # Width: 5
|
|
||||||
# Lowercase letters (a-z) - Optimized for compact display
|
|
||||||
'a': [0x00, 0x00, 0x0E, 0x01, 0x0F, 0x11, 0x0F], # Width: 4
|
|
||||||
'b': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E], # Width: 5
|
|
||||||
'c': [0x00, 0x00, 0x0E, 0x11, 0x10, 0x11, 0x0E], # Width: 4
|
|
||||||
'd': [0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x0F], # Width: 5
|
|
||||||
'e': [0x00, 0x00, 0x0E, 0x11, 0x1F, 0x10, 0x0E], # Width: 4
|
|
||||||
'f': [0x06, 0x09, 0x08, 0x1C, 0x08, 0x08, 0x08], # Width: 4
|
|
||||||
'g': [0x00, 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x0E], # Width: 5
|
|
||||||
'h': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x11], # Width: 5
|
|
||||||
# 'i': [0x00, 0x04, 0x00, 0x0C, 0x04, 0x04, 0x0E], # Width: 2
|
|
||||||
'i': [0x00, 0x02, 0x00, 0x06, 0x02, 0x02, 0x07], # Width: 2
|
|
||||||
'j': [0x00, 0x02, 0x00, 0x06, 0x02, 0x12, 0x0C], # Width: 3
|
|
||||||
'k': [0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12], # Width: 4
|
|
||||||
# 'l': [0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
|
||||||
'l': [0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
|
||||||
'm': [0x00, 0x00, 0x1A, 0x15, 0x15, 0x15, 0x15], # Width: 5
|
|
||||||
'n': [0x00, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11], # Width: 5
|
|
||||||
'o': [0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E], # Width: 4
|
|
||||||
'p': [0x00, 0x00, 0x1E, 0x11, 0x1E, 0x10, 0x10], # Width: 5
|
|
||||||
'q': [0x00, 0x00, 0x0D, 0x13, 0x0F, 0x01, 0x01], # Width: 5
|
|
||||||
'r': [0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10], # Width: 5
|
|
||||||
's': [0x00, 0x00, 0x0E, 0x10, 0x0E, 0x01, 0x1E], # Width: 4
|
|
||||||
't': [0x08, 0x08, 0x1C, 0x08, 0x08, 0x09, 0x06], # Width: 4
|
|
||||||
'u': [0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0D], # Width: 5
|
|
||||||
'v': [0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04], # Width: 5
|
|
||||||
'w': [0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A], # Width: 5
|
|
||||||
'x': [0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11], # Width: 5
|
|
||||||
'y': [0x00, 0x00, 0x11, 0x11, 0x0F, 0x01, 0x0E], # Width: 5
|
|
||||||
'z': [0x00, 0x00, 0x1F, 0x02, 0x04, 0x08, 0x1F], # Width: 5
|
|
||||||
# Numbers (0-9) - Optimized for consistent width
|
|
||||||
'0': [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E], # Width: 5
|
|
||||||
'1': [0x02, 0x06, 0x02, 0x02, 0x02, 0x02, 0x07], # Width: 3
|
|
||||||
# '1': [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E], # Width: 3
|
|
||||||
# '1': [0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C], # Width: 3
|
|
||||||
'2': [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F], # Width: 5
|
|
||||||
'3': [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E], # Width: 5
|
|
||||||
'4': [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02], # Width: 5
|
|
||||||
'5': [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E], # Width: 5
|
|
||||||
'6': [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E], # Width: 5
|
|
||||||
'7': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08], # Width: 5
|
|
||||||
'8': [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E], # Width: 5
|
|
||||||
'9': [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C], # Width: 5
|
|
||||||
# Punctuation and symbols - Optimized widths
|
|
||||||
' ': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 2
|
|
||||||
# '!': [0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04], # Width: 1
|
|
||||||
'!': [0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01], # Width: 1
|
|
||||||
'?': [0x0E, 0x11, 0x02, 0x04, 0x04, 0x00, 0x04], # Width: 5
|
|
||||||
'.': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], # Width: 1
|
|
||||||
',': [0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02], # Width: 1
|
|
||||||
':': [0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00], # Width: 1
|
|
||||||
';': [0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x02], # Width: 1
|
|
||||||
"'": [0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 1
|
|
||||||
'"': [0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 3
|
|
||||||
'-': [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00], # Width: 5
|
|
||||||
'_': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F], # Width: 5
|
|
||||||
'+': [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00], # Width: 5
|
|
||||||
'=': [0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00], # Width: 5
|
|
||||||
'*': [0x00, 0x0A, 0x04, 0x1F, 0x04, 0x0A, 0x00], # Width: 5
|
|
||||||
'/': [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00], # Width: 5
|
|
||||||
'\\': [0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00], # Width: 5
|
|
||||||
'(': [0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01], # Width: 3
|
|
||||||
')': [0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04], # Width: 3
|
|
||||||
'[': [0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07], # Width: 3
|
|
||||||
']': [0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07], # Width: 3
|
|
||||||
'{': [0x03, 0x02, 0x02, 0x04, 0x02, 0x02, 0x03], # Width: 3
|
|
||||||
'}': [0x06, 0x02, 0x02, 0x01, 0x02, 0x02, 0x06], # Width: 3
|
|
||||||
'<': [0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00], # Width: 4
|
|
||||||
'>': [0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x00], # Width: 4
|
|
||||||
'@': [0x0E, 0x11, 0x17, 0x15, 0x17, 0x10, 0x0E], # Width: 5
|
|
||||||
'#': [0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A], # Width: 5
|
|
||||||
'$': [0x04, 0x0F, 0x14, 0x0E, 0x05, 0x1E, 0x04], # Width: 5
|
|
||||||
'%': [0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03], # Width: 5
|
|
||||||
'&': [0x0C, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0D], # Width: 5
|
|
||||||
'^': [0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00], # Width: 5
|
|
||||||
'~': [0x00, 0x00, 0x00, 0x0D, 0x12, 0x00, 0x00], # Width: 5
|
|
||||||
# Special characters
|
|
||||||
'°': [0x07, 0x05, 0x07, 0x00, 0x00, 0x00, 0x00], # Width: 3 (Degree symbol)
|
|
||||||
'|': [0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01], # Width: 1 (Vertical bar)
|
|
||||||
'`': [0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], # Width: 2 (Backtick)
|
|
||||||
'¶': [0x0F, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D], # Width: 5 (Paragraph symbol)
|
|
||||||
'•': [0x00, 0x00, 0x02, 0x07, 0x02, 0x00, 0x00], # Width: 3 (Bullet point)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Character width mapping for optimized spacing
|
|
||||||
char_width = {
|
|
||||||
# Wide characters (5 pixels)
|
|
||||||
'A': 5,
|
|
||||||
'B': 5,
|
|
||||||
'C': 5,
|
|
||||||
'D': 5,
|
|
||||||
'E': 5,
|
|
||||||
'F': 5,
|
|
||||||
'G': 5,
|
|
||||||
'H': 5,
|
|
||||||
'K': 5,
|
|
||||||
'L': 5,
|
|
||||||
'M': 5,
|
|
||||||
'N': 5,
|
|
||||||
'O': 5,
|
|
||||||
'P': 5,
|
|
||||||
'Q': 5,
|
|
||||||
'R': 5,
|
|
||||||
'S': 5,
|
|
||||||
'T': 5,
|
|
||||||
'U': 5,
|
|
||||||
'V': 5,
|
|
||||||
'W': 5,
|
|
||||||
'X': 5,
|
|
||||||
'Y': 5,
|
|
||||||
'Z': 5,
|
|
||||||
'b': 5,
|
|
||||||
'd': 5,
|
|
||||||
'g': 5,
|
|
||||||
'h': 5,
|
|
||||||
'm': 5,
|
|
||||||
'n': 5,
|
|
||||||
'p': 5,
|
|
||||||
'q': 5,
|
|
||||||
'u': 5,
|
|
||||||
'v': 5,
|
|
||||||
'w': 5,
|
|
||||||
'x': 5,
|
|
||||||
'y': 5,
|
|
||||||
'z': 5,
|
|
||||||
'0': 5,
|
|
||||||
'2': 5,
|
|
||||||
'3': 5,
|
|
||||||
'4': 5,
|
|
||||||
'5': 5,
|
|
||||||
'6': 5,
|
|
||||||
'7': 5,
|
|
||||||
'8': 5,
|
|
||||||
'9': 5,
|
|
||||||
'?': 5,
|
|
||||||
'-': 5,
|
|
||||||
'_': 5,
|
|
||||||
'+': 5,
|
|
||||||
'=': 5,
|
|
||||||
'*': 5,
|
|
||||||
'/': 5,
|
|
||||||
'\\': 5,
|
|
||||||
'@': 5,
|
|
||||||
'#': 5,
|
|
||||||
'$': 5,
|
|
||||||
'%': 5,
|
|
||||||
'&': 5,
|
|
||||||
'^': 5,
|
|
||||||
'~': 5,
|
|
||||||
'¶': 4,
|
|
||||||
# Medium characters (4 pixels)
|
|
||||||
'J': 5,
|
|
||||||
'a': 5,
|
|
||||||
'c': 5,
|
|
||||||
'e': 5,
|
|
||||||
'f': 5,
|
|
||||||
'k': 5,
|
|
||||||
'o': 5,
|
|
||||||
's': 5,
|
|
||||||
't': 5,
|
|
||||||
'<': 4,
|
|
||||||
'>': 4,
|
|
||||||
# Narrow characters (3 pixels)
|
|
||||||
'I': 3,
|
|
||||||
'1': 3,
|
|
||||||
'l': 3,
|
|
||||||
'j': 4,
|
|
||||||
'(': 3,
|
|
||||||
')': 3,
|
|
||||||
'[': 3,
|
|
||||||
']': 3,
|
|
||||||
'{': 3,
|
|
||||||
'}': 3,
|
|
||||||
'°': 3,
|
|
||||||
'•': 3,
|
|
||||||
# Very narrow characters (2 pixels)
|
|
||||||
'i': 3,
|
|
||||||
' ': 1,
|
|
||||||
'`': 2,
|
|
||||||
# Single pixel characters
|
|
||||||
'!': 1,
|
|
||||||
'.': 1,
|
|
||||||
',': 2,
|
|
||||||
':': 1,
|
|
||||||
';': 2,
|
|
||||||
"'": 1,
|
|
||||||
'|': 1,
|
|
||||||
# Special cases
|
|
||||||
'"': 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def get_char_width(char, default_witdth=5):
|
|
||||||
"""Get the display width of a character for proper spacing"""
|
|
||||||
return char_width.get(char, default_witdth) # Default to 5 if character not found
|
|
||||||
|
|
||||||
|
|
||||||
def get_text_width(text):
|
|
||||||
"""Calculate total width of text including character spacing"""
|
|
||||||
width = 0
|
|
||||||
for char in text:
|
|
||||||
if char in char_width:
|
|
||||||
width += char_width[char] + 1 # +1 for spacing between characters
|
|
||||||
else:
|
|
||||||
width += 6 # Default width + spacing
|
|
||||||
return max(0, width - 1) # Remove last spacing
|
|
||||||
@@ -1,40 +1,4 @@
|
|||||||
from .font_3x5 import font_3x5
|
import app.utils.utils as utils
|
||||||
from .font_5x7 import font_5x7
|
|
||||||
from .font_5x7_opt import font_5x7 as font_5x7_opt
|
|
||||||
from .font_8x8 import font_8x8
|
|
||||||
from .font_16x16 import font_16x16
|
|
||||||
from ..emoji.emoji_5x7 import emoji_5x7
|
|
||||||
from ..emoji.emoji_8x8 import emoji_8x8
|
|
||||||
from ..emoji.emoji_16x16 import emoji_16x16
|
|
||||||
from ...utils.utils import number_to_bitarray_msb
|
|
||||||
|
|
||||||
fonts_meta_ = {
|
|
||||||
3: {'w': 3, 'h': 5},
|
|
||||||
5: {'w': 5, 'h': 7},
|
|
||||||
8: {'w': 8, 'h': 8},
|
|
||||||
16: {'w': 16, 'h': 16},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def fonts_meta(font):
|
|
||||||
if font == font_3x5:
|
|
||||||
return fonts_meta_[3]
|
|
||||||
elif font == font_5x7:
|
|
||||||
return fonts_meta_[5]
|
|
||||||
elif font == font_5x7_opt:
|
|
||||||
return fonts_meta_[5]
|
|
||||||
elif font == font_8x8:
|
|
||||||
return fonts_meta_[8]
|
|
||||||
elif font == font_16x16:
|
|
||||||
return fonts_meta_[16]
|
|
||||||
elif font == emoji_5x7:
|
|
||||||
return fonts_meta_[5]
|
|
||||||
elif font == emoji_8x8:
|
|
||||||
return fonts_meta_[8]
|
|
||||||
elif font == emoji_16x16:
|
|
||||||
return fonts_meta_[16]
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def char_width(char_matrix) -> int:
|
def char_width(char_matrix) -> int:
|
||||||
@@ -56,3 +20,66 @@ def char_width(char_matrix) -> int:
|
|||||||
cw += 1
|
cw += 1
|
||||||
|
|
||||||
return cw
|
return cw
|
||||||
|
|
||||||
|
|
||||||
|
def shift_letter_right(char, letter, debug=False) -> bool:
|
||||||
|
"""Prüfe ob das Zeichen auch komplett nach rechts gezogen ist
|
||||||
|
|
||||||
|
Args:
|
||||||
|
letter (_type_): Array[0..nBytes]
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: _description_
|
||||||
|
"""
|
||||||
|
|
||||||
|
def isLetterRight(letter):
|
||||||
|
def isByteRight(byte):
|
||||||
|
return True if 1 & byte == 1 else False
|
||||||
|
|
||||||
|
for byte in letter:
|
||||||
|
if isByteRight(byte):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
def shiftLetterRight(letter):
|
||||||
|
def shift(letter):
|
||||||
|
return [byte >> 1 for byte in letter]
|
||||||
|
|
||||||
|
shifted = letter
|
||||||
|
for i in range(8): # max 1 Bit's
|
||||||
|
shifted = shift(shifted)
|
||||||
|
if isLetterRight(shifted):
|
||||||
|
break
|
||||||
|
|
||||||
|
return shifted
|
||||||
|
|
||||||
|
if isLetterRight(letter):
|
||||||
|
return letter
|
||||||
|
|
||||||
|
# letter is not right shifted
|
||||||
|
shifted = shiftLetterRight(letter)
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('origin:')
|
||||||
|
utils.show_byte_matrix(char, letter)
|
||||||
|
print('shifted')
|
||||||
|
utils.show_byte_matrix(char, shifted)
|
||||||
|
|
||||||
|
return shifted
|
||||||
|
|
||||||
|
|
||||||
|
def align_font(font):
|
||||||
|
chars = [char for char in font]
|
||||||
|
print(chars)
|
||||||
|
|
||||||
|
# Print the dictionary
|
||||||
|
print('font_pretty = {')
|
||||||
|
for char in sorted(font.keys()):
|
||||||
|
shifted = shift_letter_right(char=char, letter=font[char])
|
||||||
|
hex_values = [f'0x{val:02X}' for val in shifted]
|
||||||
|
print(f"\t'{char}': [{', '.join(hex_values)}],")
|
||||||
|
print('}')
|
||||||
|
|
||||||
|
# return f'#keys: {len(list(font.keys()))}'
|
||||||
|
return f'#keys: {len(font)}'
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
from machine import Pin, RTC
|
from machine import Pin, RTC
|
||||||
from neopixel import NeoPixel
|
from neopixel import NeoPixel
|
||||||
from .fonts.fonts_utils import fonts_meta, char_width as charwidth
|
from .fonts.fonts_utils import char_width as charwidth
|
||||||
|
|
||||||
from .fonts.font_5x7 import font_5x7
|
from .fonts.font_5x7 import font_5x7
|
||||||
from .fonts.font_5x7_opt import font_5x7 as font_5x7_opt, get_char_width
|
|
||||||
from ..utils.colors import GRAY, RAINBOW, BLACK, WHITE, LIME
|
from ..utils.colors import GRAY, RAINBOW, BLACK, WHITE, LIME
|
||||||
from ..utils.utils import (
|
from ..utils.utils import (
|
||||||
get_german_timestamp_short,
|
get_german_timestamp_short,
|
||||||
@@ -32,7 +31,7 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
super().__init__(Pin(pin), self.MATRIX_WIDTH * self.MATRIX_HEIGHT)
|
super().__init__(Pin(pin), self.MATRIX_WIDTH * self.MATRIX_HEIGHT)
|
||||||
|
|
||||||
# Font configuration
|
# Font configuration
|
||||||
self.set_font(font_5x7_opt)
|
self.set_font(font_5x7)
|
||||||
|
|
||||||
def set_font(self, font):
|
def set_font(self, font):
|
||||||
"""
|
"""
|
||||||
@@ -43,10 +42,10 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
"""
|
"""
|
||||||
self.selected_font = font
|
self.selected_font = font
|
||||||
|
|
||||||
self.selected_font_meta = fonts_meta(font)
|
# Höhe des Fonts, Anzahl der Zeilen für jedes Zeichen
|
||||||
self.font_width = self.selected_font_meta['w']
|
# wir holen den Wert aus "A"
|
||||||
self.font_height = self.selected_font_meta['h']
|
self.font_height = len(self.selected_font['A'])
|
||||||
print(f'Font set: width: {self.font_width}; height: {self.font_height}')
|
print(f'Font set: width: per char; height: {self.font_height}')
|
||||||
|
|
||||||
def set_pixel(self, x, y, color):
|
def set_pixel(self, x, y, color):
|
||||||
"""
|
"""
|
||||||
@@ -92,27 +91,6 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
|
|
||||||
self.write()
|
self.write()
|
||||||
|
|
||||||
def draw_letter___obsolet(self, letter, x, y, color):
|
|
||||||
"""
|
|
||||||
Draw a single letter using current font
|
|
||||||
|
|
||||||
Args:
|
|
||||||
letter: Character to draw
|
|
||||||
x: X position
|
|
||||||
y: Y position
|
|
||||||
color: RGB color tuple
|
|
||||||
"""
|
|
||||||
if letter in self.selected_font:
|
|
||||||
char_data = self.selected_font[letter]
|
|
||||||
for row in range(self.font_height):
|
|
||||||
row_data = char_data[row]
|
|
||||||
for col in range(self.font_width):
|
|
||||||
# Check if pixel should be lit (MSB first)
|
|
||||||
if row_data & (1 << ((self.font_width - 1) - col)):
|
|
||||||
self.set_pixel(x + col, y + row, color)
|
|
||||||
else:
|
|
||||||
print(f'oops, letter does not exist in the font -> {letter}')
|
|
||||||
|
|
||||||
def draw_letter(self, letter, x, y, color):
|
def draw_letter(self, letter, x, y, color):
|
||||||
"""
|
"""
|
||||||
Draw a single letter using current font with optimized width
|
Draw a single letter using current font with optimized width
|
||||||
@@ -126,7 +104,6 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
|
|
||||||
if letter in self.selected_font:
|
if letter in self.selected_font:
|
||||||
char_data = self.selected_font[letter]
|
char_data = self.selected_font[letter]
|
||||||
# char_width = get_char_width(letter, default_witdth=16)
|
|
||||||
char_width = charwidth(char_data)
|
char_width = charwidth(char_data)
|
||||||
|
|
||||||
# background for the letter (full font size)
|
# background for the letter (full font size)
|
||||||
@@ -150,21 +127,6 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
else:
|
else:
|
||||||
print(f'oops, letter does not exist in the font -> {letter}')
|
print(f'oops, letter does not exist in the font -> {letter}')
|
||||||
|
|
||||||
def draw_text___obsolete(self, text, x, y, color=RAINBOW[2], spacing=1):
|
|
||||||
"""
|
|
||||||
Draw text string at specified position
|
|
||||||
|
|
||||||
Args:
|
|
||||||
text: String to display
|
|
||||||
x: Starting X position
|
|
||||||
y: Starting Y position
|
|
||||||
color: RGB color tuple
|
|
||||||
spacing: Pixels between characters
|
|
||||||
"""
|
|
||||||
for idx, char in enumerate(text):
|
|
||||||
char_x = x + (idx * (self.font_width + spacing))
|
|
||||||
self.draw_letter(char, char_x, y, color)
|
|
||||||
|
|
||||||
def draw_text(self, text, x, y, color):
|
def draw_text(self, text, x, y, color):
|
||||||
"""
|
"""
|
||||||
Draw text with optimized character spacing
|
Draw text with optimized character spacing
|
||||||
@@ -179,7 +141,7 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
for char in text:
|
for char in text:
|
||||||
self.draw_letter(char, current_x, y, color)
|
self.draw_letter(char, current_x, y, color)
|
||||||
# Move cursor by character width + 1 pixel spacing
|
# Move cursor by character width + 1 pixel spacing
|
||||||
char_width = get_char_width(char)
|
char_width = charwidth(self.selected_font[char])
|
||||||
current_x += char_width + 1
|
current_x += char_width + 1
|
||||||
|
|
||||||
def show_hello(self):
|
def show_hello(self):
|
||||||
@@ -243,7 +205,6 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
duration: How long to run animation in seconds
|
duration: How long to run animation in seconds
|
||||||
"""
|
"""
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
text_width = len(text) * (self.font_width + 1)
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
while time.time() - start_time < duration:
|
while time.time() - start_time < duration:
|
||||||
@@ -255,9 +216,10 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
|
|
||||||
# Draw text at floating position
|
# Draw text at floating position
|
||||||
for i, char in enumerate(text):
|
for i, char in enumerate(text):
|
||||||
char_x = current_x + (i * (self.font_width + 1))
|
char_width = charwidth(self.selected_font[char])
|
||||||
|
char_x = current_x + (i * (char_width + 1))
|
||||||
# Keep text within matrix bounds
|
# Keep text within matrix bounds
|
||||||
if 0 <= char_x < self.MATRIX_WIDTH - self.font_width:
|
if 0 <= char_x < self.MATRIX_WIDTH - char_width:
|
||||||
self.draw_letter(char, char_x, y, color)
|
self.draw_letter(char, char_x, y, color)
|
||||||
|
|
||||||
self.write()
|
self.write()
|
||||||
@@ -276,7 +238,12 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
duration: How long to run animation in seconds
|
duration: How long to run animation in seconds
|
||||||
"""
|
"""
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
text_width = len(text) * (self.font_width + 1)
|
# hier müssen wir die Länge/Breite in Pixel des gesamten Textes berechnen
|
||||||
|
# text_width_overall = len(text) * (self.font_width + 1)
|
||||||
|
### TODO: ACHTUNG: noch zu testen !!!
|
||||||
|
# Breite jedes Zeichens
|
||||||
|
text_width_overall = sum([charwidth(self.selected_font[char]) for char in text])
|
||||||
|
|
||||||
position = 0
|
position = 0
|
||||||
|
|
||||||
while time.time() - start_time < duration:
|
while time.time() - start_time < duration:
|
||||||
@@ -284,10 +251,11 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
|
|
||||||
# Draw text at current position
|
# Draw text at current position
|
||||||
for i, char in enumerate(text):
|
for i, char in enumerate(text):
|
||||||
char_x = int(position + (i * (self.font_width + 1)))
|
char_width = charwidth(self.selected_font[char])
|
||||||
|
char_x = int(position + (i * (char_width + 1)))
|
||||||
# Handle wrapping
|
# Handle wrapping
|
||||||
if char_x < -self.font_width:
|
if char_x < -char_width:
|
||||||
char_x += self.MATRIX_WIDTH + text_width
|
char_x += self.MATRIX_WIDTH + text_width_overall
|
||||||
if 0 <= char_x < self.MATRIX_WIDTH:
|
if 0 <= char_x < self.MATRIX_WIDTH:
|
||||||
self.draw_letter(char, char_x, y, color)
|
self.draw_letter(char, char_x, y, color)
|
||||||
|
|
||||||
@@ -295,7 +263,7 @@ class NeoPixel_64x64(NeoPixel):
|
|||||||
|
|
||||||
# Move left and wrap around
|
# Move left and wrap around
|
||||||
position -= speed
|
position -= speed
|
||||||
if position < -text_width:
|
if position < -text_width_overall:
|
||||||
position = self.MATRIX_WIDTH
|
position = self.MATRIX_WIDTH
|
||||||
|
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
|||||||
@@ -12,52 +12,6 @@ def number_to_bitarray_msb(number, bits=8):
|
|||||||
return [(number >> i) & 1 for i in range(bits - 1, -1, -1)]
|
return [(number >> i) & 1 for i in range(bits - 1, -1, -1)]
|
||||||
|
|
||||||
|
|
||||||
def is_letter_assigned_right(char, letter) -> bool:
|
|
||||||
"""Prüfe ob das Zeichen auch komplett nach rechts gezogen ist
|
|
||||||
|
|
||||||
Args:
|
|
||||||
letter (_type_): Array[0..nBytes]
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: _description_
|
|
||||||
"""
|
|
||||||
|
|
||||||
def isLetterRight(letter):
|
|
||||||
def isByteRight(byte):
|
|
||||||
return True if 1 & byte == 1 else False
|
|
||||||
|
|
||||||
for byte in letter:
|
|
||||||
if isByteRight(byte):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def shiftLetterRight(letter):
|
|
||||||
def shift(letter):
|
|
||||||
return [byte >> 1 for byte in letter]
|
|
||||||
|
|
||||||
shifted = letter
|
|
||||||
for i in range(8): # max 1 Bit's
|
|
||||||
shifted = shift(shifted)
|
|
||||||
if isLetterRight(shifted):
|
|
||||||
break
|
|
||||||
|
|
||||||
return shifted
|
|
||||||
|
|
||||||
if isLetterRight(letter):
|
|
||||||
return True
|
|
||||||
|
|
||||||
# letter is not right shifted
|
|
||||||
shifted = shiftLetterRight(letter)
|
|
||||||
|
|
||||||
print('origin:')
|
|
||||||
show_byte_matrix(char, letter)
|
|
||||||
print('shifted')
|
|
||||||
show_byte_matrix(char, shifted)
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_datetime_string(format='full'):
|
def get_datetime_string(format='full'):
|
||||||
"""
|
"""
|
||||||
Return date/time as string with different formats
|
Return date/time as string with different formats
|
||||||
|
|||||||
69
main.py
69
main.py
@@ -1,9 +1,12 @@
|
|||||||
# from machine import Pin, ADC # type: ignore
|
# from machine import Pin, ADC # type: ignore
|
||||||
from app.display.fonts.font_5x7_opt import font_5x7
|
from app.display.fonts.font_3x5 import font_3x5
|
||||||
|
from app.display.fonts.font_5x7 import font_5x7
|
||||||
|
from app.display.fonts.fonts_utils import align_font
|
||||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||||
from app.utils.colors import BLUE, GREEN, ORANGE, RAINBOW, RED, WHITE, YELLOW, GOLD
|
from app.utils.colors import BLUE, GREEN, ORANGE, RAINBOW, RED, WHITE, YELLOW, GOLD
|
||||||
from app.utils.system_load import show_system_load
|
from app.utils.system_load import show_system_load
|
||||||
import app.utils.utils as utils
|
import app.utils.utils as utils
|
||||||
|
import app.display.fonts.fonts_utils as fonts_utils
|
||||||
|
|
||||||
from app.web.wlan import Wlan
|
from app.web.wlan import Wlan
|
||||||
|
|
||||||
@@ -29,7 +32,7 @@ def emoji_test():
|
|||||||
# display.write_text('💛', 28, 47)
|
# display.write_text('💛', 28, 47)
|
||||||
|
|
||||||
char_row = '😀'
|
char_row = '😀'
|
||||||
utils.is_letter_assigned_right(char_row, emoji_8x8[char_row])
|
fonts_utils.shift_letter_right(char_row, emoji_8x8[char_row])
|
||||||
|
|
||||||
# try emoji
|
# try emoji
|
||||||
display.set_font(emoji_16x16)
|
display.set_font(emoji_16x16)
|
||||||
@@ -40,32 +43,25 @@ def weather_check(test_mode: bool = False):
|
|||||||
wlan = Wlan('WOKWI-Guest', '12345678')
|
wlan = Wlan('WOKWI-Guest', '12345678')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
display = NeoPixel_64x64()
|
|
||||||
display.clear()
|
display.clear()
|
||||||
display.draw_text('search wlan', 0, 0, color=YELLOW)
|
display.write_text('search wlan', 0, 0, color=YELLOW)
|
||||||
display.write()
|
|
||||||
|
|
||||||
display.clear_row(0, effect=False)
|
display.clear_row(0, effect=False)
|
||||||
|
|
||||||
# display.clear()
|
display.clear()
|
||||||
display.draw_text('wlan connected', 0, 0, color=RAINBOW[1])
|
display.set_font(font_3x5)
|
||||||
display.draw_text('querying', 0, 8, color=RAINBOW[1])
|
display.write_text('wlan connected', 0, 0, color=RAINBOW[1])
|
||||||
display.draw_text('weather data', 0, 16, color=RAINBOW[1])
|
display.write_text('querying', 0, 8, color=RAINBOW[1])
|
||||||
display.write()
|
display.write_text('weather data', 0, 16, color=RAINBOW[1])
|
||||||
|
|
||||||
w_resp = wlan.actual_weather(lang='en', test_mode=test_mode)
|
w_resp = wlan.actual_weather(lang='en', test_mode=test_mode)
|
||||||
|
|
||||||
display.clear()
|
display.clear()
|
||||||
|
|
||||||
# display.draw_text(f'{str(w_resp.location.name)}', 0, 0, color=RAINBOW[0])
|
|
||||||
# display.draw_text(f'{str(w_resp.current.temp_c)}°C', 0, 8, color=RAINBOW[1])
|
|
||||||
# display.draw_text(f'upd: {str(w_resp.current.last_updated)[-5:]}', 0, 16, color=RAINBOW[2])
|
|
||||||
# display.draw_text(f'cur: {str(w_resp.location.localtime)[-5:]}', 0, 24, color=RAINBOW[3])
|
|
||||||
# display.write()
|
|
||||||
|
|
||||||
delta = 8
|
delta = 8
|
||||||
ypos = 0
|
ypos = 0
|
||||||
display.write_text(f'{str(w_resp.location.name)}', 0, ypos, color=RAINBOW[0])
|
display.write_text(f'{str(w_resp.location.name).upper()}', 0, ypos, color=RAINBOW[0])
|
||||||
|
display.set_font(font_5x7)
|
||||||
ypos += delta
|
ypos += delta
|
||||||
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=RAINBOW[1])
|
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=RAINBOW[1])
|
||||||
ypos += delta
|
ypos += delta
|
||||||
@@ -86,28 +82,48 @@ def weather_check(test_mode: bool = False):
|
|||||||
print('finally done.')
|
print('finally done.')
|
||||||
|
|
||||||
|
|
||||||
def font_5x7_test() -> None:
|
def font_test(font) -> None:
|
||||||
|
display.set_font(font)
|
||||||
|
|
||||||
alphabet: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
alphabet: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
char_line_1 = alphabet[:11]
|
char_line_1 = alphabet[:11]
|
||||||
char_line_2 = alphabet[11:22]
|
char_line_2 = alphabet[11:22]
|
||||||
char_line_3 = alphabet[21:]
|
char_line_3 = alphabet[21:]
|
||||||
num_line = '0123456789'
|
num_line = '0123456789'
|
||||||
|
|
||||||
display.write_text(num_line, 0, 0)
|
row = 0
|
||||||
display.write_text(char_line_1.lower(), 0, 1, YELLOW)
|
incr = 6
|
||||||
display.write_text(char_line_2.lower(), 0, 2, YELLOW)
|
display.write_text(num_line, 0, row)
|
||||||
display.write_text(char_line_3.lower(), 0, 3, YELLOW)
|
row += incr
|
||||||
display.write_text(' !?.,:;\'"-_+=*/\\()', 0, 4, ORANGE)
|
display.write_text(char_line_1.upper(), 0, row, YELLOW)
|
||||||
|
row += incr
|
||||||
|
display.write_text(char_line_2.upper(), 0, row, YELLOW)
|
||||||
|
row += incr
|
||||||
|
display.write_text(char_line_3.upper(), 0, row, YELLOW)
|
||||||
|
row += incr
|
||||||
|
display.write_text(char_line_1.lower(), 0, row, YELLOW)
|
||||||
|
row += incr
|
||||||
|
display.write_text(char_line_2.lower(), 0, row, YELLOW)
|
||||||
|
row += incr
|
||||||
|
display.write_text(char_line_3.lower(), 0, row, YELLOW)
|
||||||
|
row += incr * 2
|
||||||
|
display.write_text('!.,:;\'"-_+=*/\\()~°•', 0, row, ORANGE)
|
||||||
|
|
||||||
|
|
||||||
|
def font_pretty(font):
|
||||||
|
pretty_font = align_font(font)
|
||||||
|
print(pretty_font)
|
||||||
|
|
||||||
|
|
||||||
def bit_arrays():
|
def bit_arrays():
|
||||||
|
display.set_font(font_3x5)
|
||||||
# c = 'A'
|
# c = 'A'
|
||||||
# print(c)
|
# print(c)
|
||||||
# [print(utils.number_to_bitarray_msb(num)) for num in font_5x7[c]]
|
# [print(utils.number_to_bitarray_msb(num)) for num in font_5x7[c]]
|
||||||
char_row = '1'
|
char_row = '1'
|
||||||
[display.write_text(c, 0, idx, YELLOW) for idx, c in enumerate(char_row)]
|
[display.write_text(c, 0, idx, YELLOW) for idx, c in enumerate(char_row)]
|
||||||
|
|
||||||
utils.is_letter_assigned_right(char_row, font_5x7[char_row])
|
fonts_utils.shift_letter_right(char_row, font_5x7[char_row])
|
||||||
|
|
||||||
# display.write_text(char_row, 0, len(char_row), ORANGE)
|
# display.write_text(char_row, 0, len(char_row), ORANGE)
|
||||||
# display.write_text('Kiel', 0, 7, BLUE)
|
# display.write_text('Kiel', 0, 7, BLUE)
|
||||||
@@ -123,7 +139,8 @@ def bit_arrays():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# emoji_test()
|
# emoji_test()
|
||||||
weather_check(test_mode=False)
|
# font_test(font_3x5)
|
||||||
# font_5x7_test()
|
|
||||||
# bit_arrays()
|
# bit_arrays()
|
||||||
# show_system_load()
|
# show_system_load()
|
||||||
|
# font_pretty(font_3x5)
|
||||||
|
weather_check(test_mode=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user