Permalink
Browse files

big fixes, control image added and bottom/center option

  • Loading branch information...
1 parent bb01a0e commit c647019bf18018e499a196cd1ed0368f0f564193 tociek committed Aug 6, 2015
Showing with 51 additions and 11 deletions.
  1. +29 −8 addon.py
  2. +1 −1 changelog.txt
  3. +12 −1 resources/lib/HyperPyCon.py
  4. +8 −0 resources/lib/HyperionConfigTester.py
  5. +1 −1 resources/lib/Led.py
  6. BIN test_picture.png
View
@@ -19,24 +19,35 @@
xbmcgui.Dialog().ok(addonname, line1, line2 + line3)
try:
- if "spidev" not in subprocess.check_output(['ls','/dev']):
- xbmcgui.Dialog().ok(addonname, "We have detected that your system does not have spi enabled. You can still continue, but leds may not work if you're using GPIO/SPI connection."+
- " For USB connection you are safe to proceed")
+
+ device_versions = [ HyperPyCon.HyperPyCon.ws2801 , HyperPyCon.HyperPyCon.adalight ]
+ selected_device = xbmcgui.Dialog().select("Select your led device:",device_versions)
+ if selected_device == 0:
+ if "spidev" not in subprocess.check_output(['ls','/dev']):
+ xbmcgui.Dialog().ok(addonname, "We have detected that your system does not have spi enabled. You can still continue, but leds may not work if you're using GPIO/SPI connection")
xbmcgui.Dialog().ok(addonname, "In next two steps please provovide number of leds at the top edge of tv (horizontally)" +
" and number of leds at the side of your tv (count leds at single side only) - horizontally")
- nol_horizontal = xbmcgui.Dialog().input("Select number of leds horizontally","16",xbmcgui.INPUT_NUMERIC)
- nol_vertical = xbmcgui.Dialog().input("Select number of leds vertically","9",xbmcgui.INPUT_NUMERIC)
+ nol_horizontal = xbmcgui.Dialog().input("Select number of leds horizontally","29",xbmcgui.INPUT_NUMERIC)
+ nol_vertical = xbmcgui.Dialog().input("Select number of leds vertically","16",xbmcgui.INPUT_NUMERIC)
hyperion_configuration = HyperPyCon.HyperPyCon(int(nol_horizontal), int(nol_vertical))
+ hyperion_configuration.set_device_type(device_versions[selected_device])
- options = ["Right bottom corner and goes up","Left bottom corner and goes up"]
+ options = ["Right/bottom corner and goes up","Left/bottom corner and goes up","Center/bottom and goes right","Center/bottom and goes left"]
selected_index = xbmcgui.Dialog().select("Select where the led chain starts:",options)
- if options[selected_index] == "Left bottom corner and goes up":
+ if selected_index == 1:
hyperion_configuration.led_chain.reverse_direction()
hyperion_configuration.led_chain.set_offset(int(nol_horizontal))
+ elif selected_index == 2 or selected_index == 3:
+ offset = xbmcgui.Dialog().input("How many leds from the center to the corner or the screen?","15",xbmcgui.INPUT_NUMERIC)
+ if selected_index == 2:
+ hyperion_configuration.led_chain.set_offset((-1)*int(offset))
+ else:
+ hyperion_configuration.led_chain.reverse_direction()
+ hyperion_configuration.led_chain.set_offset(int(offset))
grabber = ""
lsusb_output = subprocess.check_output('lsusb')
@@ -64,7 +75,17 @@
else:
xbmcgui.Dialog().ok(addonname, "For the next 10 seconds you will see leds in 3 corners marked with different colors. Check if they are exactly in the corners."+
" If not, start this wizard again and provide correct numbers of leds horizontally and vertically.")
- hyperion_configuration.test_corners(10)
+ #hyperion_configuration.test_corners(10)
+ okno = xbmcgui.WindowDialog(xbmcgui.getCurrentWindowId())
+ #obrazek = xbmcgui.ControlImage(0,0,okno.getWidth(),okno.getHeight(),addon_dir+"/test_picture.png")
+ obrazek = xbmcgui.ControlImage(0,0,1280,720,addon_dir+"/test_picture.png")
+ okno.addControl(obrazek)
+ okno.show()
+ obrazek.setVisible(True)
+ hyperion_configuration.show_test_image(addon_dir+"/test_picture.png")
+ time.sleep(10)
+ okno.close()
+ hyperion_configuration.clear_leds()
if xbmcgui.Dialog().yesno(addonname, "Do you want us to save this config as your default one?","(if No, changes will be lost after hyperion/system restart)"):
hyperion_configuration.overwrite_default_config()
View
@@ -1,3 +1,3 @@
1.0.0 Initial Release
-1.0.1 Bug Fixes (issue#1 + few more :) )
+1.0.1 Bug fixes + control image added + bottom/center configuration added
@@ -10,6 +10,8 @@
import shutil
class HyperPyCon:
+ ws2801 = "Lightberry for Raspberry Pi"
+ adalight = "Lightberry USB"
def __init__(self, nol_horizontal, nol_vertical):
self.total_number_of_leds = ((nol_horizontal + nol_vertical) * 2)
self.led_chain = LedChain(self.total_number_of_leds)
@@ -33,6 +35,11 @@ def __init__(self, nol_horizontal, nol_vertical):
self.tester = HyperionConfigTester.HyperionConfigTester(self.led_chain)
+ def set_device_type(self,device_type):
+ if device_type == HyperPyCon.adalight:
+ self.device.type = "adalight"
+ self.device.output = "/dev/ttyACM0"
+
def create_config(self, add_grabber):
self.color.add_transformation(self.transform)
self.color.set_smoothing(self.smoothing)
@@ -87,7 +94,11 @@ def test_corners(self,duration):
time.sleep(duration)
self.tester.disconnect()
-
+ def show_test_image(self, image_path):
+ self.tester.show_test_image(image_path)
+
+ def clear_leds(self):
+ self.tester.clear_leds()
#h = HyperPyCon(23,23)
@@ -12,9 +12,11 @@ def __init__(self, chain = None):
if os.uname()[1] == "OpenELEC":
self.hyperion_path = "/storage/hyperion/bin/hyperiond.sh"
self.config_folder = "/storage/.config/"
+ self.hyperion_remote_path = "/storage/hyperion/bin/hyperion-remote.sh"
else: #not tested
self.hyperion_path = "hyperiond"
self.config_folder = "/etc/"
+ self.hyperion_remote_path = "hyperion-remote"
def restart_hyperion(self,config_file_name):
subprocess.call(["killall", "hyperiond"])
@@ -38,3 +40,9 @@ def set_single_color(self, red, green, blue):
def disconnect(self):
self.connection.disconnect()
+
+ def show_test_image(self, test_image_path):
+ subprocess.Popen([self.hyperion_remote_path,"-i", test_image_path])
+
+ def clear_leds(self):
+ subprocess.Popen([self.hyperion_remote_path,"-c", "000000"])
@@ -106,7 +106,7 @@ def set_offset(self, offset_value):
for i in range(offset_value):
self.leds.append(self.leds.pop(0))
elif offset_value < 0:
- for i in range(offset_value):
+ for i in range((-1)*offset_value):
self.leds.insert(0,self.leds.pop(self.no_of_leds-1))
def print_me(self):
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c647019

Please sign in to comment.