From 9e78a95ce90666da40a06b1c59c0199277556403 Mon Sep 17 00:00:00 2001 From: Andreas Demmelbauer Date: Tue, 16 Apr 2019 16:31:56 +0100 Subject: [PATCH] fix remote stuff --- discobert.py | 19 ++++--- lircrc | 89 +++++++++++++++------------------ remotes/Sony-RM-V33E.lircd.conf | 71 ++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 57 deletions(-) create mode 100644 remotes/Sony-RM-V33E.lircd.conf diff --git a/discobert.py b/discobert.py index 2ffb2b9..87130b1 100644 --- a/discobert.py +++ b/discobert.py @@ -97,8 +97,10 @@ def setStartupDmxScene(): # a universe of zeros cv = [0 for v in range(0, 512)] errorcode = [240,255,0,0,0,0] - scene = random.choice(dmxStartupScenes) - for index, val in enumerate(dmxUserScenes[scene]): + # get a random scene index + scene = random.choice(list(enumerate(dmxStartupScenes)))[0] + print(scene) + for index, val in enumerate(dmxStartupScenes[scene]): cv[index] = val dev.send_multi_value(1, cv) @@ -429,6 +431,7 @@ while True: pirstate = wiringpi.digitalRead(pin_pir) doorstate = wiringpi.digitalRead(pin_door) #print('pirstate: ', pirstate) + #print('doorstate: ', doorstate) # 0 => door closed # 1 => door open @@ -447,6 +450,8 @@ while True: remotesignal = lirc.nextcode() + #print('remotesignal: ', remotesignal) + if remotesignal: lastUsed = time.time() # user is active! inUse = True @@ -458,8 +463,6 @@ while True: setWorkingMode() if(code == "mode_power"): setOnOff() - #if(code == "mode_dmx_next"): - if(code == "mode_music_play_1"): startMusic('1') if(code == "mode_music_play_2"): @@ -490,13 +493,13 @@ while True: pauseMusic() if(code == "mode_music_rewind"): - seek(-30) + seek('-30') if(code == "mode_music_back"): - seek(-5) + seek('-5') if(code == "mode_music_forward"): - seek(5) + seek('+5') if(code == "mode_music_fastforward"): - seek(30) + seek('+30') if(code == "mode_volume_up"): changeVolume(5) diff --git a/lircrc b/lircrc index 0af03a1..a0d9e3c 100644 --- a/lircrc +++ b/lircrc @@ -1,31 +1,45 @@ +begin + button = KEY_STARTPHONO + prog = disco + config = mode_disco +end + +begin + button = KEY_STOPPHONO + prog = disco + config = mode_work +end + +begin + button = KEY_TAPE + prog = disco + config = mode_power +end + begin button = KEY_1 prog = disco config = mode_music_play_1 end - begin button = KEY_2 prog = disco config = mode_music_play_2 end - begin button = KEY_3 prog = disco config = mode_music_play_3 end - begin button = KEY_4 prog = disco config = mode_music_play_4 end - begin button = KEY_5 prog = disco @@ -38,25 +52,7 @@ begin config = mode_music_stop end -begin - button = KEY_MUTE - prog = disco - config = mode_music_mute -end - -begin - button = KEY_VOLUMEUP - prog = disco - repeat = 2 - config = mode_volume_up -end -begin - button = KEY_VOLUMEDOWN - prog = disco - repeat = 2 - config = mode_volume_down -end begin button = KEY_CD @@ -77,22 +73,11 @@ begin config = mode_play_oe1 end -begin - button = BTN_START - prog = disco - config = mode_disco -end - -begin - button = KEY_STOP - prog = disco - config = mode_work -end begin button = KEY_STOPCD prog = disco - config = mode_work + config = mode_music_stop end begin @@ -114,15 +99,9 @@ begin end begin - button = KEY_FORWARD - prog = disco - config = mode_music_forward -end - -begin - button = KEY_FASTFORWARD + button = KEY_REWIND prog = disco - config = mode_music_fastforward + config = mode_music_rewind end begin @@ -132,16 +111,15 @@ begin end begin - button = KEY_REWIND + button = KEY_FORWARD prog = disco - config = mode_music_rewind + config = mode_music_forward end - begin - button = KEY_REWIND + button = KEY_FASTFORWARD prog = disco - config = mode_music_rewind + config = mode_music_fastforward end begin @@ -156,9 +134,22 @@ begin config = mode_music_previous end +begin + button = KEY_VOLUMEUP + prog = disco + repeat = 2 + config = mode_volume_up +end begin - button = KEY_POWER + button = KEY_VOLUMEDOWN prog = disco - config = mode_power + repeat = 2 + config = mode_volume_down +end + +begin + button = KEY_MUTE + prog = disco + config = mode_music_mute end diff --git a/remotes/Sony-RM-V33E.lircd.conf b/remotes/Sony-RM-V33E.lircd.conf new file mode 100644 index 0000000..61bdd21 --- /dev/null +++ b/remotes/Sony-RM-V33E.lircd.conf @@ -0,0 +1,71 @@ + +# Please take the time to finish this file as described in +# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ +# and make it available to others by sending it to +# +# +# This config file was automatically generated +# using lirc-0.9.4c(default) on Tue Apr 16 15:31:07 2019 +# Command line used: -u ./Sony-RM-V33E.lircd.conf +# Kernel version (uname -r): 4.14.98-v7+ +# +# Remote name (as of config file): Sony-RM-V33E +# Brand of remote device, the thing you hold in your hand: +# Remote device model nr: Sony RM-V33E +# Remote device info url: +# Does remote device has a bundled capture device e. g., a +# usb dongle? : no +# For bundled USB devices: usb vendor id, product id +# and device string (use dmesg or lsusb): +# Type of device controlled +# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) : +# Device(s) controlled by this remote: Audio + +begin remote + + name Sony-RM-V33E + bits 8 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 2441 578 + one 1230 578 + zero 629 578 + post_data_bits 4 + post_data 0x1 + gap 45269 + toggle_bit_mask 0x0 + frequency 38000 + + begin codes + KEY_STARTPHONO 0x14 + KEY_STOPPHONO 0x94 + KEY_TAPE 0xF0 + KEY_1 0x00 + KEY_2 0x80 + KEY_3 0x40 + KEY_4 0xC0 + KEY_5 0x20 + KEY_REWIND 0xCC + KEY_BACK 0xEC + KEY_FORWARD 0x4C + KEY_FASTFORWARD 0x2C + KEY_STOP 0x1C + KEY_PAUSE 0x9C + KEY_RECORD 0xFC + KEY_PLAY 0x4D + KEY_PREVIOUS 0x0D + KEY_NEXT 0x8D + KEY_STOPCD 0x1D + KEY_CD 0xA4 + KEY_VCR2 0x78 + KEY_VCR 0x44 + KEY_VOLUMEUP 0x48 + KEY_VOLUMEDOWN 0xC8 + KEY_MUTE 0x28 + end codes + +end remote + +