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

Fixed code of Smartnest and updated documentation #4001

Merged
merged 4 commits into from
Jun 1, 2024

Conversation

DevilPro1
Copy link
Contributor

All problems were already corrected and working now.

@blazoncek
Copy link
Collaborator

@Aircoookie & @Steven17D can you verify the changes please? This looks like a final version after much troubles.


## Change log
2022-09
* First implementation.
2024-05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In changelog append the changes instead of removing the old log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up

lastMqttReport = currentMillis;

// Report current brightness
char brightnessMsg[6];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max %u output may be 4,294,967,295 which needs 11 characters (including \0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up

@@ -9,6 +9,10 @@
class Smartnest : public Usermod
{
private:
bool initialized = false;
unsigned long lastMqttReport = 0;
unsigned long mqttReportInterval = 60000; // Report every minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this static const (or constexpr is better)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue to allow it to be just unsigned and use it as a run-time settable variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I better leave it like this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add configuration item like other usermods.

*/
void setup() {
// Initialization code here
if (!initialized) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is initialized needed? This function is called once (isn't it?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly my thoughts. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up

2. Use `#define USERMOD_SMARTNEST` in wled.h or `-D USERMOD_SMARTNEST` in your platformio.ini
1. Use `#define USERMOD_SMARTNEST` in wled.h or `-D USERMOD_SMARTNEST` in your platformio.ini (recommended).
## It is not necessary since the main branch of WLED brings it with it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not necessary - remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed up

@DevilPro1 DevilPro1 requested review from Steven17D and blazoncek May 29, 2024 16:34
Copy link
Contributor

@Steven17D Steven17D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new commit

@DevilPro1
Copy link
Contributor Author

DevilPro1 commented May 29, 2024

No new commit

Sorry! I was on the wrong project branch, I'm sorry for the inconvenience! Now look

@DevilPro1 DevilPro1 requested a review from Steven17D May 29, 2024 18:16
Copy link
Contributor

@Steven17D Steven17D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for your contribution!

@blazoncek blazoncek merged commit 1bb0610 into Aircoookie:0_15 Jun 1, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants