I hope, that this is the correct area to ask for a review of my project.
I have my very first library in the arduino ide library manager.
The library name is SequenceTiming.
Also the use of github is new for me.
Can somebody have a look at it and give me feedback.
Is the text at github good to understand (readme.md)
How do you find the .pdf in the docs folder? Is it to detailed?
What do you think that I use three .ino files?
Different files.
LICENSE
keywords.txt. I do not see a difference in Arduino IDE. Is this normal? Is my file not correct?
library.properties
.github/workflows .yml files
Should I make more examples which are between the simple ones and the complex?
Should I make an example where I use my library-class within a class? Or would this be to much?
It makes sense to split up large sketches into multiple files. It also makes sense to format your personal sketches according to your preferences, even in the case of small sketches. However, these example sketches are intended to provide a simple demonstration of the library and so I think it is better to avoid any unnecessary complexity.
The "30_boomBar" example has more code, so it might be more beneficial in this case.
This is incorrect. This file should contain the exact legal text of the license. A good source for license text is here:
In addition to correctly serving as a legal document, this will also allow GitHub and other tools to automatically detect the license type of your library. The license text source I linked above is the content used by GitHub's license detection system (the choosealicense.com website is managed by the GitHub company).
You can provide additional information about licensing (e.g., the offer for a commercial license) in the readme, or in a separate file if you prefer not to clutter up the readme with that content. But you should not place it in the LICENSE file as this will interfere with its ability to be read by machines.
Are you using Arduino IDE 2.x?
The keywords.txt file is only used by Arduino IDE 1.x. So it is expected that you won't see any effect from the file when using Arduino IDE 2.x.
It looks correct. Many library developers don't get the data format of the file correct, but you correctly used the single tab delimited format!
It looks pretty good. You might want to update the value of the url property:
GitHub automatically sets up a redirect when you rename your repository, so the outdated URL does still lead to the repository. However, it is best to avoid relying on such redirects, as it is possible they might stop working at some point in the future.
Compiling examples/30_boomBar/SetupLoop.ino for arduino:avr:uno
Sketch uses 4746 bytes (14%) of program storage space. Maximum is 32256 bytes.
Global variables use 562 bytes (27%) of dynamic memory, leaving 1486 bytes for local variables. Maximum is 2048 bytes.
Used library Version Path
src /home/runner/work/SequenceTiming/SequenceTiming/src
Used platform Version Path
arduino:avr 1.8.6 /home/runner/.arduino15/packages/arduino/hardware/avr/1.8.6
Compiling examples/30_boomBar/30_boomBar.ino for arduino:avr:uno
Sketch uses 4746 bytes (14%) of program storage space. Maximum is 32256 bytes.
Global variables use 562 bytes (27%) of dynamic memory, leaving 1486 bytes for local variables. Maximum is 2048 bytes.
Used library Version Path
src /home/runner/work/SequenceTiming/SequenceTiming/src
Used platform Version Path
arduino:avr 1.8.6 /home/runner/.arduino15/packages/arduino/hardware/avr/1.8.6
Compiling examples/30_boomBar/Functions.ino for arduino:avr:uno
Sketch uses 4746 bytes (14%) of program storage space. Maximum is 32256 bytes.
Global variables use 562 bytes (27%) of dynamic memory, leaving 1486 bytes for local variables. Maximum is 2048 bytes.
Used library Version Path
src /home/runner/work/SequenceTiming/SequenceTiming/src
Used platform Version Path
arduino:avr 1.8.6 /home/runner/.arduino15/packages/arduino/hardware/avr/1.8.6
Do you notice that the "30_boomBar" example was compiled three times?
My suggestion is to use the arduino/compile-sketches action in the workflow:
This takes care of this sort of thing for you, so that you don't need to implement it in the workflow. arduino/compile-sketches uses Arduino CLI under the hood, so the actual compilation results are exactly the same as your current approach using Arduino CLI directly.
@Andreas1313, are you familiar with the wokwi simulator?
A compelling demo in the form of a complete sketch running in the simulator would be a great sales tool.
TBH I've had a bit too much of one thing and not enough of another; my mind refuses when I try to see what your library is up to and what it might do for me!
I was poking around a bit nevertheless and saw this comment
because of millis() overrun.(approx 50 days):
Which shouldn't be a problem for intervals that are nowhere near 49.71 days. What's going on there?
@alto777 : No I am not familiar with wokwi simulator. I will have a look.
To your question: because of millis() overrun.(approx 50 days): (Thank you for having a look so deep in my library)
Now I have:
...
//This is called as long as the step is active:
if (_event == Event::eventIsActive){
// Step is in time:
if (_in_latestStartNextStep_ms[uint32_t(_actualStep)] != 0){ //if == 0, _in_latestStartNextStep_ms is not used
if (millis() - _oldActiveStep_ms >= _in_latestStartNextStep_ms[uint32_t(_actualStep)]){
_error_latestStartNextStepReached = true;
_event = Event::doNothingBecauseOfError;
return;
}
}// "else" allone is not enough, because of millis() overrun.(approx 50 days):
if (_nextStep != _actualStep){
if (millis() - _oldActiveStep_ms < _in_earliestStartNextStep_ms[uint32_t(_actualStep)]){
_error_earliestStartNextStepNotElapsed = true;
...
You are right, this comment makes no sense anymore. I have included this two lines a little bit later:
_event = Event::doNothingBecauseOfError;
return;
Before, I still run the _event == Event::eventIsActive also when there was an error.
I will remove this comment.
Your workflow only results in the compilation for arduino:avr:uno. The other FQBNs are simply being ignored. You should use a separate matrix job for each board, as you had before:
And you are still unnecessarily installing all the boards platforms:
Now that you are using the arduino/compile-sketches action in your workflow, you can actually just omit the platforms input completely if you like:
Default : The board's dependency will be automatically determined from the fqbn input and the latest version of that platform will be installed via Boards Manager.
You only need to specify platform dependencies in cases where more information is needed than what the action can automatically derive from the FQBN. For example, in the case where you are using a board from a 3rd party platform which requires providing an "additional Boards Manager URL" (as would be the case if you still wanted to compile for rp2040:rp2040:arduino_nano_rp2040_connect).
@ptillisch: Can you please have a look once again on my arduino-build.yml.
It was very hard for me to generate it. If you are not happy with it, can you please give me an example project, where it is done correct.
In this use case, you can omit the sketch-paths input entirely as the default value is "- examples"
This is done in every official library, so you can look at any repository under the official arduino-libraries GitHub organization:
Here is a specific example in the official "Servo" library:
Note this approach, where the entire platforms input document is defined in the matrix, rather than only the platform ID as you have done in your workflow:
That approach is actually not necessary in the Servo workflow, but it is useful in the case where you have a board with a platform dependency that can not be described by an ID alone. An example of this is the esp8266:esp8266, for which a URL must be provided in addition to the ID.
I see you considered a different approach to that:
It should be possible to do it that way as well if you prefer.
@ptillisch. Thank you very much again for your professional answer. I have already written some tests for the functions of my library. But I want to improve them.
When I have more questions regarding .yml or project properties, I will come back to you.
@alto777: Have you ever worked with step sequencers (finite-state machines) 1) ? Step sequencers are suitable for many different applications where you want to complete one task after another. With my library, you can use different timing types in the step sequencer.
@alto777: Can you please have a look at my new library. Please find new examples 10_cylinder, 20_cylinder, 30_cylinder. I hope that you see there the advantage of my library.