From 5003aca5c76ded416d459103bddd9a8d0707ec6e Mon Sep 17 00:00:00 2001 From: Harald Pichler Date: Wed, 20 Sep 2017 11:17:46 +0200 Subject: [PATCH] add settings manager --- examples/osd/arduino-climate/Makefile | 2 ++ .../arduino-climate/arduino-merkurbaord.geany | 2 +- examples/osd/arduino-climate/project-conf.h | 33 +++++-------------- examples/osd/arduino-climate/sketch.pde | 14 ++++++-- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/examples/osd/arduino-climate/Makefile b/examples/osd/arduino-climate/Makefile index 846b97bf2..3fae35b09 100644 --- a/examples/osd/arduino-climate/Makefile +++ b/examples/osd/arduino-climate/Makefile @@ -10,6 +10,7 @@ CONTIKI=../../../../osd-contiki CONTIKI_WITH_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" +CFLAGS += -DCONTIKI_CONF_SETTINGS_MANAGER=1 LFLAGS += -lm PROJECT_SOURCEFILES += ${SKETCH}.cpp Adafruit_HTU21DF.cpp @@ -45,6 +46,7 @@ SMALL=1 # REST Engine shall use Erbium CoAP implementation APPS += er-coap APPS += rest-engine +APPS += serial-shell APPS += arduino include $(CONTIKI)/Makefile.include diff --git a/examples/osd/arduino-climate/arduino-merkurbaord.geany b/examples/osd/arduino-climate/arduino-merkurbaord.geany index 47f4bda61..1eaf70621 100644 --- a/examples/osd/arduino-climate/arduino-merkurbaord.geany +++ b/examples/osd/arduino-climate/arduino-merkurbaord.geany @@ -24,7 +24,7 @@ long_line_column=72 [files] current_page=0 -FILE_NAME_0=0;C++;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-merkurboard%2Fsketch.pde;0;4 +FILE_NAME_0=1877;C++;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-climate%2Fsketch.pde;0;4 [VTE] last_dir=/home/harald diff --git a/examples/osd/arduino-climate/project-conf.h b/examples/osd/arduino-climate/project-conf.h index b52067590..0507b068b 100644 --- a/examples/osd/arduino-climate/project-conf.h +++ b/examples/osd/arduino-climate/project-conf.h @@ -36,9 +36,10 @@ //#define PLATFORM_HAS_BUTTON 1 #define PLATFORM_HAS_BATTERY 1 -#define SICSLOWPAN_CONF_FRAG 1 -#define LOOP_INTERVAL (30 * CLOCK_SECOND) +#define LOOP_INTERVAL (20 * CLOCK_SECOND) + +//#define SETTINGS_MAX_SIZE 255 /* Save energy */ //#define RDC_CONF_PT_YIELD_OFF @@ -49,12 +50,14 @@ /* Disabling RDC for demo purposes. Core updates often require more memory. */ /* For projects, optimize memory and enable RDC again. */ -// #undef NETSTACK_CONF_RDC +//#undef NETSTACK_CONF_RDC //#define NETSTACK_CONF_RDC nullrdc_driver +//#undef NETSTACK_CONF_MAC +//#define NETSTACK_CONF_MAC nullmac_driver /* Increase rpl-border-router IP-buffer when using more than 64. */ -#undef REST_MAX_CHUNK_SIZE -#define REST_MAX_CHUNK_SIZE 64 +//#undef REST_MAX_CHUNK_SIZE +//#define REST_MAX_CHUNK_SIZE 64 /* Estimate your header size, especially when using Proxy-Uri. */ /* @@ -65,7 +68,7 @@ /* The IP buffer size must fit all other hops, in particular the border router. */ #undef UIP_CONF_BUFFER_SIZE -#define UIP_CONF_BUFFER_SIZE 256 +#define UIP_CONF_BUFFER_SIZE 192 /* Multiplies with chunk size, be aware of memory constraints. */ @@ -84,23 +87,5 @@ #define COAP_LINK_FORMAT_FILTERING 0 */ -/* Save some memory for the sky platform. */ -/* -#undef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 10 -#undef UIP_CONF_MAX_ROUTES -#define UIP_CONF_MAX_ROUTES 10 -*/ - -/* Reduce 802.15.4 frame queue to save RAM. */ -/* -#undef QUEUEBUF_CONF_NUM -#define QUEUEBUF_CONF_NUM 4 -*/ - -/* -#undef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -*/ #endif /* PROJECT_RPL_WEB_CONF_H_ */ diff --git a/examples/osd/arduino-climate/sketch.pde b/examples/osd/arduino-climate/sketch.pde index b8ce34ae6..9a7581562 100644 --- a/examples/osd/arduino-climate/sketch.pde +++ b/examples/osd/arduino-climate/sketch.pde @@ -16,6 +16,9 @@ extern "C" { #include "arduino-process.h" #include "rest-engine.h" +#include "net/netstack.h" +#include "serial-shell.h" +#include "shell-merkur.h" Adafruit_HTU21DF htu = Adafruit_HTU21DF(); @@ -33,6 +36,9 @@ void setup (void) // switch off the led pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH); + // Seriell Shell + serial_shell_init(); + shell_merkur_init(); // htu21d sensor if (!htu.begin()) { printf("Couldn't find sensor!"); @@ -44,19 +50,21 @@ void setup (void) rest_activate_resource (&res_htu21dhum, "s/hum"); rest_activate_resource (&res_battery, "s/battery"); #pragma GCC diagnostic pop - mcu_sleep_set(128); // Power consumtion 278uA; average over 20 minutes +// mcu_sleep_set(128); // Power consumtion 278uA; average over 20 minutes } // at project-conf.h // LOOP_INTERVAL (30 * CLOCK_SECOND) void loop (void) { + htu21d_temp = htu.readTemperature(); htu21d_hum = htu.readHumidity(); dtostrf(htu21d_temp , 0, 2, htu21d_temp_s ); dtostrf(htu21d_hum , 0, 2, htu21d_hum_s ); // debug only -// printf("Temp: '%s'",htu21d_temp_s); -// printf("\t\tHum: '%s'\n",htu21d_hum_s); +// printf("Temp: '%s'",htu21d_temp_s); +// printf("\t\tHum: '%s'\n",htu21d_hum_s); + }