Skip to content
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

Add UUID id to LEDStripEffect #332

Closed
wants to merge 1 commit into from

Conversation

rbergen
Copy link
Collaborator

@rbergen rbergen commented Jun 23, 2023

Description

This adds an automatically generated and JSON-persisted (UU)ID to LEDStripEffect, exposes it via the /effects endpoint and allows its use as the effect identifier in a number of other endpoints (with the support of a new member function in EffectManager).
This is a possible implementation of the idea discussed in #327, and meant more to develop an opinion on the addition than an actual proposal to include it. For one, the API documentation would have to be updated before this should be merged.
As such, I am primarily looking forward to collaborators' feedback.

Contributing requirements

  • I read the contribution guidelines in CONTRIBUTING.md.
  • I understand the BlinkenPerBit metric, and maximized it in this PR.
  • I selected main as the target branch.
  • All code herein is subjected to the license terms in COPYING.txt.

@robertlipe
Copy link
Contributor

robertlipe commented Jun 23, 2023 via email

@rbergen
Copy link
Collaborator Author

rbergen commented Jun 23, 2023

The ESP32 thing is a valid point, and actually part of a conversation that's now been started with the (former) maintainer of the library I used for now, in this PR: protohaus/ESP_UUID#2. As you can see, he already indicated that he's willing to commit code that adds support for the ESP8266. And if that doesn't materialize, there are alternatives that I would seriously consider.

Beyond that, I pledge with my hand on my heart that I will review the code in this PR in full before removing the draft status, and improve it where appropriate. As it stands, I'm still not convinced this UUID addition is even necessary. I'm willing to kill my own code with fire if the final conclusion is that it isn't.

@robertlipe
Copy link
Contributor

robertlipe commented Jun 23, 2023 via email

@davepl
Copy link
Contributor

davepl commented Jun 24, 2023 via email

@rbergen
Copy link
Collaborator Author

rbergen commented Jun 24, 2023

I think the key point is in the middle of your comment: "no code is the best code". The question we still haven't answered is if we actually need this. As it was @Louis-Riel who suggested (something like) this in #332, I'm curious to his opinion on the discussion(s) we've been having about this.

Just for completeness my two cents on the other things:

  • I think the exact implementation of the lookup loop in GetEffectIndexForID() is really a case of po-tay-to/po-tah-to, at least with the number of effects we're likely to see. Switching to a different container for the effects requires a massive overhaul of EffectManager, so we'd need a very good reason to do that.
  • I don't really care if we're on C++17 or C++20. I have not yet seen anything in C++20 that I regretted not having available to me in C++17. C++23 on the other hand will introduce some things that I've considered "obvious gaps" in the language/libraries for a long time. I just wouldn't use this particular change/PR as the trigger for such a switch. I couldn't actually make it on my own anyway, because I can't confirm operation of the result on led strip or s3.

(By the way, I actually had to look up the meaning of "peanut gallery". I think it's a North-Americanism that never made it to this side of the Atlantic. 😄)

@rbergen
Copy link
Collaborator Author

rbergen commented Jun 24, 2023

Just to tie off some other points in @robertlipe's earlier comment:

  • If you look at the code I've written in this project then you'll see that I basically always use range for loops. Unless I need the index, which is indeed the case here.
  • I picked this UUID library because it provides built-in support for String, which is what we've settled on as the "preferred string type" within NightDriverStrip - with a few specific exceptions.
  • The library was called "ESP UUID" by its author, but I don't actually believe there's any code in there that wouldn't run on other Arduino-based devices. If I remember correctly, its dependencies are Arduino and ArduinoJson.

@rbergen
Copy link
Collaborator Author

rbergen commented Sep 21, 2023

I'm closing this after an extended period of no follow-up from the original requester. If the need bubbles up again, we can reopen (provided I remember this is here).

@rbergen rbergen closed this Sep 21, 2023
@rbergen rbergen deleted the effect-guid branch November 18, 2023 10:01
@rbergen rbergen restored the effect-guid branch November 18, 2023 10:01
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants