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

Adding status info for WLED sync #34

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ lib_deps =
build_flags =
-D STARMOD_USERMOD_WLEDAUDIO
lib_deps =
https://github.com/netmindz/WLED-sync#07737aff9523a615f507b9525ffe55c98c440f8f ;; fixes 'Could not parse manifest' warning
https://github.com/netmindz/WLED-sync#62ca8f7706e9951f47f2de477812b49d0865b5c6



Expand Down
16 changes: 16 additions & 0 deletions src/User/UserModWLEDAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class UserModWLEDAudio:public SysModule {
//setup filesystem
void setup() {
SysModule::setup();
parentVar = ui->initUserMod(parentVar, name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

There was a bug that it was required to specify the order of a module. Is fixed and improved in latest main so merge main into this PR and it should work.
Still it is advisable to specify a module order otherwise it will be shown first in the UI. As follows:
mdl->varSetFixedOrder(parentVar, 5300);

ui->initText(parentVar, "wledAudioStatus", nullptr, 16, true, [](JsonObject var, uint8_t rowNr, uint8_t funType) { switch (funType) { //varFun
case f_UIFun:
ui->setLabel(var, "Status");
// ui->setComment(var, "web socket calls");
return true;
default: return false;
}});

}

void onOffChanged() {
Expand All @@ -51,6 +60,13 @@ class UserModWLEDAudio:public SysModule {
}
}

void loop1s() {
for (JsonObject childVar: mdl->varN("clTbl")) {
ui->callVarFun(childVar, UINT8_MAX, f_ValueFun);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This for loop is not needed here, is needed when you want to repopulate the model values for a table

Comment on lines +64 to +66
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do I need this bit? Wasn't sure what it did

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just pushed a commit where I renamed varN to varChildren

mdl->setUIValueV("wledAudioStatus", "%d, %d", sync, sync.lastPacketTime);
Copy link
Collaborator

Choose a reason for hiding this comment

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

sync is a class and cannot be used as %d parameter, caused crashes here, so a unsigned from sync should be choosen or sync should be removed

}

private:
boolean debug = false;

Expand Down
Loading