Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hey,

 

ich möchte die python Bindings mit zwei Verbindungen nutzen (WLAN + lokaler brickd). Jedoch bekomme ich sowohl unter Linux als auch unter OSX nach einer zufälligen Zeit die folgende Exception:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 505, in run
  File "/Users/bparzella/Developer/HomeManager/tinkerforge/ip_connection.py", line 247, in callback_loop
    device = self.devices[stack_id]
KeyError: 4

 

Bei der Suche nach der Ursache bin ich darauf gestoßen, das die callback_queue als Klassenvariable angelegt ist. Das heißt das alle Instanzen sich diese Variable teilen. Das würde heißen das der Eintrag der Queue zufällig an eine der Instanzen verteilt würde. Wenn nun ein Callback für einen Stack mit 4 Bricklets an die Instanz eines Stacks mit nur 2 Bricklets verteilt wird, kann das unter Umständen die oben genannte Exception auftreten (Callback für stack_id > 2).

 

Um es kurz zu machen sollte in der ip_connection.py die Variable als Objektvariable anstatt als Klassenvariable benutzt werden.

 

Alt:

    PLUGIN_CHUNK_SIZE = 32

    callback_queue = Queue()

    def __init__(self, host, port):
        """
        Creates an IP connection to the Brick Daemon with the given *host*
        and *port*. With the IP connection itself it is possible to enumerate the
        available devices. Other then that it is only used to add Bricks and
        Bricklets to the connection.
        """

        self.pending_add_device = None

 

Neu:

    PLUGIN_CHUNK_SIZE = 32

    def __init__(self, host, port):
        """
        Creates an IP connection to the Brick Daemon with the given *host*
        and *port*. With the IP connection itself it is possible to enumerate the
        available devices. Other then that it is only used to add Bricks and
        Bricklets to the connection.
        """

        self.callback_queue = Queue()

        self.pending_add_device = None

 

Ich haben den Patch angehängt.

 

Grüße

Benjamin

py_ipcon_multiple_connections.patch

Geschrieben

Habe die Bindings gerad nicht im Kopf, aber könnte das auch bei Delphi bzw. C# ein Problem werden ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.