@@ -37,7 +37,7 @@ class NodeManager : public Module {
3737 void begin () {
3838 Module::begin ();
3939 // if (false)
40- // if file changes, read the file and bring into state
40+ // if file changes, read the file and bring into state
4141 // create a handler which recompiles the live script when the file of a current running live script changes in the File Manager
4242 _fileManager->addUpdateHandler ([&](const String& originId) {
4343 EXT_LOGV (ML_TAG, " FileManager::updateHandler %s" , originId.c_str ());
@@ -148,11 +148,11 @@ class NodeManager : public Module {
148148 if (!updatedItem.value .isNull ()) { // if name changed // == updatedItem.value
149149
150150 // // if old node exists then remove it's controls
151- // if (updatedItem.oldValue != "") {
152- // // EXT_LOGD(ML_TAG, "remove controls %s[%d]%s[%d].%s = %s -> %s", updatedItem.parent[0].c_str(), updatedItem.index[0], updatedItem.parent[1].c_str(), updatedItem.index[1],
153- // // updatedItem.name.c_str(), updatedItem.oldValue.c_str(), updatedItem.value.as<String>().c_str());
154- // nodeState.remove("controls"); // remove the controls from the nodeState
155- // }
151+ if (updatedItem.oldValue != " " ) {
152+ // EXT_LOGD(ML_TAG, "remove controls %s[%d]%s[%d].%s = %s -> %s", updatedItem.parent[0].c_str(), updatedItem.index[0], updatedItem.parent[1].c_str(), updatedItem.index[1],
153+ // updatedItem.name.c_str(), updatedItem.oldValue.c_str(), updatedItem.value.as<String>().c_str());
154+ nodeState.remove (" controls" ); // remove the controls from the nodeState
155+ }
156156
157157 // String xx;
158158 // serializeJson(nodeState["controls"], xx);
@@ -260,7 +260,7 @@ class NodeManager : public Module {
260260 else if (updatedItem.parent [1 ] == " controls" && updatedItem.name == " value" && updatedItem.index [1 ] < nodeState[" controls" ].size ()) { // nodes[i].controls[j].value
261261 // serializeJson(nodeState["controls"][updatedItem.index[1]], Serial);
262262 // EXT_LOGD(ML_TAG, "handle control value %s[%d]%s[%d].%s = %s -> %s", updatedItem.parent[0].c_str(), updatedItem.index[0], updatedItem.parent[1].c_str(), updatedItem.index[1], updatedItem.name.c_str(), updatedItem.oldValue.c_str(), updatedItem.value.as<String>().c_str());
263-
263+
264264 if (updatedItem.index [0 ] < nodes->size ()) {
265265 Node* nodeClass = (*nodes)[updatedItem.index [0 ]];
266266 if (nodeClass != nullptr ) {
@@ -301,13 +301,12 @@ class NodeManager : public Module {
301301 requestUIUpdate = false ; // reset the flag
302302 // EXT_LOGD(ML_TAG, "requestUIUpdate");
303303
304- // disable for the time being (locks _accessMutex), need to check if this is needed at all
305304 // update state to UI
306- // update(
307- // [&](ModuleState& state) {
308- // return StateUpdateResult::CHANGED; // notify StatefulService by returning CHANGED
309- // },
310- // _moduleName);
305+ update (
306+ [&](ModuleState& state) {
307+ return StateUpdateResult::CHANGED; // notify StatefulService by returning CHANGED
308+ },
309+ _moduleName);
311310 }
312311 }
313312
0 commit comments