Shop OBEX P1 Docs P2 Docs Learn Events
Cannot start cog consistantly — Parallax Forums

Cannot start cog consistantly

highplainsbubbahighplainsbubba Posts: 34
edited 2013-03-06 06:11 in Accessories
I have a Spinneret tied to 3 Digital Input/Output cards controlled by serial comm.
Digital Ouput (DO) Address 0,, controls 24 relays
DIgital Input (DI) Address 1,, Reads the 24 outputs of the above card to verify the output states.
Digital Input (DI) Address 2,, Reads 24 momentary switches that read high when pressed.

There are 2 Object Files
SwitchF :Operates correctly when run independantly. Scans the switch inputs and turns on the corresponding relay.
HTTPF : Operates correctly when run independantly. Controls the relays from buttons on a web page. The page will load/unload/reload, and read/control the relays states.

Desired behavior : I load the Spinneret with the two modules. SwitchF runs in its own cog until the web page opens, which turns off the SwitchF cog. I control the relays from the web page. When the web page closes, SwitchF cog is turned back on to control the relays from the switches. HTTPF is the top level object and calls the SwitchF object.

What is happening now :
1. Load modules to ram
2 SwitchF starts normally, I can control relays from momentary switches.
3 Load the web page, SwitchF is turned off. I can control the relays from the web page.
4 Unload the web page. Here's where it gets hinky.
a. On line 22 of SwitchF there is a delay statement. If the delay is active : SwitchF cog doesn't start, but I can load/reload the web page and control the relays
b If delay is commented out : SwitchF cog will start and I can control the relays from the switches, but the web page hangs up when I try to re-open it.

The objects are attached below. I have tried everything I know to make it work with no luck. I counted only 6 cogs running in HTTPF so there should be one available for the SwitchF object . I have commented the objects heavily . I would be appreciative if someone could take a look and tell me what I am doing wrong. Thanks in advance.

Comments

  • Mike GMike G Posts: 2,702
    edited 2013-03-05 09:47
    I believe you are out of COGs. I've never used BS2_FunctionsB but the start method, BS2.Start, generally means a COG is started. You might consider using the new Spinneret library as it uses only 4 COGs and is much smaller.
  • highplainsbubbahighplainsbubba Posts: 34
    edited 2013-03-06 06:11
    Thanks Mike,

    That's probably the case, I should have tested for that as suggested in the Prop Manual. I am going on extended vacation so I will check that when I get back.
Sign In or Register to comment.