Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset LCD gives Error 500 (when reset pin not configured) #771

Closed
samsixtysix opened this issue May 7, 2020 · 3 comments
Closed

Reset LCD gives Error 500 (when reset pin not configured) #771

samsixtysix opened this issue May 7, 2020 · 3 comments

Comments

@samsixtysix
Copy link

Describe the problem/bug

128x64 OLED (SD1306)
Clicking 'reset LCD' when 'Pin: Reset' is not configured gives below error:

Traceback (most recent call last):
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask_restx/api.py", line 600, in error_router
return original_handler(e)
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/pi/Mycodo/env/lib/python3.7/site-packages/flask_login/utils.py", line 261, in decorated_view
return func(*args, **kwargs)
File "/home/pi/Mycodo/mycodo/mycodo_flask/routes_page.py", line 1111, in page_lcd
utils_lcd.lcd_reset_flashing(form_lcd_mod.lcd_id.data)
File "/home/pi/Mycodo/mycodo/mycodo_flask/utils/utils_lcd.py", line 229, in lcd_reset_flashing
return_value, return_msg = control.lcd_flash(lcd_id, False)
TypeError: cannot unpack non-iterable NoneType object

Versions:

  • Mycodo Version: 8.0.4
  • Raspberry Pi Version: 3B+

Reproducibility

Please list specific setup details that are involved and the steps to reproduce the behavior:

  1. Go to Setup/LCD
  2. Add 128x64 OLED (SD1306)
  3. Configure without reset pin
  4. Click on 'Reset LCD'
  5. See error
@kizniche
Copy link
Owner

kizniche commented May 8, 2020

What does the daemon log show when this error occurs? The reset pin has nothing to do with the "Reset LCD" button (ironically). Reset LCD merely stops the LCD from flashing (after the flashing function action is activated). What you're likely experiencing is the result of a misconfigured LCD, which should have a traceback in the daemon log.

@samsixtysix
Copy link
Author

Found the problem following your pointer:
For the 128x32 OLED you have a check that warns you if you have not selected anything for one of the lines. For the 128x64 the check is not there and I had left some lines with no selection specified. Maybe the dropdown should default to 'Blank Line' rather than 'Select One'.

In case you need it Daemon log:

2020-05-08 09:44:30,849 - ERROR - mycodo.daemon - Could not flash LCD (False): 'NoneType' object has no attribute 'lcd_backlight'
Traceback (most recent call last):
File "/var/mycodo-root/mycodo/mycodo_daemon.py", line 553, in lcd_flash
return self.controller['LCD'][lcd_id].lcd_flash(state)
File "/var/mycodo-root/mycodo/controllers/controller_lcd.py", line 571, in lcd_flash
self.lcd_backlight(True)
File "/var/mycodo-root/mycodo/controllers/controller_lcd.py", line 558, in lcd_backlight
self.lcd_out.lcd_backlight(state)
AttributeError: 'NoneType' object has no attribute 'lcd_backlight'

This was presumably preventing the reset from working so my OLED was just blank/did not initialise. Combine this with the fact that the first OLED I was trying to use was also faulty.

@kizniche
Copy link
Owner

kizniche commented May 8, 2020

That's the issue! Thanks for helping hunt that down. I just pushed a fix for checking for blank lines on that 8-line display.

@kizniche kizniche closed this as completed Jun 1, 2020
kizniche added a commit that referenced this issue Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants