Commit d4c7bb1655100216177ba943c05df62aef7fcee9

Authored by root
1 parent 3accef26

resolution pb de synchro, nettoyage du code

RIOT/examples/dynamic_app/main.c
@@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
26 26
27 #include <arpa/inet.h> 27 #include <arpa/inet.h>
28 #include "periph/gpio.h" 28 #include "periph/gpio.h"
29 -#include "../../boards/stm32f4discovery/include/board.h"  
30 -#include "../../boards/stm32f4discovery/include/periph_conf.h" 29 +#include "board.h"
  30 +#include "periph_conf.h"
31 #include "net/sock/udp.h" 31 #include "net/sock/udp.h"
32 #include "net/gnrc/ipv6.h" 32 #include "net/gnrc/ipv6.h"
33 #include "net/af.h" 33 #include "net/af.h"
@@ -86,29 +86,10 @@ @@ -86,29 +86,10 @@
86 86
87 #define PWM_FREQ 1000 87 #define PWM_FREQ 1000
88 #define PWM_RES 1000 88 #define PWM_RES 1000
89 -#define DEADLINE 40000 89 +#define DEADLINE 30000
90 90
91 static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; 91 static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
92 92
93 -extern int udp_cmd(int argc, char **argv);  
94 -  
95 -static const shell_command_t shell_commands[] = {  
96 - { "udp", "send data over UDP and listen on UDP ports", udp_cmd },  
97 - { NULL, NULL, NULL }  
98 -};  
99 -  
100 -// addr ipv6 link local node 1: fe80::3734:510e:3317:3402  
101 -uint8_t node1[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x34,0x51,0x0e,0x33,0x17,0x34,0x02};  
102 -// addr ipv6 link local node 2: fe80::3634:5110:3473:3762  
103 -uint8_t node2[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x34,0x51,0x10,0x34,0x73,0x37,0x62};  
104 -// addr ipv6 link local node 3: fe80::3734:510e:330b:342a  
105 -uint8_t node3[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x33,0x47,0x11,0x37,0x2c,0x34,0x12};  
106 -// addr ipv6 link local node 4: fe80::3734:510b:330b:340a  
107 -uint8_t node4[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x34,0x51,0x0b,0x33,0x0b,0x34,0x0a};  
108 -// addr ipv6 link local node 5: fe80::3734:510b:330a:341e  
109 -uint8_t node5[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x34,0x51,0x0b,0x33,0x0a,0x34,0x1e};  
110 -//static char _stack_server[GNRC_PKTDUMP_STACKSIZE];  
111 -char pwm_stack[THREAD_STACKSIZE_MAIN];  
112 char sock_server_stack[THREAD_STACKSIZE_MAIN]; 93 char sock_server_stack[THREAD_STACKSIZE_MAIN];
113 char sock_client_stack[THREAD_STACKSIZE_MAIN]; 94 char sock_client_stack[THREAD_STACKSIZE_MAIN];
114 char sock_time_server_stack[THREAD_STACKSIZE_MAIN]; 95 char sock_time_server_stack[THREAD_STACKSIZE_MAIN];
@@ -133,16 +114,8 @@ typedef struct tableau { @@ -133,16 +114,8 @@ typedef struct tableau {
133 114
134 /***************** RPL functions *****************/ 115 /***************** RPL functions *****************/
135 116
136 -int crea_rpl_dodag_root(char *arg1, char *arg2) 117 +int crea_rpl_dodag_root(uint8_t instance_id, ipv6_addr_t dodag_id)
137 { 118 {
138 - uint8_t instance_id = (uint8_t) atoi(arg1);  
139 - ipv6_addr_t dodag_id;  
140 -  
141 - if (ipv6_addr_from_str(&dodag_id, arg2) == NULL) {  
142 - puts("error: <dodag_id> must be a valid IPv6 address");  
143 - return 1;  
144 - }  
145 -  
146 gnrc_rpl_instance_t *inst = NULL; 119 gnrc_rpl_instance_t *inst = NULL;
147 inst = gnrc_rpl_root_init(instance_id, &dodag_id, false, false); 120 inst = gnrc_rpl_root_init(instance_id, &dodag_id, false, false);
148 if (inst == NULL) { 121 if (inst == NULL) {
@@ -173,20 +146,10 @@ void *sock_time_server_thread(void *arg) @@ -173,20 +146,10 @@ void *sock_time_server_thread(void *arg)
173 146
174 if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT, 147 if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT,
175 &remote)) >= 0) { 148 &remote)) >= 0) {
176 - puts("Received a message");  
177 - //printf("TT: %lu\n", byteorder_ntohl(sntp_packet.transmit.seconds));  
178 -  
179 - // printf("%c\n",remote.addr.ipv6[15]);  
180 - //xtimer_ticks64_t now = xtimer_now64();  
181 - // heure actuelle du serveur  
182 - sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec()); 149 + sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec());
183 sntp_packet.origin.seconds=sntp_packet.transmit.seconds; 150 sntp_packet.origin.seconds=sntp_packet.transmit.seconds;
184 sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); 151 sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec());
185 - //printf("heure actuelle : %lu\n",xtimer_now_usec());  
186 - //printf("TT2: %lu\n", byteorder_ntohl(sntp_packet.transmit.seconds));  
187 - //memset(&sntp_packet, 0, sizeof(sntp_packet));  
188 - //ntp_packet_set_vn(&sntp_packet);  
189 - //ntp_packet_set_mode(&sntp_packet, NTP_MODE_SERVER); 152 +
190 if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) { 153 if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) {
191 puts("Error sending reply"); 154 puts("Error sending reply");
192 } 155 }
@@ -204,6 +167,7 @@ void *sock_server_thread(void *arg) @@ -204,6 +167,7 @@ void *sock_server_thread(void *arg)
204 int deadline; 167 int deadline;
205 local.port = 1234; 168 local.port = 1234;
206 int interruption_msg = 0; 169 int interruption_msg = 0;
  170 + int sync = 0;
