Project

General

Profile

Revision 1662

wireless: more debug print statements

View differences:

branches/wireless/code/projects/libwireless/wireless_send.c
103 103
  if (scope == GLOBAL)
104 104
    packet[3] &= XBEE_OPTIONS_BROADCAST_ALL_PANS;
105 105
  else if (scope != PAN) {
106
    WL_DEBUG_PRINT("Error - bad scope in core send function\r\n");
106
    WL_DEBUG_PRINT_P("Error - bad scope in core send function\r\n");
107 107
    return WL_ERROR_SCOPE;
108 108
  }
109 109
    
......
111 111
  if (mode == FAST) {
112 112
    packet[3] &= XBEE_OPTIONS_DISABLE_RESPONSE;
113 113
  } else if (mode != RELIABLE) {
114
    WL_DEBUG_PRINT("Error - bad mode in core send function\r\n");
114
    WL_DEBUG_PRINT_P("Error - bad mode in core send function\r\n");
115 115
    return WL_ERROR_MODE;
116 116
  }
117 117
  
......
123 123

  
124 124
  // send the packet
125 125
  if (xbee_send_header(length+7) != WL_SUCCESS) {
126
    WL_DEBUG_PRINT("1Error sending packet from core send function\r\n");
126
    WL_DEBUG_PRINT_P("1Error sending packet from core send function\r\n");
127 127
    return WL_ERROR_SEND;
128 128
  }
129 129
  if (xbee_putc(XBEE_FRAME_TX_REQUEST_16) != WL_SUCCESS) {
130
    WL_DEBUG_PRINT("2Error sending packet from core send function\r\n");
130
    WL_DEBUG_PRINT_P("2Error sending packet from core send function\r\n");
131 131
    return WL_ERROR_SEND;
132 132
  }
133 133
  if (xbee_send(packet,6) != WL_SUCCESS) {
134
    WL_DEBUG_PRINT("3Error sending packet from core send function\r\n");
134
    WL_DEBUG_PRINT_P("3Error sending packet from core send function\r\n");
135 135
    return WL_ERROR_SEND;
136 136
  }
137 137
  if (xbee_send(data,length) != WL_SUCCESS) {
138
    WL_DEBUG_PRINT("4Error sending packet from core send function\r\n");
138
    WL_DEBUG_PRINT_P("4Error sending packet from core send function\r\n");
139 139
    return WL_ERROR_SEND;
140 140
  }
141 141
  if (xbee_putc(group) != WL_SUCCESS) {
142
    WL_DEBUG_PRINT("5Error sending packet from core send function\r\n");
142
    WL_DEBUG_PRINT_P("5Error sending packet from core send function\r\n");
143 143
    return WL_ERROR_SEND;
144 144
  }
145 145
  
......
153 153
    // save packet on sending buffer
154 154
    scope = send_buf_last; // use as ptr to send buffer    
155 155
    if (send_buf_add(&scope,length+6) != WL_SUCCESS) { // add length
156
      WL_DEBUG_PRINT("Error: sending buffer full\r\n");
156
      WL_DEBUG_PRINT_P("Error: sending buffer full\r\n");
157 157
      return WL_ERROR_SENDING_BUFFER_FULL;
158 158
    }    
159 159
    for(mode=0;mode<6;mode++) { // add header
160 160
      if (send_buf_add(&scope,packet[mode]) != WL_SUCCESS) {
161
        WL_DEBUG_PRINT("Error: sending buffer full\r\n");
161
        WL_DEBUG_PRINT_P("Error: sending buffer full\r\n");
162 162
        return WL_ERROR_SENDING_BUFFER_FULL;
163 163
      }
164 164
    }
165 165
    for(mode=0;mode<length;mode++) { // add data
166 166
      if (send_buf_add(&scope,data[mode]) != WL_SUCCESS) {
167
        WL_DEBUG_PRINT("Error: sending buffer full\r\n");
167
        WL_DEBUG_PRINT_P("Error: sending buffer full\r\n");
168 168
        return WL_ERROR_SENDING_BUFFER_FULL;
169 169
      }
170 170
    }
171 171
    if (send_buf_add(&scope,0) != WL_SUCCESS) { // add num retries=0
172
      WL_DEBUG_PRINT("Error: sending buffer full\r\n");
172
      WL_DEBUG_PRINT_P("Error: sending buffer full\r\n");
173 173
      return WL_ERROR_SENDING_BUFFER_FULL;
174 174
    }
