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

input values not at top of the repl #13

Open
jlmitch5 opened this issue Oct 4, 2019 · 9 comments · May be fixed by #69
Open

input values not at top of the repl #13

jlmitch5 opened this issue Oct 4, 2019 · 9 comments · May be fixed by #69
Labels

Comments

@jlmitch5
Copy link
Contributor

jlmitch5 commented Oct 4, 2019

the readme says:

input values are printed on the top line

but I'm not seeing those

@trentgill
Copy link
Collaborator

realizing that First actually breaks this functionality. in order for it to work, the stream & change events need to be defined as:

stream     = function(value) _c.tell('stream',chan,value) end
change     = function(state) _c.tell('change',chan,state and 1 or 0) end

@simonvanderveldt
Copy link
Member

@trentgill is there a reason a script can (choose to) break this behavior/not adhere to the standard?
Can we make sure that this always works?

@csboling
Copy link
Contributor

Alternatively, a druid command could maybe reset the default handlers + input modes.

@tehn
Copy link
Member

tehn commented Oct 12, 2019

if you clear First ^^c won't this functionality be restored? that seems like a decent behavior.

i don't think input monitoring should be "always on" as it's extra usb traffic (and crow processor load) but maybe that's negligible.

if we were going to go full-time with input reporting, might make sense to also do output reporting?

@simonvanderveldt
Copy link
Member

if you clear First ^^c won't this functionality be restored? that seems like a decent behavior.

I just used clearscript/^^c and I didn't see anything in the two capture fields until I set input[n].mode('stream').

@tehn
Copy link
Member

tehn commented Oct 12, 2019

ok. i think the input/output capture is a sort of secondary feature that we need to consider. like a "scope" view, when enabled, druid sends some config.

but note that it may/will mess up the currently running script given it's overriding the config of inputs. so for this to be robust crow would need more plumbing--- like a secondary/not-script-related input/output update-via-usb

@trentgill
Copy link
Collaborator

This feature was secondary from the start. I mostly wanted to observe the input streams without trashing the console output (especially when sending at a high-rate).

We could add a library function to crow that sets up a metro & sends the stream message

One solution would be to add a library function that creates a metro which transmits the input values always. :

scope_metro = {} -- need a global to store whether we're sending
function scope(active)
  if active and scope_metro == {} then
    scope_metro = metro.init{ time = 0.1 }
    scope_metro.event = function()
      _c.tell('stream',1,input[1].volts) end
      _c.tell('stream',2,input[2].volts) end
    end
    scope_metro:start()
  elseif not active and scope_metro ~= {}
    scope_metro:stop()
    metro.free(scope_metro.id)
    scope_metro = {}
  end
end

I guess my point is, implementation is easy, it's much more of a design issue.

Is it even useful to have the raw floats / bools printed? I've been thinking a visual fader might make it more communicative. Alternatively we could scrap the input vals being printed, and instead have some kind of scope / histogram thing.

@simonvanderveldt
Copy link
Member

Would it make sense to make easy input monitoring a primary feature?

It seem like a very useful feature to have. I mean quiet a lot of scripts will take an input and being able to monitor that input helps a lot.
I can image one would sometimes like to see the derived value that is use in the script instead of the raw input. The boolean value as shown for change is an example for this, but it could for example also be a 5-state switch based on voltage. In that case you probably want to see 1-5 instead of 0-10V. This of course would mean it needs to be configurable but this would allow easy monitoring of the logically useful inputs going into a script.

Anyway, I've been working through the docs/tutorials this weekend and I've found it very useful to be able to easily view either the current value (in volts) or the boolean state when using change.
For this I definitely prefer the values as-is instead of some visual thing. A scope might be useful to monitor changes over time but that seems like a nice to have to me.

@jlmitch5
Copy link
Contributor Author

FWIW, I am ambiguous about the actual behavior. The issue is more the documentation in the readme is not valid for a new user...especially considering first is loaded by default. I thought it was something working incorrectly (which is why I initially filed the issue)

@trentgill trentgill linked a pull request May 5, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants