Go Down

Topic: TLC5940 library - is this still maintained? (Read 259 times) previous topic - next topic

Jeff_Haas

The Arduino playground links to a library for the TLC5940:
http://playground.arduino.cc/Learning/TLC5940

I've used this in the past, but coming back to it this week, I found that two of the sketches don't compile under the current IDE:
UsingProgmem
BasicAnimations

Both have a list of the same errors.

I've emailed the author, Alex Leone, and so far have not gotten a response.  I've also filed an issue on the version that's on Github - this is the one you find in the IDE Library Manager.

This library is used as the basis for several other projects and tutorials out there, so if the original could be updated it would be helpful.  Other than filing the issue on Github, is there anything else I can do?

Robin2

Other than filing the issue on Github, is there anything else I can do?
Use an older version of the IDE - the Arduino developers seem to have no concept of backwards compatibility. There is no problem having multiple versions of the IDE on your PC. The IDE is just a Java program.

OR

Update the library yourself.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

pert

I've also filed an issue on the version that's on Github - this is the one you find in the IDE Library Manager.
Here's a tip for reporting issues on GitHub. You may have noticed we're kind of uptight about using code tags here? The same applies on GitHub but the syntax is a bit different. There are a couple ways to do it but the one I like is called "code fencing". You just add three backquotes before and after the block of text you want to fence. This should be done for error/warning messages or other output as well as code:
Code: [Select]
```
In file included from C:\Users\Jeff\Documents\Arduino\libraries\Tlc5940/tlc_animations.h:30:0,

            from C:\Users\Jeff\Documents\Arduino\libraries\Tlc5940\examples\BasicAnimations\BasicAnimations.pde:19:

C:\Users\Jeff\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:29:27: error: variable or field 'tlc_setGSfromProgmem' declared void

void tlc_setGSfromProgmem(prog_uint8_t *gsArray);
...
```


It's always useful to post links to the things you're referring to. The issue report mentioned:
https://github.com/PaulStoffregen/Tlc5940/issues/9
I had to spend some time hunting around for it. I shouldn't have to do that.

You have to go all the way back to Arduino IDE 1.0.6 or older to make those sketches work. The bug is very common. It was caused by the Arduino IDE's update to a new compiler version that doesn't support the old non-standard progmem types. The fix is usually quite simple. Basically you would change to the equivalent standard type, make it const, and add the PROGMEM keyword. For example, prog_uint8_t becomes const uint8_t PROGMEM. It's such a common problem Arduino added it to their FAQ:
https://github.com/arduino/Arduino/wiki/1.6-Frequently-Asked-Questions#errors-related-to-avr-progmem-changes

Jeff_Haas

#3
Apr 13, 2017, 09:36 pm Last Edit: Apr 13, 2017, 09:51 pm by Jeff Haas
Thanks for all the info.  I have never used Github, but from what you guys have told me, I think I'll try fixing the bugs and then submitting the fixes.

Once that's done, does Paul then have to accept the fixes for them to go through to all users?

pert

For the fix to be available via Library Manager he has to merge the pull request and then do a new release. However, even before then people who encounter the bug and then go to the PaulStoffregen/Tlc5940 repository will see your pull request and can download your fork of the library with the fix. For that reason it's helpful to submit pull requests even if they are never merged but I suspect it will be accepted in a reasonable amount of time in this case.

Jeff_Haas

Ok, I've fixed the bugs in:
tlc_animations.h
tlc_progmem_utils.h

And the two sketches.  I can confirm that both sketches work on the Sparkfun TLC5940 breakout board.

Thanks for the help, this is the first time I've gone through this, luckily these were easy bugs.  Now to learn how to submit it to Github.

pert

Good work! I'm sure you'll find some good tutorials on submitting a pull request but here's the general outline:
  • Fork the repository
  • Create a branch in your fork. This isn't absolutely necessary for a single pull request but if you want to submit multiple pull requests you need to do each one from a separate branch and it's nice to have the branch name reflect the change you made rather than the unhelpful "master".
  • Commit your changes to the branch. Commits should be "atomic". This means the commit includes changes for only one action. So you shouldn't do a commit that is "Remove deprecated progmem types and add my cool animation" because that is two separate changes and thus should be made in two commits (and actually would be two pull requests). It also means the changes in the commit are complete and self contained so you shouldn't do one commit for editing tlc_animations.h and one commit for tlc_progmem_utils.h. Add a link to your issue report in the commit message so that the person merging it will know they can also close the issue.
  • Submit a pull request to the repository.


