Easter Release
CAUTION: THIS RELEASE BREAKS BACKWARDS COMPATIBILITY
Intro
It has been almost 1 year since the last Fledex version was released, so it's high time to release a new version. This version BREAKS compatibility with the previous version, but it should be rather easy to adjust.
If you look through the changes, it should be rather obvious which one breaks compatibility, but for those it might not be, I have tried to give the necessary hints.
Please note that I expect some behavioral changes of the Fledex.Effects in the next version. to better support the newly introduced Coordinator.
New Features:
- Create support for a coordinator (that can control individual animations and effects).
- This work is not yet complete and therefore you won't find too much documentation about it yet.
- This also required some updates of the
Fledex.Effectsto make use of the coordinator functionality by reporting back their state through PubSub. - This made the
Sequencereffect unnecessary and therefore got removed (it never worked that well anyway). - So far the effect state was an
Atom, but with the new boardcasting it can be anything. Theeffect_statustype was retained, but is not used and might disappear in the future, even though it would be good to have a basic set of effect states. We'll see! - Effects should
use Fledex.Effects.Interface(the@behaviour) instead of just implementing it, because it allows to provide default implementations. - Effects now also get a
contextthat will be important for the coordinator - The Effect configuration now NEEDS to be a keyword list. This made it easy to add the ability to enable/disable animations and effects.
- Also the Animator became easier/more flexible, because enable/disable is like any other config update.
- Added more color names. It now includes color names from css, svg, ral standards. The latter can not be accessed through the
Fledex.Color.Namesbut only through its own module (since it's not so common) - Added a
Fledex.Colorprotocol to convertto_colorint()andto_rgb()- This also helps in removing cyclic dependencies with the
Fledex.Color.Namesmodule - Note: the protocol causes the ElixirLS server to give some unknown functions warnings. I was unable to disable them (neither with a @dialyzer tag nor with a dialyzer file). Only thing that helped is to disable dialyzer in ElixirLS (or live with the warnings in your editor).
- Note:
Fledex.Color.Utilswas first split. The protocol functions are inFledex.Colorthe rest is inFledex.Color.Conversion.CalcUtils
- This also helps in removing cyclic dependencies with the
- Versioning. You can query Fledex about the installed version. This even allows to have DSL scripts that can adapt depending on the version by calling
Fledex.version/0 - (Not quite working!): starting Fledex.Animation.Manager as child process of Kino if we opperate in a Kino env (which we currently always do due to the Kino driver dependency :-()
Improvements:
- Big refactoring of the
Fledex.Color.Namesmodule.- The actual Fledex.Color.Names module delegates most functions to the corresponding color modules (
Fledex.Color.Names.{CSS, SVG, Wiki}). I did not delegate toFledex.Color.Names.RALbecause it would be too massive. You will have to alias (or import) that module if you want to use those functions. - Split out the guard into a separate file, so it's not necessary to load all functions.
- Moved the code generating function into a DSL module. This approach also allows to quite easily load from other color modules.
- The goal was the improve the compilation time, but unfortunately I didn't achieve this.
- The actual Fledex.Color.Names module delegates most functions to the corresponding color modules (
- Refactored the
Fledex.Animation.Manager- Better segregation of the animator, job, and coordinator. The manager now knows less about them
- It doesn't depend on
Fledex.LedStripdirectly anymore. That helps also during testing. - Changing the way how animation names are created
- Refactoring the
Fledex.Utils.PubSubmodule, like renaming thesimple_broadcasttobroadcast_trigger, since we have now more broadcast types. - Major refactor of the
Fledex.LedStripandFledex.Driver.*modules- Instead of an
atomamoduleis now used as driver (except for special drivers!). This allows the drivers to provide their default configuration that can easily be overwritten with a keyword list. - The LedsDriver.reinit now allows to reconfigure drivers. So for new configs weren't passed in Currently the new config is not passed in
- Improve the LedsDriver config (Note: that the
change_config()function was removed, which was already deprecated in the last version).
There is now a clear separationg between the LedStrip and Driver configurations. - Fix the
Fledex.Driver.Impl.SPIdriver so that it compares the settings and reopens the channel if necessary - Added the possibility to clear the LEDs when initializing the SPI Driver.
- Removed the default name of the LedStrip. Thus, you have to provide a name explicitly
- Instead of an
- Improved the
Fledex.Ledsmodule- Changed the
set_driver_infotoset_led_strip_info(NOTE: The above is a breaking change, but a simple search&replace can fix this. If you use the DSL you wouldn't even use it) - Code contained a lot of checks that are not necessary when working with the DSL. Therefore they got removed (process running, namespace is defined, ...).
- Changing in all functions that options are passed as keyword list (
rainbow,light,send)
- Changed the
- Cleaning up the function guards in the
Dotcomponent - We parse the configuration for missing functions, so that errors can be detected early on instead of during painting.
Testing
- Reduced the number of tests, that require the
Fledex.Animation.Managerto be started. This makes the tests more clear and less flaky. - 100% test coverage (Exclusions:
moxremoved since it doesn't make sense to test it and clock & thermometer components since they are still in a testing state)
Cleanup & Build
- refactoring CI pipline.
- Adding formatting checks
- Adding graph checks
- Created
dependabot.yml
- Fixing a compile warnings (like the one regarding ranges)
- Remove the "it's taking more than 10sec" warning during compilation. We know the generation of the name files will take more time.
- Fixed most Credo warnings (except the TODOs in code)
- Updating all libraries to their latest version
- Fixing Dialyzer issues
- Refactoring to reduce compile dependencies
- Removing unused code
- Improving type specs (more tight better names, better order, ...)
Bugs:
- Fixed a nasty bug that caused the LedStrip to crash. By mistake I returned the wrong parameter in a function corrupting the state. It only happened during reinit.
- Fixing a bug in the LedStrip. We shouldn't raise an exception, but only return an error if the arguments are wrong
Documentation
- Updated the README.md (that probably was visible much earlier)
- Overhaul of the Livebook documentation (of course with all the necessary changes but also with a lot of more content). Added for example also debugging tricks to the livebook (for components), because it can sometimes be hard to figure out what is happening when the LEDS don't do what you want.
- Overhaul of the livebook READMEE.md file giving an overview of the different livebooks
- All livebooks are mentioned
- Added in the Livebook README.md information on what kind (intro, background, usage, details) the livebooks are. This way the reader can check whether it's worthwhile for him/her to read it
- Updated the Architectural Overview to adjust to the new driver approach
- Updated the Cheatsheet.md with new driver approach
- Improved the API documentation (corrected also small mistakes)
- Updated the CREDITS.md
- Updated the TODOs
- Also updated the license files (corrected the license for the external color files)
- Ensured reuse compliance
- Adding documentation for guards
External Feedback
I started to make the library more public. It was presented:
- in a school project and
- talked on an Erlang/Elixir meetup about it.
This provided some good feedback resulting in some of the above mentioned changes
Final words
With this I wish you Happy Easter and I hope you have some fun. The next release shouldn't take quite as much time. Take a look at the latest TODO.md file to see what is planned for v0.6. I always try to keep that file up-to-date.