-
Notifications
You must be signed in to change notification settings - Fork 117
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
Adding LedBar Animation for Visual effects of OpenEVSE activity and status #899
Conversation
src/main.cpp
Outdated
#if defined(NEO_PIXEL_PIN) && defined(NEO_PIXEL_LENGTH) && defined(ENABLE_WS2812FX) | ||
ledManager_loop(); | ||
#endif |
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 should not be needed, the MicroTask and the LedManagerTask instance provide the equivelant without the need to add lots of loop calls to the main loop
function.
If you can't use the LedManagerTask you could setup another task just for running the animations.
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.
Hi Jeremy.
Understood. However the main reason to call this is to invoke the ws2812fx.service() method which refreshes the led status bar.
I'm not sure about the Microtasks architecture as I could not find much information about.
The problem I have is that the service() method need to be invoked regularly to update the bar and If I do not force the call the bar is not updated. I could find any way within ledManagertask to execute this regularly. Only when the EVSE changes status that invokes the service just once and then the animation is stopped
Should I call from main loop just a service method directly instead?
I mean:
create a method within the ledManagerTask called service and then launch from the main loop? (that is in essence what this ledManager_loop call is doing)
Thanks in advance
Alright. Just solved by adding a new method for ledManagerTask to invoke the ws2812fx.service method to run the animation. Then added a call to this method from main loop to refresh effect as ws2812fx.service needs to be invoked in each loop run to perform the animation In my OpenEVSE is running smoothly Let me know your thoughts Thanks |
Please can you update all the DEBUG.printf calls? On the looping there are two ways you can do it, the return of class LedAnimatorTask : public MicroTasks::Task
{
public:
void setup() {
}
unsigned long loop(MicroTasks::WakeReason reason) {
ws2812fx.service();
return 40;
}
};
LedAnimatorTask animator; Then in |
…or ledBar animations. DEBUG calls cleaned
OK, Thank for your input Jeremy. Already tested your code and works perfect. 40ms seem enough to run the animation smoothly. IMG_2756.2.MOV |
Looks good, a little jitter sometimes so maybe 20 might be better. |
Tried different refresh times for the task and found that 10ms is visually the best (although 20 ms is enough). Find videos: 40ms: IMG_2758.mov20ms: IMG_2759.mov10 ms: IMG_2760.movI'll let mine in 10 ms as I thing is best (at least visually in person) and the general behaviour is responsive without any effectt on the EVSE BTW: I would like to test other effects i.e. when the EVSE is sleeping either with connected vehicle or not. How can I know from LedManagerTask this status in the EVSE? I've been looking at the code but I'm struggling to find a method. I the future I would also be able to manage configuration for this from the web gui. Any recommendation where to start looking at? Thanks |
Great, 10ms is good. Thanks for testing |
All looks good, thank you for your contribution |
Here is my modification to the original OpenEVSE project to introduce a led bar as most commercial EVSEs have as seen in this discussion thread #891
I'm based on WS2812FX library to perform animations and visual effects.
My first intention is to show visually the status of the EVSE without using the screen nor the web interface and know quickly what is happening in the EVSE as follows:
If the EVSE is not charging the car, the bar have the same color code as the EVSE led (screen, buttons, etc) based on EVSE status
If the EVSE has any error, the led is blinking with corresponding color code
IF the EVSE is loading the car, the led will perform a "loading bar" animation to show this status. Also the speed of the animation will correspond with the intensity in Amps being provided to the car based on max Amp configured.
Led Bar bright can be configured directly from EVSE web interface Led brightness slider, so it is very intuitive to use and naturally integrated
Source code changed for this mod has been mainly done in LedManagerTask to create the integration
Notes for the implementation:
New animations and status can be introduced in the future based on this initial implementation.
Some pictures of the OpenEVSE working with this new functionality:
358303679-9548fec4-9b10-4377-ae12-56da410b780c.mov