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

ii.<module>.help() truncated to 1024chars #264

Closed
csboling opened this issue Nov 27, 2019 · 5 comments · Fixed by #444
Closed

ii.<module>.help() truncated to 1024chars #264

csboling opened this issue Nov 27, 2019 · 5 comments · Fixed by #444

Comments

@csboling
Copy link
Contributor

With crow v1.0.2, in druid I see the following:

> ii.kria.help()

> print('****CAW!')
-- commands
ii.kria.preset( number )
ii.kria.pattern( number )
ii.kria.scale( number )
ii.kria.period( time )
ii.kria.position( track, param, pos )
ii.kria.loop_start( track, param, pos )
ii.kria.loop_length( track, param, pos )
ii.kria.reset( track, param )
ii.kria.mute( track, state )
ii.kria.toggle_mute( track )
ii.kria.clock( track )
-- request params
ii.kria.get( 'preset' )
ii.kria.get( 'pattern' )
ii.kria.get( 'scale' )
ii.kria.get( 'period' )
ii.kria.get( 'position', track, param )
ii.kria.get( 'loop_start', track, param )
ii.kria.get( 'loop_length', track, param )
ii.kria.get( 'reset', track )
ii.kria.get( 'mute', track )
ii.kria.get( 'cv', track )
-- then receive
ii.kria.event = function( e, data )
  if e == 'preset' then
    -- handle preset param here
  elseif e == 'pattern' then
  elseif e == 'scale' then
  elseif e == 'period' then
  elseif e == 'position' then
  elseif e == 'loop_start' then
  elseif e == 'loop_length' then
  elseif e == 'reset' then
  elseif e == 'mut****CAW!

This only currently affects ii.kria.help because the string is long enough that it can't be sent in a single Caw_send_luachunk. Not sure what the preferred way is to handle this in general.

@trentgill
Copy link
Collaborator

Hrmmm... Caw_send_luachunk is limited only by the USB TX buffer (currently 1024bytes).

The brute force solution is just allocating a bigger buffer (at the expense of runtime memory).

We could add some complex code to break a string into 1024byte chunks here. This would require an arbitrary delay, waiting for the usb buffer to be cleared, or a callback from the usb tx driver, or some kind of queue system. This seems like massive overkill to me.

We could break up the ii.<module>.help() into separate parts. Or take an optional string argument like 'commands' or 'events' which would only print the part you were interested in.

We could shorten the .event helpstring and just provide a single example, requiring the user to write their own. This could be done conditionally at compile time if the string is >1024 bytes.

Other ideas? How small of a use-case is this?

@csboling
Copy link
Contributor Author

csboling commented Nov 28, 2019

We could break up the ii..help() into separate parts. Or take an optional string argument like 'commands' or 'events' which would only print the part you were interested in.

This sounds like probably the easiest thing - separate sections for commands / getters / event handler example? However implementing all TXo commands would probably run into this limit for each section.

@trentgill trentgill changed the title ii.kria.help() doesn't show help string correctly ii.<module>.help() truncated to 1024chars Mar 26, 2020
@trentgill
Copy link
Collaborator

@csboling i just renamed this issue to reflect the problem so i stop skipping over it bc it says kria :~)

@trentgill
Copy link
Collaborator

I'm closing this one as it feels like too much to be asking of crow. We'd need some drastic restructuring of the serial stream and/or i2c help saving, which feels outside the scope for this small of an issue.

@trentgill
Copy link
Collaborator

Reopening as an extra 1kB of RAM doesn't actually seem like a big problem after further usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants