Closed rwhaling closed 5 years ago
i am not able to replicate this bug. can you post a snippet?
also crow will report lua errors back to norns in the maiden window. mode
is definitely correct--- see here: https://github.com/monome/crow/blob/master/lua/input.lua#L75
thanks for taking a look @tehn - sorry, I should have added a quick script to repro instead of a PR. try this:
-- counts gates at input 1 or 2
-- press key 2 to print volts at input 1
-- press key 3 to print volts at input 2
local count_1 = 0
local count_2 = 0
function init()
crow.input[1].mode("change",1.0,0.1,"rising")
crow.input[1].change = change_1
crow.input[2].mode("change",1.0,0.1,"rising")
crow.input[2].change = change_2
screen.level(15)
screen.aa(0)
screen.line_width(1)
end
function change_1(s)
count_1 = count_1 + 1
redraw()
end
function change_2(s)
count_2 = count_2 + 1
redraw()
end
function redraw()
screen.clear()
screen.move(10,60)
screen.text("count_1: "..count_1.." count_2:" .. count_2)
screen.stroke()
screen.update()
end
function key(n,z)
if n==2 and z==1 then
print(crow.input[1].query())
elseif n==3 and z==1 then
print(crow.input[2].query())
end
end
On my machine, only gates at input 2 get counted. Despite that, I can query input 1 and see that the voltage is flipping between 0.05 and 7.64 - but the handler function never fires and the count does not increment
sortof good news is that your script works fine on my machine.
is your crow on v1.0.0 ?
and i just pushed some changes to the crow code on norns. i'll have an update out tomorrow, or you can ssh in, pull the changes and re-run ./waf
(be sure to ;restart
after in maiden)
mysterious! I did need to update crow, but no change in behavior from norns.
I also confirmed that I could set the modes of both inputs and assign change handlers via druid
.
Thanks again for taking a look! I'll try again when the update is out tomorrow.
holy moly--- are you saying it's working as expected on druid?
yep -
function init()
input[1].mode('change',1,0.1,'rising')
input[2].mode('change',1,0.1,'rising')
end
input[1].change = function()
print("BEEP")
output[1].volts = math.random() * 10.0 - 5.0
end
input[2].change = function()
print("BOOP")
output[2].volts = math.random() * 10.0 - 5.0
end
behaves as I would expect on druid. a real head-scratcher!
I think I've resolved this?
The update did not fix the issue, but a crow.clear()
did.
My engineering brain still wants to figure out what the underlying issue is, and how I managed to accidentally upload a script that disabled only one of the inputs, but I'm glad it's working.
Thanks so much for the help, and for making this amazing device! Closing the issue.
I found that crow's input[1] would not respond to triggers in
change
mode, even though I could validate with input[1].query() that the input signal was rising above the threshold (and back below the hysteresis level); meanwhile, input[2] responds just fine to the same signals.More details in this thread: https://llllllll.co/t/crow-help-norns/25863/23, including a few other folks with similar issues.
I think what is going on is - crow is disregarding the
.mode()
message that norns sends, because crow's method is called set_mode(): https://github.com/monome/crow/blob/master/lua/input.lua#L39 whereas the norns crow.input.mode() method definitely sends.mode()
in the command text: https://github.com/monome/norns/blob/master/lua/core/crow.lua#L56So I think, as it is now, norns cannot set input modes at all for crow, but people have been masking it by relying on input 2 being set to change mode via First.
A fix might be as easy as adjust the command to run set_mode()? I don't know either codebase well but I can make an initial PR if that helps.