monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
633 stars 147 forks source link

Errors in code within redraw() function seem to break other event loops in the system #952

Closed dansimco closed 4 years ago

dansimco commented 4 years ago

I've been skirting around this bug for a while without being able to reliably replicate it outside of a much bigger codebase full of red herrings. I started a new sketch today and ran into it immediately so here it is! If I make a syntactical or logical error that is called within my redraw function, it seems to have side effects on other parts of the system. When the code below is run, it will fail at screen.aa(true) which expects a number. At this point all I can do is reset norns. If I was to load Awake without resetting, it would try to load it but the clock wouldn't run. If I fix the error and retry my script, nothing really happens.

This is true with as of norns 191126

My example code is

function init()
  redraw()
end

function redraw()
  screen.clear()
  screen.level(8)
  line_height = 8
  screen.aa(true) -- here is an error (it expects a number)
  screen.move(0, line_height)
  screen.font_face(1)
  screen.font_size(8)
  screen.text("the quick brown fox.wav")
  screen.update()
end
tehn commented 4 years ago

thanks for spotting this, will get on it!

dansimco commented 4 years ago

Not sure if there are other patches to apply, but I applied the changes from #956 to my menu.lua file and the crash above still happens. Though the menu re-render is better now :)

dansimco commented 4 years ago

To clarify, If I run the code above. Then switch to Awake, I can use the encoders and keys to modify the sequence, but the sequencer clock does not run.

tehn commented 4 years ago

looking into it!

tehn commented 4 years ago

ok. yet another (different) problem.

errors in init are not being caught correctly. working on it.

dansimco commented 4 years ago

Thank you! I am going to be SO much more efficient now