sparkfun / Serial7SegmentDisplay

Example code and board files for the Serial 7 Segment Display.
https://www.sparkfun.com/products/11629
94 stars 73 forks source link

TimeOut for commands added #19

Closed MatanRobo closed 8 years ago

MatanRobo commented 8 years ago

Hi,

I found out that when I'm trying to send brightness value of 118 the display is cleared. after I looked on your code I found out the reason - 118 is 0x76, the command to clear the display. you are checking the clear display command before commands modes values.

I have solved it by adding a static variable to the function in order to store the time of the command started, and let the user a 50 MS timeOut to send any value, before sending 118/0x76 will clear the display again.

I opened the software in notepad++, so unfortunately the spacing changed and git diff failed to show the differences. In the file Serial_7_Segment_Display_Firmware.ino the lines that have changed are: 236-237,249,306

I complied it and it complied fine, but didn't flash it. so you may want to check it out before.

jimblom commented 8 years ago

Hi Matan,

Sorry I missed that bug earlier. I took a different approach to solving it. Adding a check for commandMode before the clear display execution seems to permit setting the brightness to 118.

I'm going to close this for now. If you try that and it doesn't work, feel free to submit it again.

Thanks for your help!

MatanRobo commented 8 years ago

Hi,

Thanks, Be aware that in the way you have solved it, it can stay in command mode forever. So if someone writes buggy code that sending a command mode (or any undisplayable value) without a value in the next byte, and after a while will send RESET_CMD in order to turn off the display, it will not work.