add settings manager

This commit is contained in:
Harald Pichler 2017-09-20 11:17:46 +02:00
parent cfeb8036e0
commit 5003aca5c7
4 changed files with 23 additions and 28 deletions

View file

@ -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

View file

@ -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

View file

@ -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_ */

View file

@ -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,13 +50,14 @@ 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 );
@ -59,4 +66,5 @@ void loop (void)
// debug only
// printf("Temp: '%s'",htu21d_temp_s);
// printf("\t\tHum: '%s'\n",htu21d_hum_s);
}