Skip to content

Commit

Permalink
Cranach Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
project-owner committed Dec 5, 2019
1 parent 8d9533d commit 963f7bd
Show file tree
Hide file tree
Showing 523 changed files with 7,375 additions and 1,504 deletions.
29 changes: 26 additions & 3 deletions config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ album.art = True
auto.play = True
long.press.time.ms = 700
poweroff = True
check.for.updates = False

[logging]
file.logging = False
Expand All @@ -32,14 +33,17 @@ enable.stdout = True
show.mouse.events = False

[file.browser]
audio.file.extensions = mp3,wav,wv,flac,ape
audio.file.extensions = aac,ac3,aiff,ape,flac,m4a,mp3,mp4,ogg,opus,wav,wma,wv
playlist.file.extensions = m3u,cue
folder.images = folder.jpg,folder.png,cover.jpg,cover.png,front.jpg,front.png
cover.art.folders = covers,artwork,scans,art
auto.play.next.track = True
cyclic.playback = True
hide.folder.name = False
folder.image.scale.ratio = 0.8
rows = 3
columns = 3
alignment = center

[web.server]
http.port = 8000
Expand All @@ -58,6 +62,8 @@ audiobooks = True
stream = False
cd-player = False
podcasts = True
airplay = False
spotify-connect = False

[home.navigator]
back = True
Expand All @@ -79,11 +85,20 @@ spectrum = True
lyrics = True
random = True

[languages.menu]
English-USA = True
German = True
French = True
Italian = True
Spanish = True
Russian = True

[voice.assistant]
type = Google Assistant
credentials = c:\ga\credentials.json
device.model.id = Peppy
device.id = my_peppy
command.display.time = 1

[colors]
color.web.bgr = 0,38,40
Expand All @@ -99,6 +114,14 @@ color.mute = 242,107,106
font.name = FiraSans.ttf

[scripts]
startup.script.name = startup.py
shutdown.script.name = shutdown.py
startup.script.name =
shutdown.script.name =

[rotary.encoders]
gpio.volume.up = 16
gpio.volume.down = 26
gpio.mute = 13
gpio.move.left = 6
gpio.move.right = 12
gpio.select = 5
jitter.filter = 1
63 changes: 31 additions & 32 deletions current.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
[current]
mode =
language =
stream =
mode =
language =
stream =
equalizer =

[player.settings]
volume =
mute =
pause =
volume =
mute =
pause =

[file.playback]
file.playback.mode =
folder =
file.playlist =
file =
track.time =
file.playback.mode =
folder =
file.playlist =
file =
track.time =

[cd.playback]
cd.drive.id =
cd.drive.name =
cd.track =
cd.track.time =
cd.drive.id =
cd.drive.name =
cd.track =
cd.track.time =

[audiobooks]
site =
book.title =
book.url =
book.track.filename =
book.time =
site =
book.title =
book.url =
book.track.filename =
book.time =

[podcasts]
podcast.url =
podcast.episode.name =
podcast.episode.url =
podcast.episode.time =
podcast.url =
podcast.episode.name =
podcast.episode.url =
podcast.episode.time =

[screensaver]
name =
delay =
name =
delay =

[timer]
sleep.time =
sleep =
poweroff =
wake.up.time =
wake.up =

sleep.time =
sleep =
poweroff =
wake.up.time =
wake.up =
21 changes: 13 additions & 8 deletions event/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from ui.screen.station import StationScreen
from ui.screen.fileplayer import FilePlayerScreen
from util.config import USAGE, USE_LIRC, USE_ROTARY_ENCODERS, SCREEN_INFO, FRAME_RATE, SHOW_MOUSE_EVENTS, \
FLIP_TOUCH_XY, WIDTH, HEIGHT, MULTI_TOUCH
FLIP_TOUCH_XY, WIDTH, HEIGHT, MULTI_TOUCH, ROTARY_ENCODERS, GPIO_VOLUME_UP, GPIO_VOLUME_DOWN, GPIO_MUTE, \
GPIO_MOVE_LEFT, GPIO_MOVE_RIGHT, GPIO_SELECT, JITTER_FILTER
from util.keys import kbd_keys, KEY_SUB_TYPE, SUB_TYPE_KEYBOARD, \
KEY_ACTION, KEY_KEYBOARD_KEY, KEY_VOLUME_UP, KEY_VOLUME_DOWN, USER_EVENT_TYPE, VOICE_EVENT_TYPE

