WebSocket 'getControls' command returns empty array if the controls have not been previously set

It seems like the websocket’s getControls command returns empty if a pattern has not had controls which has been ‘initialized’ or set before with the web UI.

Using websocat, here is what I ran:
input:

{"getConfig": true}

output:

{"activeProgram":{"activeProgramId":"GyMZWwLsg4vDJZgtW","controls":{"sliderSpeed":null}}}

Note: sliderSpeed is null.

Next input:

{"getControls":'GyMZWwLsg4vDJZgtW'}

Output:

{"controls":{"GyMZWwLsg4vDJZgtW":{}}}

I’d expect to see {"sliderSpeed":null}.

However, If I go into the Web UI, select the pattern and manually adjust the slider to any value, and then rerun getControls, I the result is:

{'sliderSpeed': 0.5288}
1 Like

@vutang50,
Thank you for the bug report!

Yes, I can see how that would happen. The editor is not pre-seeding the values with null, and is persisting the controls file with the missing controls omitted.

As an additional workaround, if you use each control in the editor before saving, it should persist with the initial pattern save, and you should not have any missing controls.