Posted 17 January 2014 - 03:05 PM
Ok so this is a fairly large program, my apologies for that. This is also still a WIP so some of the code will be rewritten to be a little cleaner. Basically to sum up how the program SHOULD work, you configure a couple variables and tables at the top, then the computers will be able to send RS signal updates through modems. So if computer A is on the same frequency as computer B and, and A got an input signal, it would send a message to B to update. To do this, there is a "stack", so if you have multiple inputs, each input would add to the stack if it turned on, and remove if it turns off. That all works fine and well. The problem I am having is with computers outputting on startup. So every time the stack gets updated the computer saves it to memory, then when it starts up again, it is supposed to update the signal. Here is the strange part, the stack gets saved and everything if fine and good, but it does not update the signal. I tested this by printing out various variables when that part of the code was reached. The even weirder part is, even if lets say the stack is at 3, and the output doesnt turn on for whatever reason, if a 4th computer sends a signal the output still won't turn on. The "stack" has to reach 0, then after that all updates work as they should. Another odd thing, is that when I exit the program with ctrl+t the RS updates and it starts outputting the right signal. I cant figure out for the life of me why this is happening or how to fix it. Also if you have any other suggestions for making my code a little better, feel free.
Code: http://pastebin.com/YHmTWFdi
Edit: I haven't done my error checking code yet, but make sure that any input sides are not output sides as well and vice versa, by default both are "all", so you will need to change that, everything else should run fine straight away.
Code: http://pastebin.com/YHmTWFdi
Edit: I haven't done my error checking code yet, but make sure that any input sides are not output sides as well and vice versa, by default both are "all", so you will need to change that, everything else should run fine straight away.
Edited on 17 January 2014 - 02:10 PM