From 259827b031e650ea47a8f896e9bff851c000994d Mon Sep 17 00:00:00 2001 From: Marcus Priesch Date: Thu, 5 Oct 2017 16:45:30 +0200 Subject: [PATCH 1/5] added coap:// links for firefox copper plugin --- .../osd/rpl-border-router/border-router.c | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/examples/osd/rpl-border-router/border-router.c b/examples/osd/rpl-border-router/border-router.c index 5e5717d90..bb44ac3f8 100644 --- a/examples/osd/rpl-border-router/border-router.c +++ b/examples/osd/rpl-border-router/border-router.c @@ -89,6 +89,11 @@ AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process); #define BUF_USES_STACK 1 #endif +#define WEBSERVER_CONF_COPPER_LINKS 1 +#if WEBSERVER_CONF_COPPER_LINKS +#define BUF_USES_STACK 1 +#endif + PROCESS(webserver_nogui_process, "Web server"); PROCESS_THREAD(webserver_nogui_process, ev, data) { @@ -247,11 +252,39 @@ PT_THREAD(generate_routes(struct httpd_state *s)) ADD("/%u (via ", r->length); ipaddr_add(uip_ds6_route_nexthop(r)); if(1 || (r->state.lifetime < 600)) { - ADD(") %lus\n", (unsigned long)r->state.lifetime); + ADD(") %lus", (unsigned long)r->state.lifetime); } else { - ADD(")\n"); + ADD(")"); } SEND_STRING(&s->sout, buf); + +#if BUF_USES_STACK + bufptr = buf; bufend = bufptr + sizeof(buf); +#else + blen = 0; +#endif + +#if BUF_USES_STACK +#if WEBSERVER_CONF_COPPER_LINKS + ADD(" -> ipaddr); + ADD("]\" target=\"_new\">copper"); + ADD(""); +#endif +#else +#if WEBSERVER_CONF_COPPER_LINKS + ADD(" -> ipaddr); + ADD("]\" target=\"_new\">copper"); + SEND_STRING(&s->sout, buf); //TODO: why tunslip6 needs an output here, wpcapslip does not + blen = 0; + ADD(""); +#endif +#endif + + ADD("\n"); + SEND_STRING(&s->sout, buf); + #if BUF_USES_STACK bufptr = buf; bufend = bufptr + sizeof(buf); #else @@ -267,7 +300,7 @@ PT_THREAD(generate_routes(struct httpd_state *s)) #if WEBSERVER_CONF_LOADTIME numticks = clock_time() - numticks + 1; - ADD(" (%u.%02u sec)",numticks/CLOCK_SECOND,(100*(numticks%CLOCK_SECOND))/CLOCK_SECOND)); + ADD(" (%u.%02u sec)",numticks/CLOCK_SECOND,(100*(numticks%CLOCK_SECOND))/CLOCK_SECOND); #endif SEND_STRING(&s->sout, buf); From 86596ac92f79b75ff00dde5ebb252a34c876be4b Mon Sep 17 00:00:00 2001 From: Marcus Priesch Date: Thu, 5 Oct 2017 16:53:26 +0200 Subject: [PATCH 2/5] moved to apps folder --- apps/ota-update/Makefile.ota-update | 1 + apps/ota-update/ota-update.h | 22 ++++ .../osd => apps}/ota-update/res_bootloader.c | 0 apps/ota-update/res_reboot.c | 108 ++++++++++++++++++ .../ota-update/res_upload_image.c | 0 examples/osd/ota-update/Makefile | 15 ++- examples/osd/ota-update/README.rst | 8 +- examples/osd/ota-update/resources.h | 8 -- examples/osd/ota-update/sketch.pde | 24 +--- 9 files changed, 155 insertions(+), 31 deletions(-) create mode 100644 apps/ota-update/Makefile.ota-update create mode 100644 apps/ota-update/ota-update.h rename {examples/osd => apps}/ota-update/res_bootloader.c (100%) create mode 100644 apps/ota-update/res_reboot.c rename {examples/osd => apps}/ota-update/res_upload_image.c (100%) delete mode 100644 examples/osd/ota-update/resources.h diff --git a/apps/ota-update/Makefile.ota-update b/apps/ota-update/Makefile.ota-update new file mode 100644 index 000000000..061395baf --- /dev/null +++ b/apps/ota-update/Makefile.ota-update @@ -0,0 +1 @@ +ota-update_src = res_bootloader.c res_reboot.c res_upload_image.c diff --git a/apps/ota-update/ota-update.h b/apps/ota-update/ota-update.h new file mode 100644 index 000000000..584a7fc07 --- /dev/null +++ b/apps/ota-update/ota-update.h @@ -0,0 +1,22 @@ +extern resource_t res_upload_image; +extern resource_t res_part_count; +extern resource_t res_part_size; +extern resource_t res_boot_default; +extern resource_t res_boot_next; +extern resource_t res_active_part; +extern resource_t res_part_start; +extern resource_t res_part_ok; +extern resource_t res_reboot; + +#define OTA_ACTIVATE_RESOURCES() \ + static char resname[] = "ota/update";\ + rest_activate_resource (&res_upload_image, resname);\ + rest_activate_resource (&res_part_count, (char *)"ota/part_count");\ + rest_activate_resource (&res_part_size, (char *)"ota/part_size");\ + rest_activate_resource (&res_boot_default, (char *)"ota/boot_default");\ + rest_activate_resource (&res_boot_next, (char *)"ota/boot_next");\ + rest_activate_resource (&res_active_part, (char *)"ota/active_part");\ + rest_activate_resource (&res_part_start, (char *)"ota/part_start");\ + rest_activate_resource (&res_part_ok, (char *)"ota/part_ok");\ + rest_activate_resource (&res_reboot, (char *)"ota/reboot"); + diff --git a/examples/osd/ota-update/res_bootloader.c b/apps/ota-update/res_bootloader.c similarity index 100% rename from examples/osd/ota-update/res_bootloader.c rename to apps/ota-update/res_bootloader.c diff --git a/apps/ota-update/res_reboot.c b/apps/ota-update/res_reboot.c new file mode 100644 index 000000000..f7c6b69d4 --- /dev/null +++ b/apps/ota-update/res_reboot.c @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2017, Marcus Priesch Open Source Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the Contiki operating system. + */ + +/** + * \file + * Reboot ressource + * \author + * Marcus Priesch + */ + +#include +#include +#include "contiki.h" +#include "er-coap-engine.h" +#include "generic_resource.h" +#include "dev/watchdog.h" + +PROCESS(reboot_process, "reboot"); +PROCESS_THREAD(reboot_process, ev, data) +{ + static struct etimer etimer; + + //PROCESS_EXITHANDLER(leds_off(LEDS_ALL);) + + PROCESS_BEGIN(); + + //shell_output_str(&reboot_command, + // "Rebooting the node in four seconds...", ""); + + etimer_set(&etimer, CLOCK_SECOND * 4); + PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); + //leds_on(LEDS_RED); + //etimer_reset(&etimer); + //PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); + //leds_on(LEDS_GREEN); + //etimer_reset(&etimer); + //PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); + //leds_on(LEDS_BLUE); + //etimer_reset(&etimer); + //PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); + + watchdog_reboot(); + + PROCESS_END(); +} + + + +static size_t +get_reboot + ( const char *name + , const char *uri + , const char *query + , char *buf + , size_t bsize + ) +{ + return snprintf (buf, bsize, "put 'OK' to reboot."); +} + +static int +do_reboot + (const char *name, const char *uri, const char *query, const char *s) +{ + if (strncmp (s, "OK", 2) == 0) { + process_start (&reboot_process, NULL); + return 0; + } + return 0; +} + +GENERIC_RESOURCE + ( reboot + , Reboot node + , count + , 0 + , do_reboot + , get_reboot + ); + diff --git a/examples/osd/ota-update/res_upload_image.c b/apps/ota-update/res_upload_image.c similarity index 100% rename from examples/osd/ota-update/res_upload_image.c rename to apps/ota-update/res_upload_image.c diff --git a/examples/osd/ota-update/Makefile b/examples/osd/ota-update/Makefile index 4554248a0..7015ca0f6 100644 --- a/examples/osd/ota-update/Makefile +++ b/examples/osd/ota-update/Makefile @@ -11,7 +11,18 @@ CONTIKI_WITH_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -PROJECT_SOURCEFILES += res_upload_image.c res_bootloader.c ${SKETCH}.cpp +PROJECT_SOURCEFILES += ${SKETCH}.cpp + +# automatically build RESTful resources +REST_RESOURCES_DIR = ./resources +REST_RESOURCES_DIR_COMMON = ../resources-common +REST_RESOURCES_FILES= $(notdir \ + $(shell find $(REST_RESOURCES_DIR) -name '*.c') \ + $(shell find $(REST_RESOURCES_DIR_COMMON) -name '*.c') \ + ) + +PROJECTDIRS += $(REST_RESOURCES_DIR) $(REST_RESOURCES_DIR_COMMON) +PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES) # variable for Makefile.include ifneq ($(TARGET), minimal-net) @@ -33,7 +44,7 @@ SMALL=1 # REST Engine shall use Erbium CoAP implementation APPS += er-coap APPS += rest-engine -APPS += arduino json-resource json #time +APPS += arduino json-resource json ota-update include $(CONTIKI)/Makefile.include include $(CONTIKI)/apps/arduino/Makefile.include diff --git a/examples/osd/ota-update/README.rst b/examples/osd/ota-update/README.rst index 0439a8e5a..0697b7a65 100644 --- a/examples/osd/ota-update/README.rst +++ b/examples/osd/ota-update/README.rst @@ -101,8 +101,14 @@ that are not kept in the directory: - ``/part_start``: This resource needs an additional query-parameter indicating the partition number, e.g., ``/part_start?part=1`` and returns the partition start address in flash. -- ``active_part``: The partition that is currently booted. +- ``/active_part``: The partition that is currently booted. +How to use in your own code +=========================== + +- add app "ota-update" to the Makefile +- add #include "ota-update.h" +- add OTA_ACTIVATE_RESOURCES() to your code to activate the resources Security ======== diff --git a/examples/osd/ota-update/resources.h b/examples/osd/ota-update/resources.h deleted file mode 100644 index 0477252f0..000000000 --- a/examples/osd/ota-update/resources.h +++ /dev/null @@ -1,8 +0,0 @@ -extern resource_t res_upload_image; -extern resource_t res_part_count; -extern resource_t res_part_size; -extern resource_t res_boot_default; -extern resource_t res_boot_next; -extern resource_t res_active_part; -extern resource_t res_part_start; -extern resource_t res_part_ok; diff --git a/examples/osd/ota-update/sketch.pde b/examples/osd/ota-update/sketch.pde index cfc78d356..7990fef6b 100644 --- a/examples/osd/ota-update/sketch.pde +++ b/examples/osd/ota-update/sketch.pde @@ -1,35 +1,19 @@ /* - * Gardena 9V Magnet-Valve - * We have a CoAP Resource for the Valve, it can be in state 1 (on) and - * 0 (off). - * Transition on-off outputs a negative pulse - * Transition off-on outputs a positive pulse + * Simple example with ota-update only */ extern "C" { -#include -#include "contiki.h" -#include "contiki-net.h" #include "er-coap.h" -#include "resources.h" -char resname[] = "update"; +#include "ota-update.h" } - void setup (void) { rest_init_engine (); - rest_activate_resource (&res_upload_image, resname); - rest_activate_resource (&res_part_count, (char *)"part_count"); - rest_activate_resource (&res_part_size, (char *)"part_size"); - rest_activate_resource (&res_boot_default, (char *)"boot_default"); - rest_activate_resource (&res_boot_next, (char *)"boot_next"); - rest_activate_resource (&res_active_part, (char *)"active_part"); - rest_activate_resource (&res_part_start, (char *)"part_start"); - rest_activate_resource (&res_part_ok, (char *)"part_ok"); + OTA_ACTIVATE_RESOURCES(); } void loop (void) { - printf ("Hello\n"); + printf ("just sitting round and waiting for ota update\n"); } From 8c82ce0722c306f6ea26a767409aa0928f5754fc Mon Sep 17 00:00:00 2001 From: Marcus Priesch Date: Thu, 5 Oct 2017 16:56:10 +0200 Subject: [PATCH 3/5] fixed some issues, added ota-update --- examples/osd/arduino-windsonic/Makefile | 2 +- examples/osd/arduino-windsonic/project-conf.h | 13 +-- examples/osd/arduino-windsonic/sketch.pde | 104 +++++++++++------- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/examples/osd/arduino-windsonic/Makefile b/examples/osd/arduino-windsonic/Makefile index 5879b69f0..015fba7f1 100644 --- a/examples/osd/arduino-windsonic/Makefile +++ b/examples/osd/arduino-windsonic/Makefile @@ -46,7 +46,7 @@ SMALL=1 # REST Engine shall use Erbium CoAP implementation APPS += er-coap APPS += rest-engine -APPS += arduino +APPS += arduino json-resource json ota-update include $(CONTIKI)/Makefile.include include $(CONTIKI)/apps/arduino/Makefile.include diff --git a/examples/osd/arduino-windsonic/project-conf.h b/examples/osd/arduino-windsonic/project-conf.h index 0c0cbd254..aa9da9cea 100644 --- a/examples/osd/arduino-windsonic/project-conf.h +++ b/examples/osd/arduino-windsonic/project-conf.h @@ -32,24 +32,13 @@ #ifndef PROJECT_RPL_WEB_CONF_H_ #define PROJECT_RPL_WEB_CONF_H_ - -#ifdef IEEE802154_CONF_PANID -#undef IEEE802154_CONF_PANID -#define IEEE802154_CONF_PANID 0xA001 // default panid -#endif // IEEE802154_CONF_PANID - -#ifdef CHANNEL_802_15_4 -#undef CHANNEL_802_15_4 -#define CHANNEL_802_15_4 25 // default frequency (11-26) -#endif - //#define PLATFORM_HAS_LEDS 1 //#define PLATFORM_HAS_BUTTON 1 //#define PLATFORM_HAS_BATTERY 1 #define SICSLOWPAN_CONF_FRAG 1 -#define LOOP_INTERVAL (CLOCK_SECOND) +#define LOOP_INTERVAL (CLOCK_SECOND/4) #define WIND_SPEEDS 30 /* Save energy */ diff --git a/examples/osd/arduino-windsonic/sketch.pde b/examples/osd/arduino-windsonic/sketch.pde index de1f7c1ac..a9f810590 100644 --- a/examples/osd/arduino-windsonic/sketch.pde +++ b/examples/osd/arduino-windsonic/sketch.pde @@ -13,45 +13,65 @@ extern "C" { #include #include "arduino-process.h" #include "rest-engine.h" +#include "resources.h" +#include "ota-update.h" -extern resource_t res_wind, res_wind_speed_max, res_wind_status, - res_wind_speed, res_wind_direction, res_power_supply; +#define DEBUG 0 + +#if DEBUG +#include +#define PRINTF(...) printf(__VA_ARGS__) +#else +#define PRINTF(...) +#endif + +extern resource_t + res_wind, + res_wind_speed_max, + res_wind_status, + res_wind_speed, + res_wind_direction, + res_power_supply; #define STX 0x02 #define ETX 0x03 #define STRING_TERMINATOR 0x00 #define LED_PIN 4 + } -int state = 0; -char ws_status [32]; -int ws_speed_hi = 0; -int ws_speed_lo = 0; -char ws_unit [8]; -int ws_direction = 0; +int state = 0; +char ws_status [32]; +int ws_speed_hi = 0; +int ws_speed_lo = 0; +char ws_unit [8]; +int ws_direction = 0; int supply_voltage_hi = 0; -int supply_voltage_lo = 0; -int ws_max_speed = 0; -int ws_max_speed_lo = 0; -int ws_max_speed_hi = 0; +int supply_voltage_lo = 0; +int ws_max_speed = 0; +int ws_max_speed_lo = 0; +int ws_max_speed_hi = 0; int wind_speeds [WIND_SPEEDS]; // every 2 seconds we get a value int wind_speed_idx = 0; uint32_t idx; +int d, count, msg_length, state0_counter = 0; +unsigned char msg_buffer [128], checksum_buffer [3], checksum; + void set_no_data (void) { - printf ("set no data\n"); + PRINTF ("set no data\n"); strcpy (ws_status, "No data from sensor"); - ws_speed_lo = 000; - ws_speed_hi = 000; - ws_direction = 000; - ws_max_speed = 0; + ws_speed_lo = 0; + ws_speed_hi = 0; + ws_direction = 0; + ws_max_speed = 0; ws_max_speed_hi = 0; ws_max_speed_lo = 0; - wind_speed_idx = 0; + wind_speed_idx = 0; strcpy (ws_unit, ""); for (idx = 0; idx < WIND_SPEEDS; idx++) @@ -71,15 +91,16 @@ void setup (void) rest_init_engine (); #pragma GCC diagnostic ignored "-Wwrite-strings" - rest_activate_resource (&res_wind, "s/wind"); - rest_activate_resource (&res_wind_speed, "s/wind_speed"); + rest_activate_resource (&res_wind, "s/wind"); + rest_activate_resource (&res_wind_speed, "s/wind_speed"); rest_activate_resource (&res_wind_speed_max, "s/wind_speed_max"); rest_activate_resource (&res_wind_direction, "s/wind_direction"); - rest_activate_resource (&res_wind_status, "s/wind_status"); - rest_activate_resource (&res_power_supply, "s/power_supply"); + rest_activate_resource (&res_wind_status, "s/wind_status"); + rest_activate_resource (&res_power_supply, "s/power_supply"); + OTA_ACTIVATE_RESOURCES(); #pragma GCC diagnostic pop - //mcu_sleep_set(128); // Power consumtion 278uA; average over 20 minutes + mcu_sleep_set(0); // Power consumtion 278uA; average over 20 minutes Serial1.begin (9600); set_no_data (); @@ -87,14 +108,10 @@ void setup (void) void loop (void) { - static int d, count, msg_length, state0_counter = 0; - static unsigned char msg_buffer [128], checksum_buffer [3], checksum; - - printf ("state = %d", state); - switch (state) { case 0 : - printf ("state0\n"); + PRINTF ("state0\n"); + strcpy (ws_status, "0"); state0_counter ++; if (state0_counter > 10) { set_no_data (); @@ -103,7 +120,7 @@ void loop (void) // wait for stx while (Serial1.available () > 0) { d = Serial1.read (); - printf ("%d ", d); + PRINTF ("%d ", d); if (d == STX) { state = 1; count = 0; @@ -114,13 +131,14 @@ void loop (void) break; case 1 : - printf ("state1\n"); + PRINTF ("state1\n"); + strcpy (ws_status, "1"); state0_counter = 0; // wait for etx and read message while (Serial1.available () > 0) { d = Serial1.read (); - printf ("%d ", d); + PRINTF ("%d ", d); if (d == ETX) { msg_length = count; msg_buffer [count] = STRING_TERMINATOR; @@ -137,16 +155,17 @@ void loop (void) } } } - if (state == 1) + if (state == 1 || state == 0) break; case 2 : - printf ("state2\n"); + PRINTF ("state2\n"); + strcpy (ws_status, "2"); // read checksum while (Serial1.available () > 0) { d = Serial1.read (); - printf ("%d ", d); - printf (" %d (%d)\n", d, count); + PRINTF ("%d ", d); + PRINTF (" %d (%d)\n", d, count); checksum_buffer [count] = (unsigned char) (d & 0xff); count ++; if (count == 2) { @@ -162,7 +181,8 @@ void loop (void) unsigned int checksum_rx; int cnt; - printf ("state3\n"); + PRINTF ("state3\n"); + strcpy (ws_status, "3"); // calc and compare checksum checksum = 0; sscanf ((const char*)checksum_buffer, "%2X", &checksum_rx); @@ -171,7 +191,8 @@ void loop (void) } if (checksum_rx != checksum) { - printf ("checksum mismatch %02x != %02x\n", checksum, checksum_rx); + PRINTF ("checksum mismatch %02x != %02x\n", checksum, checksum_rx); + sprintf (ws_status, "CS: %02x!=%02x,%s", checksum, checksum_rx,msg_buffer); state = 0; break; } else { @@ -183,8 +204,9 @@ void loop (void) char unit [1]; int status; - printf ("state4\n"); - printf ("parse messge: %s\n", msg_buffer); + PRINTF ("state4\n"); + strcpy (ws_status, "4"); + PRINTF ("parse messge: %s\n", msg_buffer); sscanf ( (const char*) msg_buffer , "Q,%3d,%3d.%2d,%c,%2d" @@ -257,7 +279,7 @@ void loop (void) ws_max_speed_lo = ws_max_speed % 100; ws_max_speed_hi = ws_max_speed / 100; - printf ("speed: %d.%02d %s, dir: %d, status: %s, max: %d.%02d\n" + PRINTF ("speed: %d.%02d %s, dir: %d, status: %s, max: %d.%02d\n" , ws_speed_hi, ws_speed_lo, ws_unit, ws_direction, ws_status , ws_max_speed_hi, ws_max_speed_lo); From 54b72dcf642012009a108d35e8152473f19925c2 Mon Sep 17 00:00:00 2001 From: Marcus Priesch Date: Thu, 5 Oct 2017 16:57:01 +0200 Subject: [PATCH 4/5] update --- examples/osd/ota-update/README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/osd/ota-update/README.rst b/examples/osd/ota-update/README.rst index 0697b7a65..0e1d5cacc 100644 --- a/examples/osd/ota-update/README.rst +++ b/examples/osd/ota-update/README.rst @@ -106,9 +106,13 @@ that are not kept in the directory: How to use in your own code =========================== -- add app "ota-update" to the Makefile -- add #include "ota-update.h" -- add OTA_ACTIVATE_RESOURCES() to your code to activate the resources +- add app ``ota-update`` (and possibly ``json`` and ``json-resource``) + to your Makefile +- add ``#include "ota-update.h"`` to your source file +- add ``OTA_ACTIVATE_RESOURCES();`` to your code to activate the + resources + +All above described resources are prefixed with ``ota/``. Security ======== From 233cb02993f24f7e04ae1bd6a1504d56ed9161a6 Mon Sep 17 00:00:00 2001 From: Marcus Priesch Date: Thu, 5 Oct 2017 17:01:09 +0200 Subject: [PATCH 5/5] enabled rpl mesh routing --- platform/osd-merkur-256/contiki-conf.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/platform/osd-merkur-256/contiki-conf.h b/platform/osd-merkur-256/contiki-conf.h index 273d0557a..dc2c0ae43 100644 --- a/platform/osd-merkur-256/contiki-conf.h +++ b/platform/osd-merkur-256/contiki-conf.h @@ -315,6 +315,25 @@ typedef unsigned short uip_stats_t; #define CC_CONF_INLINE inline #endif +/* mpr: avr-gcc 5.4.0 on gentoo needs this */ +#ifndef DDRE5 +#define DDRE5 DDE5 +#endif + +/* mpr: next is for having rpl mesh-networking working */ +#if 1 +//#define RPL_CONF_DEFAULT_LIFETIME 5 +#define RPL_CONF_WITH_MC 1 +//#define RPL_CONF_WITH_DAO_ACK 1 +//#define RPL_CONF_RPL_REPAIR_ON_DAO_NACK 1 +#define RPL_CONF_DIO_REFRESH_DAO_ROUTES 1 +#define RPL_CONF_WITH_PROBING 1 +#define RPL_MRHOF_CONF_SQUARED_ETX 1 +#define RPL_CONF_DAG_MC RPL_DAG_MC_ETX + +#define LINK_STATS_CONF_INIT_ETX(stats) guess_etx_from_rssi(stats) +#endif + /* include the project config */ /* PROJECT_CONF_H might be defined in the project Makefile */ #ifdef PROJECT_CONF_H