Project

General

Profile

Revision 1469

Tried to get it to work to no avail. Various small changes.

View differences:

main.c
4 4
#include "smart_run_around_fsm.h"
5 5
#include "hunter_prey.h"
6 6

  
7
#define CHAN 0xF
7
#define CHAN 0xC
8 8
#define ACK_PAUSE 5000
9 9

  
10 10
#define ROBOT_HUNTER 0
......
82 82

  
83 83
  id = get_robotid();
84 84
  packet[1] = id;
85
  usb_puts("hello, I am robot \n");
85
  usb_puts("hello, I am robot ");
86 86
  usb_puti(id);
87 87
  usb_putc('\n');
88 88

  
......
94 94

  
95 95
  run_around_init();
96 96

  
97
  usb_puts("channel\n");
97
  usb_puts("channel");
98 98

  
99 99
  //use a specific channel to avoid interfering with other tasks
100 100
  wl_set_channel(CHAN);
101 101
  usb_puti(CHAN);
102 102

  
103
  usb_puts("orb set\n");
103
  usb_puts("\norb set");
104 104

  
105 105
  // initially in hunter state
106 106
  robotState = ROBOT_HUNTER;
......
116 116

  
117 117
    if(robotState==ROBOT_TAGGED) {
118 118
      usb_puts("tagged, waiting to send ACK\n");
119
      orb_set_color(YELLOW);
119 120
      //delay_ms(TAG_PAUSE);
120 121
      move(0,0);
121 122
      usb_puts("sending ACK to ");
......
160 161
	    packet[0] = HUNTER_PREY_ACTION_TAG;
161 162
	    packet[1] = id;
162 163
	    wl_basic_send_global_packet (42, &packet, 2);
164
	    wl_do();
163 165
	    rtc_reset();
164 166
	}
165 167
    }
......
177 179

  
178 180
  if(length>=2){
179 181
    if(packet[0] == HUNTER_PREY_ACTION_TAG) {
182
	usb_puts("received a tag packet\n");
180 183
      if(robotState == ROBOT_PREY) {
184
	  usb_puts("it was for me\n");
181 185
	robotState = ROBOT_TAGGED;
182 186
	bom_off();
183 187
	tagger = packet[1];
......
186 190
	usb_puts("tagged, but I'm not it!\n");
187 191
      }
188 192
    }
189
    else if(packet[0] == HUNTER_PREY_ACTION_ACK && robotState == ROBOT_HUNTER) {
193
    else if(packet[0] == HUNTER_PREY_ACTION_ACK) {
190 194
      robotState = ROBOT_IDLE;
191 195
    }
192 196
    usb_puts("got '");

Also available in: Unified diff