Expand Down Expand Up @@ -124,17 +125,21 @@ def init_lirc(self):
def init_rotary_encoders(self):
""" Rotary encoders (RE) initializer.
This is executed only if RE enabled in config.txt. Two REs are configured this way:
1. Volume Control: GPIO16 - Volume Up, GPIO26 - Volume Down, GPIO13 - Mute
2. Tuning: GPIO12 - Move Right, GPIO6 - Move Left, GPIO5 - Select
RE events will be wrapped into keyboard events with the following assignment:
Volume Up - '+' key on numeric keypad, Volume Down - '-' key on keypad, Mute - 'x' key
This is executed only if RE enabled in config.txt.
RE events will be wrapped into keyboard events.
"""
if not self.config[USAGE][USE_ROTARY_ENCODERS]:
return
from event.rotary import RotaryEncoder
RotaryEncoder(16, 26, 13, pygame.K_KP_PLUS, pygame.K_KP_MINUS, pygame.K_x)
RotaryEncoder(12, 6, 5, pygame.K_RIGHT, pygame.K_LEFT, pygame.K_RETURN)
volume_up = self.config[ROTARY_ENCODERS][GPIO_VOLUME_UP]
volume_down = self.config[ROTARY_ENCODERS][GPIO_VOLUME_DOWN]
mute = self.config[ROTARY_ENCODERS][GPIO_MUTE]
move_left = self.config[ROTARY_ENCODERS][GPIO_MOVE_LEFT]
move_right = self.config[ROTARY_ENCODERS][GPIO_MOVE_RIGHT]
select = self.config[ROTARY_ENCODERS][GPIO_SELECT]
jitter_filter = self.config[ROTARY_ENCODERS][JITTER_FILTER]
RotaryEncoder(volume_up, volume_down, mute, pygame.K_KP_PLUS, pygame.K_KP_MINUS, pygame.K_x, jitter_filter)
RotaryEncoder(move_right, move_left, select, pygame.K_RIGHT, pygame.K_LEFT, pygame.K_RETURN, jitter_filter)

def handle_lirc_event(self, code):
""" LIRC event handler.
Expand Down
9 changes: 5 additions & 4 deletions event/rotary.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class RotaryEncoder(object):
ANTICLOCKWISE=2
BUTTONDOWN=3
BUTTONUP=4
ROTARY_JITTER_TOLERANCE = 2
KEY_DOWN_UP_INTERVAL = 0.1

rotary_a = 0
Expand All @@ -43,7 +42,7 @@ class RotaryEncoder(object):
last_state = 0
direction = 0

def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select):
def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select, jitter_filter):
""" Initializer
:param pinA: GPIO pin number to increment
Expand All @@ -52,6 +51,7 @@ def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select)
:param key_increment: keyboard key for increment event
:param key_decrement: keyboard key for decrement event
:param key_select: keyboard key for selection event
:param jitter_filter: jitter filter 0-no filter, 2 - two clicks before event
"""
self.lock = RLock()
try:
Expand All @@ -67,6 +67,7 @@ def __init__(self, pinA, pinB, button, key_increment, key_decrement, key_select)
self.key_increment = key_increment
self.key_decrement = key_decrement
self.key_select = key_select
self.jitter_filter = jitter_filter
self.gpio.setmode(self.gpio.BCM)
self.gpio.setwarnings(False)
self.gpio.setup(self.pinA, self.gpio.IN, pull_up_down=self.gpio.PUD_UP)
Expand Down Expand Up @@ -144,7 +145,7 @@ def handle_event(self, event):

if event == RotaryEncoder.CLOCKWISE:
logging.debug("Clockwise")
if self.increment_counter == self.ROTARY_JITTER_TOLERANCE:
if self.increment_counter == self.jitter_filter:
d[KEY_KEYBOARD_KEY] = self.key_increment
self.increment_counter = 0
self.decrement_counter = 0
Expand All @@ -154,7 +155,7 @@ def handle_event(self, event):
return
elif event == RotaryEncoder.ANTICLOCKWISE:
logging.debug("Anti-Clockwise")
if self.decrement_counter == self.ROTARY_JITTER_TOLERANCE:
if self.decrement_counter == self.jitter_filter:
d[KEY_KEYBOARD_KEY] = self.key_decrement
self.decrement_counter = 0
self.increment_counter = 0
Expand Down
Loading

0 comments on commit 963f7bd

Please sign in to comment.