aboutsummaryrefslogtreecommitdiff
path: root/host/matelight/config.py
blob: 2177292ba723b51ad678ec5a7cd093312bedef02 (plain)
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
import bdflib # Used to read the bitmap font

# Hard timeout in seconds after which (approximately) the rendering of a single item will be cut off
RENDERER_TIMEOUT = 20.0
# How long to show an image by default
DEFAULT_IMAGE_DURATION = 10.0
# Default scrolling speed in pixels/second
DEFAULT_SCROLL_SPEED = 4
# Pixels to leave blank between two letters
LETTER_SPACING = 1

FONT = bdflib.reader.read_bdf(open('fonts/5x8.bdf').readlines())
FONT_WIDTH = 5

# Computed value
FONT_PADDED_BINARY = ('{:0'+str(FONT_WIDTH+'b}').format

# Display geometry
# ┌─────────┐ ┌───┬───┬  ⋯  ┬───┬───┐
# │1 o o o 5│ │ 1 │   │     │   │16 │
# │6 o o o o│ ├───┼───┼  ⋯  ┼───┼───┤
# │o o o o o│ │17 │   │     │   │32 │
# │o o o o20│ └───┴───┴  ⋯  ┴───┴───┘
# └─────────┘
CRATE_WIDTH = 5
CRATE_HEIGHT = 4
CRATES_X = 16
CRATES_Y = 2

# Computed values
DISPLAY_WIDTH = CRATES_X * CRATE_WIDTH
DISPLAY_HEIGHT = CRATES_Y * CRATE_HEIGHT
FRAME_SIZE = DISPLAY_WIDTH*DISPLAY_HEIGHT*3