-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Description
If more than a single SenseHat object is instantiated on a machine any calls to sensor data will return 0 instead of the actual sensor value.
Simple test:
from sense_hat import SenseHat
import unittest
class TestSingleton(unittest.TestCase):
def test_singleton(self):
sense1 = SenseHat()
sense2 = SenseHat()
self.assertEqual(sense1.temperature, sense2.temperature)
if __name__ == "__main__":
unittest.main()This will fail on the current codebase.
I've added pull request #147 to at least prevent this occuring in a single python program by converting the SenseHat object to a thread-safe Singleton, but this will not prevent the issue arriving if multiple projects are using the SenseHat object on the same machine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels