mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-08-09 17:25:00 +00:00
updated to new sensors API
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: shell-sky.c,v 1.15 2010/02/18 20:56:12 adamdunkels Exp $
|
* $Id: shell-sky.c,v 1.16 2010/03/14 19:54:00 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,10 +46,10 @@
|
|||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
|
#include "dev/sht11.h"
|
||||||
#include "dev/light-sensor.h"
|
#include "dev/light-sensor.h"
|
||||||
#include "dev/battery-sensor.h"
|
#include "dev/battery-sensor.h"
|
||||||
#include "dev/sht11.h"
|
#include "dev/sht11-sensor.h"
|
||||||
|
|
||||||
#include "net/rime/timesynch.h"
|
#include "net/rime/timesynch.h"
|
||||||
|
|
||||||
#include "node-id.h"
|
#include "node-id.h"
|
||||||
@@ -141,6 +141,10 @@ PROCESS_THREAD(shell_sense_process, ev, data)
|
|||||||
struct sense_msg msg;
|
struct sense_msg msg;
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
SENSORS_ACTIVATE(light_sensor);
|
||||||
|
SENSORS_ACTIVATE(battery_sensor);
|
||||||
|
SENSORS_ACTIVATE(sht11_sensor);
|
||||||
|
|
||||||
msg.len = 7;
|
msg.len = 7;
|
||||||
msg.clock = clock_time();
|
msg.clock = clock_time();
|
||||||
#if TIMESYNCH_CONF_ENABLED
|
#if TIMESYNCH_CONF_ENABLED
|
||||||
@@ -148,13 +152,19 @@ PROCESS_THREAD(shell_sense_process, ev, data)
|
|||||||
#else /* TIMESYNCH_CONF_ENABLED */
|
#else /* TIMESYNCH_CONF_ENABLED */
|
||||||
msg.timesynch_time = 0;
|
msg.timesynch_time = 0;
|
||||||
#endif /* TIMESYNCH_CONF_ENABLED */
|
#endif /* TIMESYNCH_CONF_ENABLED */
|
||||||
msg.light1 = light_sensor.value(0);
|
msg.light1 = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC);
|
||||||
msg.light2 = light_sensor.value(1);
|
msg.light2 = light_sensor.value(LIGHT_SENSOR_TOTAL_SOLAR);
|
||||||
msg.temp = sht11_temp();
|
msg.temp = sht11_sensor.value(SHT11_SENSOR_TEMP);
|
||||||
msg.humidity = sht11_humidity();
|
msg.humidity = sht11_sensor.value(SHT11_SENSOR_HUMIDITY);
|
||||||
msg.rssi = do_rssi();
|
msg.rssi = do_rssi();
|
||||||
msg.voltage = battery_sensor.value(0);
|
msg.voltage = battery_sensor.value(0);
|
||||||
|
|
||||||
|
msg.rssi = do_rssi();
|
||||||
|
|
||||||
|
SENSORS_DEACTIVATE(light_sensor);
|
||||||
|
SENSORS_DEACTIVATE(battery_sensor);
|
||||||
|
SENSORS_DEACTIVATE(sht11_sensor);
|
||||||
|
|
||||||
shell_output(&sense_command, &msg, sizeof(msg), "", 0);
|
shell_output(&sense_command, &msg, sizeof(msg), "", 0);
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user