Let me know if you need any help.

These are a couple of links regarding making quality commits that I've found useful:

I've found that enforcing the concept of atomic commits on my own programming has improved the quality of my work, reduced the number of bugs, and made it much easier to fix bugs when they do occur.

It seems a bit confusing using Git and GitHub at first but it's a really powerful tool for collaboration. I love how easy it makes it for me to contribute. I'll be browsing along while working on a project or helping someone on the forum and spot a bug or typo. Before GitHub I probably wouldn't do anything about it because usually it would involve sending an email to someone that might just end up in their spam filter or get ignored or maybe they already received 20 emails about it. With GitHub it only takes a few minutes to submit a pull request or issue report and you've made the world a slightly better place. I've submitted 21 pull requests and 4 issue reports in April alone in addition to work on my own public repositories. If everyone takes a little time to contribute we can really do something amazing!

Jeff_Haas

Thanks for the advice.  I went through everything with Github, but I didn't see your advice until afterwards.  So I don't have atomic commits, instead they are all batched together.  I also found the "Revert Revert etc." issue and read up on it.

I will let Paul take a look and decide.  If he kicks it back to me then I'll redo it all and follow your steps.

Once that's taken care of, I'll submit the same fixes to Sparkfun, because they're using the same library.

pert

GitHub now has a feature that allows the person who merges a pull request to squash it to a single commit so if that's something he's concerned about he can do it for you. I like to make sure to submit atomic commits because some repository maintainers are not so picky as I am about commit quality and they'll just merge them without squashing. It might seem uptight but when you're trying to sort through the commit history of an actively developed repository to find the reason for a change or troubleshoot a bug you will realize how important commit quality can be!

When I'm doing development I tend to make a lot of temporary commits in my local copy of the repository so I can see what I've changed and easily revert to any point. Once I have tested the change I go back and do what's called an "interactive rebase", which allows me to easily combine my temporary commits before pushing them to the public repository. There's some information on the interactive rebase here:
https://git-scm.com/docs/git-rebase#git-rebase--i

I've submitted 7 more pull requests since my last reply. This GitHub stuff can get a bit addictive!

Jeff_Haas

I can see how it would get that way!

When a pull request is submitted, does the owner of the repository get automatically notified?

pert

I'm up to 38 pull requests and 5 issues for April. It's a good feeling when you get the email that one has been merged.

It depends on their notification settings but I'm sure Paul Stoffregen has it set to send him an email when a pull request is submitted. You will find some repositories where the owner has abandoned them and is completely unresponsive. It's annoying if they didn't bother to add a note to that effect in the readme but, as I said before, submitting a pull request can still be helpful by making it easier for other users to find your fork. I have some pull requests for very simple and non-controversial changes from 2.5 years ago still pending. It's a shame the repository owners won't take two minutes to merge them but other PRs get merged only minutes after I submit them.

Jeff_Haas

I just got the email, Paul merged my commits.  So now the question is, How soon will the update appear in the Arduino IDE?

pert

Congratulations! If you look at the commit history:
https://github.com/PaulStoffregen/Tlc5940/commits/master
you can see that he didn't squash your commits.

The updated library will only be available for installation via Library Manager after PaulStoffregen does a new release. When that will happen is up to him. The last release of that library was two years ago:
https://github.com/PaulStoffregen/Tlc5940/releases

Until then you can use a different installation method to get the current code.

If you have installed the previous version of the library you need to first remove it. An easy way to find the library folder if you don't know where it's located is:
  • File > Examples > Tlc5940 > select any example
  • Sketch > Show sketch folder

(I realize you already know where the library is, these are just general instructions for anyone.)

To install the library:

pert

I notice that PaulStoffregen forgot to close your issue:
https://github.com/PaulStoffregen/Tlc5940/issues/9
you might help him out by commenting with a link to your pull request to show it was fixed and then closing the issue.

Jeff_Haas

Thanks for the tip, I left him a note and closed the bug.

Go Up