207 sock_udp_ep_t server = { .port = NTP_PORT, .family = AF_INET6 }; 171 sock_udp_ep_t server = { .port = NTP_PORT, .family = AF_INET6 };
208 ipv6_addr_from_str((ipv6_addr_t *)&server.addr, "dead:beef::3402"); 172 ipv6_addr_from_str((ipv6_addr_t *)&server.addr, "dead:beef::3402");
209 173
@@ -211,11 +175,6 @@ void *sock_server_thread(void *arg) @@ -211,11 +175,6 @@ void *sock_server_thread(void *arg)
211 puts("Error creating UDP sock"); 175 puts("Error creating UDP sock");
212 return NULL; 176 return NULL;
213 } 177 }
214 - if (sntp_sync(&server, SOCK_NO_TIMEOUT) < 0) {  
215 - puts("Error in synchronization");  
216 - }  
217 - offset = sntp_get_offset();  
218 - printf("offset : %i\n",(int)offset);  
219 178
220 while (1) { 179 while (1) {
221 sock_udp_ep_t remote; 180 sock_udp_ep_t remote;
@@ -225,10 +184,19 @@ void *sock_server_thread(void *arg) @@ -225,10 +184,19 @@ void *sock_server_thread(void *arg)
225 printf("tps de transmission : %i\n",deadline); 184 printf("tps de transmission : %i\n",deadline);
226 185
227 if(buf.donnees[0] == 'g' && buf.donnees[1] == 'o') { 186 if(buf.donnees[0] == 'g' && buf.donnees[1] == 'o') {
  187 + if(sync == 0)
  188 + {
  189 + while(sntp_sync(&server, 5000000) < 0) {
  190 + puts("Erreur dans la synchronisation - Nouvelle tentative :");
  191 + }
  192 + offset = sntp_get_offset();
  193 + sync = 1;
  194 + printf("offset : %i\n",(int)offset);
  195 + }
228 if(interruption_msg == 1) { 196 if(interruption_msg == 1) {
229 - if (sntp_sync(&server, SOCK_NO_TIMEOUT) < 0) {  
230 - puts("Error in synchronization");  
231 - return NULL; 197 + puts("reprise de la communication - tentative de synchronisation :");
  198 + while(sntp_sync(&server, 5000000) < 0) {
  199 + puts("Erreur dans la synchronisation - Nouvelle tentative :");
232 } 200 }
233 offset = sntp_get_offset(); 201 offset = sntp_get_offset();
234 printf("offset : %i\n",(int)offset); 202 printf("offset : %i\n",(int)offset);
@@ -252,12 +220,6 @@ void *sock_server_thread(void *arg) @@ -252,12 +220,6 @@ void *sock_server_thread(void *arg)
252 gpio_clear(LED2_PIN); 220 gpio_clear(LED2_PIN);
253 gpio_set(LED0_PIN); 221 gpio_set(LED0_PIN);
254 timer_set(TIMER_DEV(1),0,25200); 222 timer_set(TIMER_DEV(1),0,25200);
255 - /* if (sntp_sync(&server, SOCK_NO_TIMEOUT) < 0) {  
256 - * puts("Error in synchronization");  
257 - * return NULL;  
258 - }  
259 - offset = sntp_get_offset();  
260 - printf("offset : %i\n",(int)offset);*/  
261 timer_run = 1; 223 timer_run = 1;
262 } 224 }
263 } 225 }
@@ -323,7 +285,7 @@ void *sock_client_thread(void *arg) @@ -323,7 +285,7 @@ void *sock_client_thread(void *arg)
323 ssize_t res; 285 ssize_t res;
324 data.donnees[0] = 'g'; 286 data.donnees[0] = 'g';
325 data.donnees[1] = 'o'; 287 data.donnees[1] = 'o';
326 - //uint8_t paquet[]; 288 +
327 sock_udp_ep_t remote = { .family = AF_INET6 }; 289 sock_udp_ep_t remote = { .family = AF_INET6 };
328 290
329 remote.port = 1234; 291 remote.port = 1234;
@@ -333,7 +295,7 @@ void *sock_client_thread(void *arg) @@ -333,7 +295,7 @@ void *sock_client_thread(void *arg)
333 remote.addr.ipv6[3] = 0xef; 295 remote.addr.ipv6[3] = 0xef;
334 remote.addr.ipv6[14] = 0x34; 296 remote.addr.ipv6[14] = 0x34;
335 remote.addr.ipv6[15] = 0x1e; 297 remote.addr.ipv6[15] = 0x1e;
336 - // memcpy(remote.addr.ipv6,addr.u8,IPV6_ADDR_BIT_LEN); 298 +
337 while (1) { 299 while (1) {
338 data.heure_actuelle = xtimer_now_usec(); 300 data.heure_actuelle = xtimer_now_usec();
339 if (sock_udp_send(&sock, &data, sizeof(data), &remote) < 0) { 301 if (sock_udp_send(&sock, &data, sizeof(data), &remote) < 0) {
@@ -428,7 +390,7 @@ static void _init_interface(void) @@ -428,7 +390,7 @@ static void _init_interface(void)
428 gnrc_ipv6_netif_add_addr(ifs[0], &addr, 64, GNRC_IPV6_NETIF_ADDR_FLAGS_UNICAST); 390 gnrc_ipv6_netif_add_addr(ifs[0], &addr, 64, GNRC_IPV6_NETIF_ADDR_FLAGS_UNICAST);
429 /* model ipv6 addr: dead:beef::Hwaddr */ 391 /* model ipv6 addr: dead:beef::Hwaddr */
430 if((addr.u8[14]==0x34)&&(addr.u8[15]==0x02)){ 392 if((addr.u8[14]==0x34)&&(addr.u8[15]==0x02)){
431 - crea_rpl_dodag_root("1", "dead:beef::3402"); 393 + crea_rpl_dodag_root(1, addr);
432 client=thread_create(sock_client_stack,sizeof(sock_client_stack),8,THREAD_CREATE_STACKTEST | THREAD_CREATE_WOUT_YIELD,sock_client_thread,NULL,"sock_client_thread"); 394 client=thread_create(sock_client_stack,sizeof(sock_client_stack),8,THREAD_CREATE_STACKTEST | THREAD_CREATE_WOUT_YIELD,sock_client_thread,NULL,"sock_client_thread");
433 time_server=thread_create(sock_time_server_stack,sizeof(sock_time_server_stack),6,THREAD_CREATE_STACKTEST,sock_time_server_thread,NULL,"sock_time_server_thread"); 395 time_server=thread_create(sock_time_server_stack,sizeof(sock_time_server_stack),6,THREAD_CREATE_STACKTEST,sock_time_server_thread,NULL,"sock_time_server_thread");
434 }else if((addr.u8[14]==0x37)&&(addr.u8[15]==0x62)){ 396 }else if((addr.u8[14]==0x37)&&(addr.u8[15]==0x62)){
@@ -439,13 +401,17 @@ static void _init_interface(void) @@ -439,13 +401,17 @@ static void _init_interface(void)
439 }else if((addr.u8[14]==0x34)&&(addr.u8[15]==0x1e)){ 401 }else if((addr.u8[14]==0x34)&&(addr.u8[15]==0x1e)){
440 _init_timer(); 402 _init_timer();
441 _init_pwm(); 403 _init_pwm();
442 - xtimer_sleep(10); 404 + xtimer_sleep(2);
443 server=thread_create(sock_server_stack,sizeof(sock_server_stack),6,THREAD_CREATE_STACKTEST,sock_server_thread,NULL,"sock_server_thread"); 405 server=thread_create(sock_server_stack,sizeof(sock_server_stack),6,THREAD_CREATE_STACKTEST,sock_server_thread,NULL,"sock_server_thread");
444 }else{ 406 }else{
445 puts("new node ?"); 407 puts("new node ?");
446 } 408 }
447 } 409 }
448 410
  411 +static const shell_command_t shell_commands[] = {
  412 + { NULL, NULL, NULL }
  413 +};
  414 +
449 415
450 int main(void) 416 int main(void)
451 { 417 {
@@ -457,8 +423,8 @@ int main(void) @@ -457,8 +423,8 @@ int main(void)
457 /* start shell */ 423 /* start shell */
458 puts("All up, running the shell now"); 424 puts("All up, running the shell now");
459 char line_buf[SHELL_DEFAULT_BUFSIZE]; 425 char line_buf[SHELL_DEFAULT_BUFSIZE];
460 - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);  
461 426
  427 + shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
462 /* should be never reached */ 428 /* should be never reached */
463 return 0; 429 return 0;
464 } 430 }
RIOT/examples/real_time_app/main.c
@@ -25,8 +25,8 @@ @@ -25,8 +25,8 @@
25 #include <inttypes.h> 25 #include <inttypes.h>
26 #include <arpa/inet.h> 26 #include <arpa/inet.h>
27 27
28 -#include "../../boards/stm32f4discovery/include/board.h"  
29 -#include "../../boards/stm32f4discovery/include/periph_conf.h" 28 +#include "board.h"
  29 +#include "periph_conf.h"
30 #include "periph/gpio.h" 30 #include "periph/gpio.h"
31 #include "net/sock/udp.h" 31 #include "net/sock/udp.h"
32 #include "net/gnrc/ipv6.h" 32 #include "net/gnrc/ipv6.h"
@@ -89,16 +89,10 @@ uint8_t node2[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x34,0x51,0x10,0 @@ -89,16 +89,10 @@ uint8_t node2[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x34,0x51,0x10,0
89 //addr ipv6 link local node 3: fe80::3634:5110:3471:3766 89 //addr ipv6 link local node 3: fe80::3634:5110:3471:3766
90 uint8_t node3[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x34,0x51,0x0b,0x33,0x0a,0x34,0x1e}; 90 uint8_t node3[16]={0xfe,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x34,0x51,0x0b,0x33,0x0a,0x34,0x1e};
91 91
92 -//static char _stack_server[GNRC_PKTDUMP_STACKSIZE];  
93 -char pwm_stack[THREAD_STACKSIZE_MAIN];  
94 char sock_server_stack[THREAD_STACKSIZE_MAIN]; 92 char sock_server_stack[THREAD_STACKSIZE_MAIN];
95 char sock_client_stack[THREAD_STACKSIZE_MAIN]; 93 char sock_client_stack[THREAD_STACKSIZE_MAIN];
96 char sock_time_server_stack[THREAD_STACKSIZE_MAIN]; 94 char sock_time_server_stack[THREAD_STACKSIZE_MAIN];
97 -// static gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,  
98 -// KERNEL_PID_UNDEF);  
99 -//  
100 -// kernel_pid_t gnrc_server_pid = KERNEL_PID_UNDEF;  
101 -// 95 +
102 kernel_pid_t server, client, time_server; 96 kernel_pid_t server, client, time_server;
103 int ordre = 0; 97 int ordre = 0;
104 int64_t offset = 0; 98 int64_t offset = 0;
@@ -133,20 +127,10 @@ void *sock_time_server_thread(void *arg) @@ -133,20 +127,10 @@ void *sock_time_server_thread(void *arg)
133 127
134 if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT, 128 if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT,
135 &remote)) >= 0) { 129 &remote)) >= 0) {
136 - // puts("Received a message");  
137 - //printf("TT: %lu\n", byteorder_ntohl(sntp_packet.transmit.seconds));  
138 -  
139 - // printf("%c\n",remote.addr.ipv6[15]);  
140 - //xtimer_ticks64_t now = xtimer_now64();  
141 - // heure actuelle du serveur  
142 sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec()); 130 sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec());
143 sntp_packet.origin.seconds=sntp_packet.transmit.seconds; 131 sntp_packet.origin.seconds=sntp_packet.transmit.seconds;
144 sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); 132 sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec());
145 - //printf("heure actuelle : %lu\n",xtimer_now_usec());  
146 - //printf("TT2: %lu\n", byteorder_ntohl(sntp_packet.transmit.seconds));  
147 - //memset(&sntp_packet, 0, sizeof(sntp_packet));  
148 - //ntp_packet_set_vn(&sntp_packet);  
149 - //ntp_packet_set_mode(&sntp_packet, NTP_MODE_SERVER); 133 +
150 if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) { 134 if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) {
151 puts("Error sending reply"); 135 puts("Error sending reply");
152 } 136 }
@@ -213,12 +197,6 @@ void *sock_server_thread(void *arg) @@ -213,12 +197,6 @@ void *sock_server_thread(void *arg)
213 gpio_clear(LED2_PIN); 197 gpio_clear(LED2_PIN);
214 gpio_set(LED0_PIN); 198 gpio_set(LED0_PIN);
215 timer_set(TIMER_DEV(1),0,25200); 199 timer_set(TIMER_DEV(1),0,25200);
216 - /* if (sntp_sync(&server, SOCK_NO_TIMEOUT) < 0) {  
217 - * puts("Error in synchronization");  
218 - * return NULL;  
219 - }  
220 - offset = sntp_get_offset();  
221 - printf("offset : %i\n",(int)offset);*/  
222 timer_run = 1; 200 timer_run = 1;
223 } 201 }
224 } 202 }
@@ -426,10 +404,7 @@ static void _init_interface(void) @@ -426,10 +404,7 @@ static void _init_interface(void)
426 404
427 static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; 405 static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
428 406
429 -extern int udp_cmd(int argc, char **argv);  
430 -  
431 static const shell_command_t shell_commands[] = { 407 static const shell_command_t shell_commands[] = {
432 - { "udp", "send data over UDP and listen on UDP ports", udp_cmd },  
433 { NULL, NULL, NULL } 408 { NULL, NULL, NULL }
434 }; 409 };
435 410
RIOT/sys/net/application_layer/sntp/sntp.c
@@ -63,7 +63,7 @@ int sntp_sync(sock_udp_ep_t *server, uint32_t timeout) @@ -63,7 +63,7 @@ int sntp_sync(sock_udp_ep_t *server, uint32_t timeout)
63 if ((result = (int)sock_udp_recv(&_sntp_sock, 63 if ((result = (int)sock_udp_recv(&_sntp_sock,
64 &_sntp_packet, 64 &_sntp_packet,
65 sizeof(_sntp_packet), 65 sizeof(_sntp_packet),
66 - SOCK_NO_TIMEOUT, 66 + timeout,
67 NULL)) < 0) { 67 NULL)) < 0) {
68 DEBUG("Error receiving message\n"); 68 DEBUG("Error receiving message\n");
69 sock_udp_close(&_sntp_sock); 69 sock_udp_close(&_sntp_sock);
RIOT/sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c
@@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
16 #include <inttypes.h> 16 #include <inttypes.h>
17 #include <stdbool.h> 17 #include <stdbool.h>
18 18
  19 +#include "board.h"
  20 +#include "periph_conf.h"
19 #include "byteorder.h" 21 #include "byteorder.h"
20 #include "cpu_conf.h" 22 #include "cpu_conf.h"
21 #include "kernel_types.h" 23 #include "kernel_types.h"
@@ -923,7 +925,7 @@ static void _receive(gnrc_pktsnip_t *pkt) @@ -923,7 +925,7 @@ static void _receive(gnrc_pktsnip_t *pkt)
923 gnrc_pktsnip_t *reversed_pkt = NULL, *ptr = pkt; 925 gnrc_pktsnip_t *reversed_pkt = NULL, *ptr = pkt;
924 926
925 DEBUG("ipv6: forward packet to next hop\n"); 927 DEBUG("ipv6: forward packet to next hop\n");
926 - // printf ("transmission\n"); 928 + LED1_TOGGLE;
927 /* pkt might not be writable yet, if header was given above */ 929 /* pkt might not be writable yet, if header was given above */
928 ipv6 = gnrc_pktbuf_start_write(ipv6); 930 ipv6 = gnrc_pktbuf_start_write(ipv6);
929 if (ipv6 == NULL) { 931 if (ipv6 == NULL) {
RIOT/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c
@@ -309,7 +309,6 @@ static gnrc_rpl_parent_t *_gnrc_rpl_find_preferred_parent(gnrc_rpl_dodag_t *doda @@ -309,7 +309,6 @@ static gnrc_rpl_parent_t *_gnrc_rpl_find_preferred_parent(gnrc_rpl_dodag_t *doda
309 gnrc_rpl_parent_t *elt, *tmp; 309 gnrc_rpl_parent_t *elt, *tmp;
310 310
311 if (dodag->parents == NULL) { 311 if (dodag->parents == NULL) {
312 - puts("NULL 1");  
313 return NULL; 312 return NULL;
314 } 313 }
315 314
@@ -318,7 +317,6 @@ static gnrc_rpl_parent_t *_gnrc_rpl_find_preferred_parent(gnrc_rpl_dodag_t *doda @@ -318,7 +317,6 @@ static gnrc_rpl_parent_t *_gnrc_rpl_find_preferred_parent(gnrc_rpl_dodag_t *doda
318 } 317 }
319 318
320 if (new_best->rank == GNRC_RPL_INFINITE_RANK) { 319 if (new_best->rank == GNRC_RPL_INFINITE_RANK) {
321 - puts("NULL 2");  
322 return NULL; 320 return NULL;
323 } 321 }
324 322
RIOT/sys/net/gnrc/routing/rpl/of0.c
@@ -54,10 +54,8 @@ uint16_t calc_rank(gnrc_rpl_parent_t *parent, uint16_t base_rank) @@ -54,10 +54,8 @@ uint16_t calc_rank(gnrc_rpl_parent_t *parent, uint16_t base_rank)
54 { 54 {
55 if (base_rank == 0) { 55 if (base_rank == 0) {
56 if (parent == NULL) { 56 if (parent == NULL) {
57 - puts("pas parent");  
58 return GNRC_RPL_INFINITE_RANK; 57 return GNRC_RPL_INFINITE_RANK;
59 } 58 }
60 - //puts("if1");  
61 base_rank = parent->rank; 59 base_rank = parent->rank;
62 60
63 } 61 }
@@ -65,26 +63,21 @@ uint16_t calc_rank(gnrc_rpl_parent_t *parent, uint16_t base_rank) @@ -65,26 +63,21 @@ uint16_t calc_rank(gnrc_rpl_parent_t *parent, uint16_t base_rank)
65 uint16_t add; 63 uint16_t add;
66 64
67 if (parent != NULL) { 65 if (parent != NULL) {
68 - //puts("if2");  
69 - //add = parent->dodag->instance->min_hop_rank_inc;  
70 /*******************************************************************/ 66 /*******************************************************************/
71 //ADDED BY PFE7 2017 67 //ADDED BY PFE7 2017
72 68
73 add = 256 - (parent->mc.rssi + parent->mc.lqi)/10; 69 add = 256 - (parent->mc.rssi + parent->mc.lqi)/10;
74 parent->dodag->instance->min_hop_rank_inc=add; 70 parent->dodag->instance->min_hop_rank_inc=add;
75 - //printf("add= %u\n",add);  
76 71
77 //\ADDED BY PFE7 2017 72 //\ADDED BY PFE7 2017
78 /*******************************************************************/ 73 /*******************************************************************/
79 } 74 }
80 else { 75 else {
81 - puts("else1");  
82 add = GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE; 76 add = GNRC_RPL_DEFAULT_MIN_HOP_RANK_INCREASE;
83 77
84 } 78 }
85 79
86 if ((base_rank + add) < base_rank) { 80 if ((base_rank + add) < base_rank) {
87 - puts("b_r + add < br");  
88 return GNRC_RPL_INFINITE_RANK; 81 return GNRC_RPL_INFINITE_RANK;
89 } 82 }
90 return base_rank + add; 83 return base_rank + add;