reboss / RapidOnsetAdHocNetwork

waffle.io for our multihop ad hoc network
0 stars 1 forks source link

A new node should listen by default and must be manually told that it is the sink #18

Closed reboss closed 7 years ago

reboss commented 7 years ago
fsm root {

        char selection = ' ';

        initial state INIT:
                init_cc1100();
                runfsm receive;
                if (sfd >= 0) {
                  sink = 1;
                  proceed DISPLAY;
                }
......

I noticed that the sink is always set to 1 in the case above which would in turn cause the node to not listen for deployment packets by default. I could be missing something here, but I think that by default, a node that is powered on should immediately listen for deployment packets from its neighbors. Once it is deployed it should then drop all deployment packets because otherwise once the next node is in its broadcast phase, it may receive those packets and could lead to the node "redeploying" itself.

Shibbywan commented 7 years ago

No matter what, every node enters the fsm receive so I think it all of them are listening for deploy packets. sfd is the variable that confirms that the node is the sink. I just made a sink variable so that we could call extern sink; in other files to make special cases.

Or am I not understanding your comment correctly?

reboss commented 7 years ago
case DEPLOY:
   set_ids(packet);

This block inside of receive will set the id regardless of where the deploy packet is coming from. We just need to add in a way to override this when we've already been deployed.

Also, sfd was being used as the file descriptor that the cc1100 was listening on, it's set within cc1100_init(). That's why I was confused about the if statement above.

Shibbywan commented 7 years ago

Ah ok, yeah sorry about that.

Yeah we need to sit down tomorrow and write out the flow of our program on a whiteboard or something. We can make a override method then, I don't think it should be too bad.