175 175
    send_buf_last = scope;
......
246 246
 * @return the # of packets lost (up to 255)
247 247
 **/
248 248
uint8_t wl_ack_error(void) {
249
  WL_DEBUG_PRINT_P("entering wl_ack_error function\r\n");
249 250
  uint8_t val=0,i=1;
250 251
  
251 252
  while(1) {
......
269 270
 * @return {SENDING,ACK_OK,ACK_FAILURE,CCA_FAILURE}
270 271
 **/
271 272
int8_t wl_ack_check(uint8_t packet) {
273
  WL_DEBUG_PRINT_P("entering wl_ack_check function\r\n");
272 274
  if (packet == 0) {
273 275
    // no ack information here
274
    WL_DEBUG_PRINT("packet number cannot be 0\r\n");
276
    WL_DEBUG_PRINT_P("packet number cannot be 0\r\n");
275 277
    return WL_ERROR_ARGUMENT;
276 278
  }
277 279
  
......
284 286
 * reset the acknowledgement buffer
285 287
 **/
286 288
void wl_ack_reset(void) {
289
  WL_DEBUG_PRINT_P("entering wl_ack_reset function\r\n");
287 290
  memset(ack_buf,0,64);
288 291
}
289 292

  
......
300 303
 * @param val {SENDING,ACK_OK,ACK_FAILURE,CCA_FAILURE}
301 304
 */
302 305
void setack(uint8_t num,uint8_t val) {
306
  WL_DEBUG_PRINT_P("entering setack function\r\n");
303 307
  switch(num%4) {
304 308
  case 0:
305 309
    ack_buf[num/4] &= (0xFC|val);
......
320 324
/* ack handler */
321 325
void ackhandle(uint8_t num,uint8_t val) {
322 326
  uint8_t len;
327
  WL_DEBUG_PRINT_P("entering ackhandle function\r\n");
323 328
  switch(val) {
324 329
  case 0:
325 330
    // success
......
383 388
          send_buf[num]++; // increment retries
384 389
          val = (val==0)?PACKET_BUFFER_SIZE-1:val-1; // go back one byte
385 390
          if (xbee_send_header(len+1) != WL_SUCCESS) {
386
            WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
391
            WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
387 392
            return;
388 393
          }
389 394
          len = XBEE_FRAME_TX_REQUEST_16;
......
391 396
            // compute checksum
392 397
            len += send_buf[val];
393 398
            if (xbee_putc(send_buf_get(&val)) != WL_SUCCESS) { // send  byte
394
              WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
399
              WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
395 400
              return;
396 401
            }
397 402
          }
398 403
          len = 0xFF - len;
399 404
          if (xbee_putc(len) != WL_SUCCESS) { // send
400
            WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
405
            WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
401 406
            return;
402 407
          }
403 408
          return;
......
445 450
          send_buf[num]++; // increment retries
446 451
          val = (val==0)?PACKET_BUFFER_SIZE-1:val-1; // go back one byte
447 452
          if (xbee_send_header(len+1) != WL_SUCCESS) {
448
            WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
453
            WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
449 454
            return;
450 455
          }
451 456
          len = XBEE_FRAME_TX_REQUEST_16;
......
453 458
            // compute checksum
454 459
            len += send_buf[val];
455 460
            if (xbee_putc(send_buf_get(&val)) != WL_SUCCESS) { // send  byte
456
              WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
461
              WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
457 462
              return;
458 463
            }
459 464
          }
460 465
          len = 0xFF - len;
461 466
          if (xbee_putc(len) != WL_SUCCESS) { // send
462
            WL_DEBUG_PRINT("Error sending packet from ackhandle function\r\n");
467
            WL_DEBUG_PRINT_P("Error sending packet from ackhandle function\r\n");
463 468
            return;
464 469
          }
465 470
          return;
......
485 490
int8_t send_buf_add(uint8_t *ptr, uint8_t byte) {
486 491
  if (*ptr == send_buf_first) {
487 492
    // buffer full
488
    WL_DEBUG_PRINT("send buffer full\r\n");
493
    WL_DEBUG_PRINT_P("send buffer full\r\n");
489 494
    return WL_ERROR_SENDING_BUFFER_FULL;
490 495
  }
491 496
  send_buf[(*ptr)++] = byte;

Also available in: Unified diff