rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
370 stars 144 forks source link

sevensegment_demo.py fails #71

Closed CoWinkKeyDinkInc closed 6 years ago

CoWinkKeyDinkInc commented 6 years ago
pi@raspberrypi:~/Git/luma.examples/examples $ python sevensegment_demo.py
Version: luma.oled 2.3.1 (luma.core 1.2.1)
Display: ssd1306
Interface: i2c
Dimensions: 128 x 64
------------------------------------------------------------
Traceback (most recent call last):
  File "sevensegment_demo.py", line 115, in <module>
    main()
  File "sevensegment_demo.py", line 71, in main
    seg = sevensegment(device)
  File "/usr/local/lib/python2.7/dist-packages/luma/core/virtual.py", line 482, in __init__
    self.segment_mapper = segment_mapper or device.segment_mapper
AttributeError: 'ssd1306' object has no attribute 'segment_mapper'
rm-hull commented 6 years ago

This is to be expected; ssd1306 is not a device that has the capability for supporting 7-segment displays - only max7219 or ht1621 does.

thijstriemstra commented 6 years ago

we could put a check in there that produces a good error msg..

CoWinkKeyDinkInc commented 6 years ago

Oh sorry about that, but yeah thanks for adding a more clear error message.

thijstriemstra commented 6 years ago

the capability for supporting 7-segment displays - only max7219 or ht1621 does.

@rm-hull are you sure these are the only ones? I opened for #76 this. Unfortunately we'll have to update the demo every time another supported device is added..