-
Notifications
You must be signed in to change notification settings - Fork 9
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,15 @@ class UserModWLEDAudio:public SysModule { | |
//setup filesystem | ||
void setup() { | ||
SysModule::setup(); | ||
parentVar = ui->initUserMod(parentVar, name); | ||
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() { | ||
|
@@ -51,6 +60,13 @@ class UserModWLEDAudio:public SysModule { | |
} | ||
} | ||
|
||
void loop1s() { | ||
for (JsonObject childVar: mdl->varN("clTbl")) { | ||
ui->callVarFun(childVar, UINT8_MAX, f_ValueFun); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I need this bit? Wasn't sure what it did There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
||
|
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.
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);