-
Notifications
You must be signed in to change notification settings - Fork 50
Update character_lcd.py #37
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
Conversation
Update so `self.message` respects the `cursor_position()` settings. If `'\n'` is in a message string, the new line will be use the same column setting as the first line.
Build failed??? What does that mean? Was this caused by my edits? I am hopeful that I can have my students use this change in an upcoming project. Forgive my stupidity, I am new to Github nor am I formally trained in programming. |
Hi - to check the errors, click on "Details" above, then on "The build" in "The build failed". Look at the build log. On this build, looks like there's a documentation error reported on line 755. |
|
I am not sure what all of that means. I did not change anything documentation-wise (I don’t think so at least). Maybe I should have??
… On Apr 9, 2019, at 12:24 PM, Radomir Dopieralski ***@***.***> wrote:
Warning, treated as error:
../README.rst:119:undefined label: bundle_installation (if the link has no caption the label must precede a section header)
The command "cd docs && sphinx-build -E -W -b html . _build/html && cd .." exited with 2.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#37 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APSHU6pl6YSaNa_GSjDhZHD8QmuRy_6uks5vfL7RgaJpZM4cgRch>.
|
The failure is unrelated to anything you did. The README needs to be edited to fix this issue. I can walk you through what to change, @profbrady |
@profbrady Please remove lines 116-125 from README.rst and push the changes to this PR.
|
I think I did it. I edited the file and committed the changers to my branch. Do I need to do more?
… On Apr 9, 2019, at 12:58 PM, Kattni ***@***.***> wrote:
@profbrady <https://github.com/profbrady> Please remove lines 116-125 from README.rst and push the changes to this PR.
Installation
============
This library is **NOT** built into CircuitPython to make it easy to update. To
install it either follow the directions below or :ref:`install the library bundle <bundle_installation>`.
To install:
#. Download and unzip the `latest release zip <https://github.com/adafruit/Adafruit_CircuitPython_CharLCD/releases>`_.
#. Copy the unzipped ``adafruit_character_lcd`` to the ``lib`` directory on the ``CIRCUITPY`` or ``MICROPYTHON`` drive.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#37 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APSHU4W2rVFM59F037AcwRRVPFIsukR8ks5vfMabgaJpZM4cgRch>.
|
@profbrady You need to push the branch to GitHub. |
This is where my ignorance shows. I don't know how to push the branch. |
@profbrady Ok, let's take a couple of steps back. Where did you make the changes to the README? Tell me the exact process you took to make those changes so I can help you figure out the next steps. As well, you can reach me as @kattni on the Adafruit Discord. If live chat would work better for you, we can figure it out there. I'm happy to continue here if this is what works for you. |
I went into my branch; profbrady: prof brady-patch-1 and clicked on the edit icon for the readme file. I removed the lines and clicked on Commit Changes with the commit directly to my branch toggled on. |
It appears the readme file was updated on your master branch, but your PR is based off of the profbrady-patch-1 branch. |
I think I edited the correct one now. |
@profbrady You did! Well done! Your build is in behind a rather long build, so it might take a bit for Travis to run. Please be patient and we'll see if my suggestions fix the issue. :) |
Thanks for all of the help and patience |
I'll go ahead and test this out tonight. |
Thank you for sticking with it and for your contribution! |
Hi @profbrady, I went ahead and tested this with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be losing a bunch of the text, especially on the first line.
I'll have to test it in the morning. I left my LCD in my office at school. I am using a standard LCD, not SPI or I2C. It is a 6 digital out variety that is about 4 years old. I ran the following code on it and it worked fine.
|
Yeah, I used a standard LCD as well. Your code works with your update, but with reverse text like in the example, it appears to break. |
I found that I did have an I2C RGB at home. If I ran the sample code for that as is I had the same problem you did after a direction change. However, if I added |
A question I have is do we want to remember the position of the cursor after displaying a message so that another message starts at the end of the previous? Or do we want to have the next message start where the previous message started; essentially where the last I still haven't come up with a method to set the |
One idea may be to have a settable option that makes it behave as it did before if it's set and have it perform the way your code needs it if it's set with it being off by default so it doesn't break existing code. |
That’s a possibility. It’s actually pretty easy to do since currently the message is always displayed at 0,0. When I get a few moments today I’ll test my idea.
… On Apr 10, 2019, at 3:05 AM, Melissa LeBlanc-Williams ***@***.***> wrote:
One idea may be to have a settable option that makes it behave as it did before if it's set and have it perform the way your code needs it if it's set with it being off by default so it doesn't break existing code.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I just pushed a change to |
Hi @profbrady, one of the reasons I wanted to avoid changing the simpletests if possible is because we would need to make changes to them all and test all of them. I think the simplest approach would be to undo the changes to the simpletest, add a property to the library that is called something like column_align with a default value of False, and if the value is set true, it runs the code with your additions. That way it won't break the examples and you'll have the feature that works with your code. |
I will happily return the simpletest example to its previous form. I was only attempting to demonstrate that the existing parts of the test continue to work as they previous did while also demonstrating the use of `cursor_position`. I was not trying to break anything and believe that the functionality is the same as it was if `cursor_position` is never set.
A bit of history. Last year I had my class use this library as part of an assignment. At that time we were still using Circuitpython 2.x. The `cursor_position` was actually called `set_cursor` way back then. When it wasn’t used, the first printed message started at (0,0) and subsequent messages started where the first left off, even if that meant they were completely off the display. The `set_cursor` method worked as expected.
Now, in CircuitPython 3.x, `cursor_position` does not work at all and all messages are displayed starting at (0,0). I believe my code essentially returns the functionality to the way the library worked a year ago.
… On Apr 10, 2019, at 11:56 PM, Melissa LeBlanc-Williams ***@***.***> wrote:
Hi @profbrady <https://github.com/profbrady>, one of the reasons I wanted to avoid changing the simpletests if possible is because we would need to make changes to them all and test all of them. I think the simplest approach would be to undo the changes to the simpletest, add a property to the library that is called something like column_align with a default value of False, and if the value is set true, it runs the code with your additions. That way it won't break the examples and you'll have the feature that works with your code.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#37 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APSHU2U92USWKxjHvESa6TKVUsVbicApks5vfrJugaJpZM4cgRch>.
|
I was able to take some time today to implement the property idea. The property The current simple demo works as before, so existing code should not break. Pushing the change in a minute. |
Ok, thanks @profbrady. I'll take a look at this shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're very close here. I found a few more things to change. Also it looks like Travis is unhappy about some whitespace on lines 205, 251, and 398. I went ahead and tested with the original simpletest file and that seemed to work fine, so I think that's the only changes to make. Thanks for sticking with me here.
|
||
@column_align.setter | ||
def column_align(self, enable): | ||
self._column_align = enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some type checking here, so something like:
if isinstance(enable, bool):
self._column_align = enable
else:
raise ValueError('The column_align value must be either True or False')
examples/charlcd_mono_simpletest.py
Outdated
@@ -53,7 +54,7 @@ | |||
scroll_msg = '<-- Scroll' | |||
lcd.message = scroll_msg | |||
# Scroll message to the left | |||
for i in range(len(scroll_msg)): | |||
for i in range(len(scroll_msg)+5): | |||
time.sleep(0.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are still some changes to the simpletest, so just remove the +5
examples/charlcd_mono_simpletest.py
Outdated
@@ -33,6 +33,7 @@ | |||
lcd.message = "Hello\nCircuitPython" | |||
# Wait 5s | |||
time.sleep(5) | |||
lcd.clear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the lcd.clear() just to keep the examples consistent.
@makermelissa thanks for the assistance on this. I just pushed the changes. I hope this fixes it. It is a bit exciting knowing that I am contributing to the community. I did a very small fix to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's just a couple small changes that need to be made.
@property | ||
def column_align(self): | ||
"""If True, message text after '\n' starts directly below start of first | ||
character in message. If False, text after '\n' starts at column zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been looking into this since you submitted changes. It looks like it's failing in travis because the \n's need to be escaped. Instead of '\n' use '\\n' (two slashes. I had to use three for formatting the comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -169,6 +169,11 @@ def __init__(self, rs, en, d4, d5, d6, d7, columns, lines | |||
self._message = None | |||
self._enable = None | |||
self._direction = None | |||
# track row and column used in cursor_position | |||
# itialize to 0,0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured you mean initialize here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, done
Ok, I just gave it a final test and it worked great. Thanks again for this. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.2.0 from 3.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#37 from profbrady/profbrady-patch-1
Update so
self.message
respects thecursor_position()
settings. If'\n'
is in a message string, the new line will be use the same column setting as the first line.