Skip to content
Snippets Groups Projects
Commit 967385a8 authored by Robert Hartung's avatar Robert Hartung
Browse files

Optimizes eval packet and removes include for fmt.h

parent 3e95e496
No related branches found
No related tags found
No related merge requests found
......@@ -33,12 +33,11 @@
#include "net/gnrc.h"
#include "net/gnrc/netreg.h"
#include "net/gnrc/netif/ieee802154.h"
#include "fmt.h"
#define SEND_INTERVAL (1)
#define RCV_QUEUE_SIZE (4)
#define MAX_PAYLOAD_LENGTH (128)
#define MAGIC_STRING ("IBREVAL")
#define MAGIC_STRING "IBREVAL\0"
#ifndef NODE_ID
#error NODE_ID undefined
......@@ -51,7 +50,7 @@ char send_thread_stack[256];
static gnrc_netif_t *ieee802154_netif = NULL;
typedef struct {
char magic_string[7];
char magic_string[8];
uint8_t node_id;
uint16_t seq_nr;
uint8_t temp;
......@@ -76,15 +75,7 @@ static void _dump(gnrc_pktsnip_t *pkt) {
case GNRC_NETTYPE_NETIF :
hdr = snip->data;
printf("HDR: %d %d %d\n", hdr->rssi, hdr->lqi, hdr->crc_valid);
/*
print("HDR: ", 5);
print_u32_dec((uint32_t)hdr->rssi);
print(" ", 1);
print_u32_dec((uint32_t)hdr->lqi);
print(" ", 1);
print_u32_dec((uint32_t)hdr->crc_valid);
print("\n", 1);
*/
packet = (eval_message_t*)payload->data;
if(hdr->crc_valid && strcmp(packet->magic_string, MAGIC_STRING) == 0) {
......@@ -96,29 +87,21 @@ static void _dump(gnrc_pktsnip_t *pkt) {
}
data = (uint8_t*)payload->data;
/*
print("Contents(", 9);
print_u32_dec((uint32_t)len);
print("Contents)", 1);
*/
printf("Contents(%02d):", len);
for(uint8_t i=0; i<len; i++) {
//print_byte_hex(data[i]);
printf(" %02X", data[i]);
}
//print(" | ", 3);
printf(" | ");
for(uint8_t i=0; i<len; i++) {
if(data[i] >= ' ' && data[i] <= '~') {
printf("%c", data[i]);
//print((char*)&data[i], 1);
} else {
printf(".");
//print(".", 1);
}
}
puts("");
}
break;
default :
printf("snip of type %d\n", snip->type);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment