Bug in COSM vimp

Outputs from the imp seem to be off by one when sending data to COSM vimps. 
For example, if I register this imp:

imp.configure(“test”, [], [ output1, output2, output3]);

…and then connect it to three COSM vimps where I select outputs output1, output2 and output3 respectively for the inputs to the COSM vimp…

The tail of each arrow (coming from the imp)  is labeled 0, 1 and 2 respectively.  I think you are using the wrong index into the output array from the imp, and that it should be 1, 2, 3 (as is the case on the showinput vimps, where the first will use source “1” and not “0”).

When I run such an example, the COSM vimp linked to output1 gets no data, COSM linked to output2 gets output1’s data, COSM linked to output3 gets output2’s data (etc)

Regards,
Joe Walko

Hey Joe,

Thanks for the report! I’ll take a look when I get a chance.

API key is being truncated to 4 characters at the moment 

neufuture - We’re having a hard time reproducing this problem. Can you provide steps to reproduce and we’ll give it a shot?

Thanks!

Hey Joe,

That is strange behavior, indeed. If you delete the connections and wire it up again, do you still end up with indicies 0,1, and 2? You’re absolutely right that they should be 1, 2, and 3, but I’m having a hard time causing the 0,1,2 to happen.

I deleted all connections (going to both COSM and ShowInput vimps), and now when I create a new connector to any vimp, the header of the connection is showing “0”.  So, it’s obviously not COSM specific, but connections in general for my Imp.  Imp is currently offline at home; I’ll work on it some this evening, and see if I can narrow down what situation is causing this.  I’ll try switching programs etc, and see if the problem goes away.

Hmm. And this only happens when dragging a connection from your imp, not coming from other imps or vimps?

This happens on new connectors from Imp to any other sink when there is more than one output configured for the imp.  I think the root problem is in the pop-up dialog which is displayed after clicking “+” on the imp to add a connector.  (The pop-up where one selects which output to use for the connector).

Using a modified version of the tick-tock example,  if there is only one output defined like in the original example, then there is no issue.

If I configure two or more outputs, like so:

Imp.configure(“Tick tocks”, [], [out1,out2]);

then the problem will appear when creating new connectors after I load the modified program.   If I select the first output in the pop-up (tick1 in my case), then the root of the connector arrow will show “0” instead of “1”.  Selecting the second output in the pop-up (tick2), then the root will show “1” instead of “2”, etc.
######################################################################

// Alternating 1’s and 0’s every 1 second (0.5Hz square wave)

local out1 = OutputPort(“tick1”, “number”);
local out2 = OutputPort(“tick2”, “number”);
local out3 = OutputPort(“tick3”, “number”);

local s=0;

server.log(“started”);

function tick() {
    imp.wakeup(1, tick);
   
    s=1-s;
    out1.set(s);
    out2.set(s);
    out3.set(s);
   
    server.show(s);
}

imp.configure(“Tick tocks”, [], [out1,out2]);

tick();


 

Thanks for the details! Definitely a bug, and it’s fixed now.