firebug-cvs Mailing List for FireBug: wireless wildfire monitoring (Page 13)
Brought to you by:
doolin
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(36) |
Jun
(45) |
Jul
(108) |
Aug
(31) |
Sep
(2) |
Oct
(4) |
Nov
(113) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(63) |
Feb
(37) |
Mar
(24) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(71) |
Aug
(42) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(64) |
Jun
(71) |
Jul
(51) |
Aug
(89) |
Sep
(24) |
Oct
(1) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
|
Feb
|
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: David M. D. <do...@us...> - 2005-05-23 22:25:29
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8243/apps/XSensorMTS400 Modified Files: TestMTS400M.nc Log Message: Removed cpp directives for mts420 Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestMTS400M.nc 23 May 2005 22:09:52 -0000 1.4 --- TestMTS400M.nc 23 May 2005 22:25:18 -0000 1.5 *************** *** 340,350 **** TOSH_MAKE_FLASH_CLK_OUTPUT(); //usart clk call BattControl.init(); call CommControl.init(); call Leds.init(); - call Leds.greenOn(); - call GpsControl.init(); - call TaosControl.init(); call AccelControl.init(); //initialize accelerometer --- 340,351 ---- TOSH_MAKE_FLASH_CLK_OUTPUT(); //usart clk + + call Leds.greenOn(); + + // Why aren't these all wired into StdControl? call BattControl.init(); call CommControl.init(); call Leds.init(); call GpsControl.init(); call TaosControl.init(); call AccelControl.init(); //initialize accelerometer *************** *** 356,369 **** command result_t StdControl.start() { call HumidityError.enable(); //in case Sensirion doesn't respond ! call TemperatureError.enable(); // same as above ! call CommControl.start(); call BattControl.start(); - - call GpsControl.start(); - atomic state = START; atomic sensor_state= SENSOR_NONE; --- 357,368 ---- command result_t StdControl.start() { + call HumidityError.enable(); //in case Sensirion doesn't respond ! call TemperatureError.enable(); // same as above ! call CommControl.start(); call BattControl.start(); call GpsControl.start(); atomic state = START; atomic sensor_state= SENSOR_NONE; *************** *** 540,543 **** --- 539,543 ---- } + memcpy(&(pack->xData.dataGps),gps_data,63); *************** *** 773,776 **** --- 773,779 ---- return SUCCESS; } + + + /**************************************************************************** *************** *** 787,802 **** sending_packet = FALSE; } ! else ! { ! IsUART = !IsUART; // change to uart send ! atomic { ! WaitingForSend = FALSE; // both uart and radio sent, done for current msg ! sending_packet = FALSE; ! } ! } return SUCCESS; } /**************************************************************************** * Radio msg xmitted. --- 790,808 ---- sending_packet = FALSE; } ! else { ! IsUART = !IsUART; // change to uart send ! atomic { ! WaitingForSend = FALSE; // both uart and radio sent, done for current msg ! sending_packet = FALSE; ! } ! } return SUCCESS; } + + + + /**************************************************************************** * Radio msg xmitted. |
From: David M. D. <do...@us...> - 2005-05-23 22:10:03
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4798/apps/XSensorMTS400 Modified Files: Makefile TestMTS400M.nc appFeatures.h Log Message: Removed cpp directives for mts420 Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestMTS400M.nc 23 May 2005 21:34:37 -0000 1.3 --- TestMTS400M.nc 23 May 2005 22:09:52 -0000 1.4 *************** *** 159,163 **** interface SendMsg as Send; interface ReceiveMsg as Receive; ! #ifdef MTS420 //gps // interface I2CSwitchCmds as GpsCmd; --- 159,163 ---- interface SendMsg as Send; interface ReceiveMsg as Receive; ! //gps // interface I2CSwitchCmds as GpsCmd; *************** *** 168,172 **** interface SendVarLenPacket as GpsSend; interface ReceiveVarLenPacket as GpsReceive; ! #endif // Battery interface ADC as ADCBATT; --- 168,172 ---- interface SendVarLenPacket as GpsSend; interface ReceiveVarLenPacket as GpsReceive; ! // Battery interface ADC as ADCBATT; *************** *** 344,350 **** call Leds.init(); call Leds.greenOn(); ! #ifdef MTS420 call GpsControl.init(); ! #endif call TaosControl.init(); call AccelControl.init(); //initialize accelerometer --- 344,350 ---- call Leds.init(); call Leds.greenOn(); ! call GpsControl.init(); ! call TaosControl.init(); call AccelControl.init(); //initialize accelerometer *************** *** 362,368 **** call BattControl.start(); ! #ifdef MTS420 call GpsControl.start(); ! #endif atomic state = START; --- 362,368 ---- call BattControl.start(); ! call GpsControl.start(); ! atomic state = START; *************** *** 377,384 **** command result_t StdControl.stop() { call BattControl.stop(); ! #ifdef MTS420 call GpsControl.stop(); call GpsCmd.TxRxSwitch(0); ! #endif call Timer.stop(); call CommControl.stop(); --- 377,384 ---- command result_t StdControl.stop() { call BattControl.stop(); ! call GpsControl.stop(); call GpsCmd.TxRxSwitch(0); ! call Timer.stop(); call CommControl.stop(); *************** *** 392,400 **** *****************************************************************************/ event result_t Timer.fired() { uint8_t l_state; call Leds.redToggle(); - #ifdef MTS420 if (!gps_pwr_on){ //turn on GPS power, stays on for entire test --- 392,400 ---- *****************************************************************************/ event result_t Timer.fired() { + uint8_t l_state; call Leds.redToggle(); if (!gps_pwr_on){ //turn on GPS power, stays on for entire test *************** *** 402,406 **** return SUCCESS; } ! #endif atomic l_state = state; --- 402,406 ---- return SUCCESS; } ! atomic l_state = state; *************** *** 422,428 **** * communication, comment following GpsCmd.PowerSwitch(0) line */ - #ifdef MTS420 // if (gps_pwr_on)call GpsCmd.PowerSwitch(0); - #endif post send_msg(); return SUCCESS; --- 422,426 ---- *************** *** 433,444 **** #if FEATURE_GPS_ONLY call Leds.greenOff(); - #ifdef MTS420 atomic state = GPS_BUSY; return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx #else - atomic state = START; - return SUCCESS; - #endif - #else atomic{ state = BUSY; --- 431,437 ---- *************** *** 482,495 **** case ACCEL_DONE: call Leds.greenOff(); - #ifdef MTS420 atomic state = GPS_BUSY; return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx - #else - atomic state = START; - return SUCCESS; - #endif break; ! #ifdef MTS420 case GPS_BUSY: if (gps_wait_cnt >= GPS_MAX_WAIT) --- 475,483 ---- case ACCEL_DONE: call Leds.greenOff(); atomic state = GPS_BUSY; return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx break; ! case GPS_BUSY: if (gps_wait_cnt >= GPS_MAX_WAIT) *************** *** 510,514 **** return SUCCESS; break; ! #endif } return SUCCESS; --- 498,502 ---- return SUCCESS; break; ! } return SUCCESS; *************** *** 516,525 **** ! #ifdef MTS420 /****************************************************************************** * Packet received from GPS - ASCII msg * 1st byte in pkt is number of ascii bytes * async used only for testing ! GGA - Global Positioning System Fix Data GGA,123519,4807.038,N,01131.324,E,1,08,0.9,545.4,M,46.9,M, , *42 123519 Fix taken at 12:35:19 UTC --- 504,513 ---- ! /****************************************************************************** * Packet received from GPS - ASCII msg * 1st byte in pkt is number of ascii bytes * async used only for testing ! GGA - Global Positioning System Fix Data GGA,123519,4807.038,N,01131.324,E,1,08,0.9,545.4,M,46.9,M, , *42 123519 Fix taken at 12:35:19 UTC *************** *** 581,585 **** } ! #endif /**************************************************************************** --- 569,573 ---- } ! /**************************************************************************** Index: appFeatures.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/appFeatures.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** appFeatures.h 23 May 2005 21:34:37 -0000 1.2 --- appFeatures.h 23 May 2005 22:09:52 -0000 1.3 *************** *** 9,12 **** --- 9,19 ---- * $Id$ */ + + + + // 23 May 2005: I removed all the MTS420 #ifdefs from the + // code, but will leave this here for now to define the + // SENSOR_BOARD_ID. --dmd + // crossbow sensor board id //define MTS420 to enable gps. *************** *** 15,19 **** #define MTS420 - #ifndef MTS420 #define SENSOR_BOARD_ID 0x85 //MTS400 sensor board id --- 22,25 ---- *************** *** 22,25 **** --- 28,36 ---- #endif + + // 23 May 2005: It's not clear how this code feature works, + // because it seems like either the GPS will run, or the weather + // sensors will run, but not both at the same time. -dmd + // TODO: Get rid of this "feature." #define FEATURE_GPS_ONLY 0 *************** *** 27,30 **** --- 38,45 ---- #define FEATURE_GPS_ONLY 0 #endif + + + + // TODO: 23 May 2005: Get rid of all this xee shit. -dmd // current Xee lib donnot support MicaZ #ifdef PLATFORM_MICAZ Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 23 May 2005 21:34:37 -0000 1.3 --- Makefile 23 May 2005 22:09:50 -0000 1.4 *************** *** 11,15 **** PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) \ -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib \ ! -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps --- 11,15 ---- PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) \ -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib \ ! -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) \ -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps |
From: David M. D. <do...@us...> - 2005-05-23 21:34:49
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646/tos/sensorboards/mts400/GPS Modified Files: gps.h Log Message: More code clean up. Fixed xbow makefile. Deleted some dead code from app. Index: gps.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS/gps.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gps.h 19 May 2005 17:31:54 -0000 1.1 --- gps.h 23 May 2005 21:34:38 -0000 1.2 *************** *** 1,3 **** ! /* tab:4 * * --- 1,3 ---- ! /* * * |
From: David M. D. <do...@us...> - 2005-05-23 21:34:48
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646/tools/src/xlisten Added Files: xconvert.c xconvert.h xsocket.c Log Message: More code clean up. Fixed xbow makefile. Deleted some dead code from app. --- NEW FILE: xconvert.h --- /** * Global definitions for Crossbow conversions. * * @file xconvert.h * @author Martin Turon * @version 2004/8/8 mturon Initial version * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: xconvert.h,v 1.1 2005/05/23 21:34:38 doolin Exp $ */ #ifndef __XCONVERT_H__ #define __XCONVERT_H__ #ifdef __arm__ #include <sys/types.h> #endif #include "xsensors.h" /** Structure to describe sensirion data for XConvert. */ typedef struct XSensorSensirion { uint16_t humidity; uint16_t thermistor; } __attribute__ ((packed)) XSensorSensirion; /** Structure to describe intersema data for XConvert. */ typedef struct XSensorIntersema { uint16_t temp; uint16_t pressure; } __attribute__ ((packed)) XSensorIntersema; uint16_t xconvert_battery_mica2 (uint16_t vref); uint16_t xconvert_battery_dot (uint16_t vref); float xconvert_accel (uint16_t accel_raw); uint32_t xconvert_adc_single (uint16_t adc_sing); int32_t xconvert_adc_precision (uint16_t adc_prec); // Sensirion conversions float xconvert_sensirion_temp (XSensorSensirion *data); float xconvert_sensirion_humidity (XSensorSensirion *data); // Intersema conversions float xconvert_intersema_temp (XSensorIntersema *data, uint16_t *calib); float xconvert_intersema_pressure (XSensorIntersema *data, uint16_t *calib); uint16_t xconvert_thermistor_resistance (uint16_t thermistor); float xconvert_thermistor_temperature (uint16_t thermistor); float xconvert_spectrum_soiltemp (uint16_t data); float xconvert_echo10 (uint16_t data); float xconvert_echo20 (uint16_t data); #endif /* __CONVERT_H__ */ --- NEW FILE: xconvert.c --- /** * Handles conversion to engineering units for common sensor types. * * @file xconvert.c * @author Martin Turon * * @version 2004/8/6 mturon Initial version * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * The goals for this module are to provide a general, lucid, and reusable * set of conversion functions for common sensors shared across the diverse * line of Crossbow products. Inputs are usually 16-bit raw ADC readings * and outputs are generally a floating point number in some standard * engineering unit. The standard engineering unit for a few common * measurements follows: * * Temperature: degrees Celsius (C) * Voltage: millvolts (mV) * Pressure: millibar (mbar) * * $Id: xconvert.c,v 1.1 2005/05/23 21:34:38 doolin Exp $ */ #include <math.h> #include "xsensors.h" #include "xconvert.h" /** * Converts mica2 battery reading from raw vref ADC data to engineering units. * * @author Martin Turon * * To compute the battery voltage after measuring the voltage ref: * BV = RV*ADC_FS/data * where: * BV = Battery Voltage * ADC_FS = 1023 * RV = Voltage Reference for mica2 (1.223 volts) * data = data from the adc measurement of channel 1 * BV (volts) = 1252.352/data * BV (mv) = 1252352/data * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @version 2004/3/29 mturon Initial revision * @n 2004/8/8 mturon Generalized to xconvert * */ uint16_t xconvert_battery_mica2(uint16_t vref) { float x = (float)vref; uint16_t vdata = (uint16_t) (1252352 / x); return vdata; } /** * Converts battery reading from raw ADC data to engineering units. * * @author Martin Turon, Alan Broad * * To compute the battery voltage after measuring the voltage ref: * BV = RV*ADC_FS/data * where: * BV = Battery Voltage * ADC_FS = 1023 * RV = Voltage Reference (0.6 volts) * data = data from the adc measurement of channel 1 * BV (volts) = 614.4/data * BV (mv) = 614400/data * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @return Battery voltage as uint16 in millivolts (mV) * * @version 2004/3/11 mturon Initial revision * @n 2004/8/8 mturon Generalized to xconvert * */ uint16_t xconvert_battery_dot(uint16_t vref) { float x = (float)vref; uint16_t vdata = (uint16_t) (614400 / x); /*613800*/ return vdata; } /** * Converts thermistor reading from raw ADC data to engineering units. * * @author Martin Turon, Alan Broad * * To compute the thermistor resistance after measuring the thermistor voltage: * - Thermistor is a temperature variable resistor * - There is a 10K resistor in series with the thermistor resistor. * - Compute expected adc output from voltage on thermistor as: * ADC= 1023*Rthr/(R1+Rthr) * where R1 = 10K * Rthr = unknown thermistor resistance * Rthr = R1*(ADC_FS-ADC)/ADC * where ADC_FS = 1023 * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @return Thermistor resistance as a uint16 in unit (Ohms) * * @version 2004/3/11 mturon Initial revision * */ uint16_t xconvert_thermistor_resistance(uint16_t thermistor) { float adc = (float)thermistor; uint16_t Rthr = 10000 * (1023-adc) / adc; return Rthr; } /** * Converts thermistor reading from raw ADC data to engineering units. * * @author Martin Turon * * @return Temperature reading from thermistor as a float in degrees Celcius * * @version 2004/3/22 mturon Initial revision * @version 2004/4/19 husq * */ float xconvert_thermistor_temperature(uint16_t thermistor) { float temperature, a, b, c, Rthr; a = 0.001307050; b = 0.000214381; c = 0.000000093; Rthr = xconvert_thermistor_resistance(thermistor); temperature = 1 / (a + b * log(Rthr) + c * pow(log(Rthr),3)); temperature -= 273.15; // Convert from Kelvin to Celcius //printf("debug: a=%f b=%f c=%f Rt=%f temp=%f\n",a,b,c,Rt,temperature); return temperature; } /** * Computes the voltage of an adc channel using the reference voltage. * Final formula is designed to minimize fixed point bit shifting * round off errors. * * Convert 12 bit data to mV: * Dynamic range is 0 - 2.5V * voltage = (adc_data * 2500mV) / 4096 * = (adc_data * 625mV) / 1024 * * @author Martin Turon * * @version 2004/3/24 mturon Initial revision * */ uint32_t xconvert_adc_single(uint16_t adc_sing) { uint32_t analog_mV = (625 * (uint32_t)adc_sing) / 1024; return analog_mV; } /** * Computes the voltage of an adc channel using the reference voltage. * Final formula is designed to minimize fixed point bit shifting * round off errors. * * Convert 12 bit data to uV: * Dynamic range is +/- 12.5mV * voltage = 12500 * (adc_data/2048 -1) * = (5*625*data/512) - 12500 * = 5 * ((625*data/512) - 2500) * * * @author Martin Turon * * @version 2004/3/24 mturon Initial revision * */ int32_t xconvert_adc_precision(uint16_t adc_prec) { int32_t analog_uV = 5 * (((625 * (uint32_t)adc_prec)/ 512) - 2500); return analog_uV; } float xconvert_echo10(uint16_t data) { float moisture = data * (1/11.5) - 34; // float conv = ((float) data) * 2.5 / 4096; // float moisture = (100 * (0.000936 * (conv * 1000) - 0.376) + 0.5) ; return moisture; } float xconvert_echo20(uint16_t data) { float moisture = data * (1/14.0) - 28; // float conv = ((float) data) * 2.5 / 4096; // float moisture = (100 * (0.000695 * (conv * 1000) - 0.290) + 0.5) ; return moisture; } /** * Computes the ADC count of ADXL202E Accelerometer - for X axis reading into * Engineering Unit (mg), per calibration. * * Calibration done for one test sensor - should be repeated for each unit. * * @author Jaidev Prabhu * * @version 2004/3/24 jdprabhu Initial revision * @n 2004/6/17 husq * @n 2004/8/8 mturon Generalized to xconvert * */ float xconvert_accel(uint16_t accel_raw) { uint16_t AccelData; uint16_t calib_neg_1g = 400; uint16_t calib_pos_1g = 500; float scale_factor; float reading; AccelData = accel_raw; scale_factor = ( calib_pos_1g - calib_neg_1g ) / 2; reading = 1.0 - (calib_pos_1g - AccelData) / scale_factor; reading = reading * 1000.0; return reading; } /** * Computes the ADC count of Thermistor into Engineering Unit (degC) * * @author Hu Siquan * * @version 2004/6/25 husq Initial revision * @n 2004/8/8 mturon Generalized to xconvert * */ float xconvert_sensirion_temp(XSensorSensirion *data) { float TempData, fTemp; TempData = (float)data->thermistor; fTemp = -38.4 + 0.0098 * TempData; return fTemp; } /** * Computes the ADC count of Humidity sensor into Engineering Unit (%) * * @author Hu Siquan, Martin Turon * * @version 2004/6/14 husq Initial revision * @n 2004/8/8 mturon Generalized to xconvert * */ float xconvert_sensirion_humidity(XSensorSensirion *data) { float HumData = (float)data->humidity; float fTemp = xconvert_sensirion_temp(data); float fHumidity = -4.0 + 0.0405 * HumData - 0.0000028 * HumData * HumData; fHumidity = (fTemp - 25.0)*(0.01 + 0.00008 * HumData) + fHumidity; return fHumidity; } /** * Computes the pressure ADC count of Intersema MS5534A barometric * pressure/temperature sensor - reading into Engineering Units (mbar) * * @author Hu Siquan * * Intersema MS5534A barometric pressure/temperature sensor * - 6 cal coefficients (C1..C6) are extracted from 4,16 bit,words from sensor * - Temperature measurement: * UT1=8*C5+20224 * dT=data-UT1 * Temp=(degC x10)=200+dT(C6+50)/1024 * - Pressure measurement: * OFF=C2*4 + ((C4-512)*dT)/1024 * SENS=C1+(C3*dT)/1024 + 24576 * X=(SENS*(PressureData-7168))/16384 - OFF * Press(mbar)= X/32+250 * * @version 2004/6/17 husiquan Initial revision * @n 2004/8/8 mturon Generalized to xconvert */ float xconvert_intersema_pressure(XSensorIntersema *data, uint16_t *calibration) { float UT1,dT; float OFF,SENS,X,Press; uint16_t C1,C2,C3,C4,C5; //,C6; //intersema calibration coefficients uint16_t PressureData = data->pressure; uint16_t TempData = data->temp; C1 = calibration[0] >> 1; C2 = ((calibration[2] & 0x3f) << 6) | (calibration[3] & 0x3f); C3 = calibration[3] >> 6; C4 = calibration[2] >> 6; C5 = ((calibration[0] & 1) << 10) | (calibration[1] >> 6); // C6 = calibration[1] & 0x3f; UT1=8*(float)C5+20224; dT = (float)TempData-UT1; OFF = (float)C2*4 + (((float)C4-512.0)*dT)/1024; SENS = (float)C1 + ((float)C3*dT)/1024 + 24576; X = (SENS*((float)PressureData-7168.0))/16384 - OFF; Press = X/32.0 + 250.0; return Press; } /** * Computes the temperature ADC count of Intersema MS5534A barometric * pressure/temperature sensor - reading into Engineering Unit (degC) * * @author Hu Siquan * * @version 2004/6/17 husiquan Initial revision * @n 2004/8/8 mturon Generalized to xconvert */ float xconvert_intersema_temp(XSensorIntersema *data, uint16_t *calibration) { float UT1,dT,Temp; uint16_t C5,C6; //intersema calibration coefficients uint16_t TempData = data->temp; C5 = ((calibration[0] & 1) << 10) | (calibration[1] >> 6); C6 = calibration[1] & 0x3f; UT1=8*(float)C5+20224; dT = (float)TempData-UT1; //temperature (degCx10) Temp = 200.0 + dT*((float)C6+50.0)/1024.0; //temperature (degC) Temp /=10.0; return Temp; } static float SpectrumLookUpTable[256] = { 481.8, 404.1, 363.8, 337.2, 317.6, 302.1, 289.4, 278.6, 269.3, 261.2, 253.9, 247.3, 241.4, 235.9, 230.9, 226.2, 221.8, 217.7, 213.9, 210.3, 206.9, 203.6, 200.5, 197.5, 194.7, 192, 189.4, 186.9, 184.5, 182.2, 180, 177.8, 175.7, 173.7, 171.7, 169.8, 167.9, 166.1, 164.4, 162.7, 161, 159.4, 157.8, 156.2, 154.7, 153.2, 151.7, 150.3, 148.9, 147.5, 146.2, 144.8, 143.5, 142.3, 141, 139.8, 138.5, 137.4, 136.2, 135, 133.9, 132.7, 131.6, 130.5, 129.4, 128.4, 127.3, 126.3, 125.3, 124.2, 123.2, 122.2, 121.3, 120.3, 119.3, 118.4, 117.4, 116.5, 115.6, 114.7, 113.8, 112.9, 112, 111.1, 110.2, 109.4, 108.5, 107.7, 106.8, 106, 105.1, 104.3, 103.5, 102.7, 101.9, 101.1, 100.3, 99.5, 98.7, 97.9, 97.1, 96.4, 95.6, 94.8, 94.1, 93.3, 92.5, 91.8, 91, 90.3, 89.6, 88.8, 88.1, 87.4, 86.6, 85.9, 85.2, 84.5, 83.7, 83, 82.3, 81.6, 80.9, 80.2, 79.5, 78.8, 78.1, 77.4, 76.7, 76, 75.3, 74.6, 73.9, 73.2, 72.5, 71.8, 71.1, 70.4, 69.7, 69, 68.4, 67.7, 67, 66.3, 65.6, 64.9, 64.2, 63.5, 62.8, 62.2, 61.5, 60.8, 60.1, 59.4, 58.7, 58, 57.3, 56.6, 55.9, 55.2, 54.5, 53.8, 53.1, 52.4, 51.7, 51, 50.3, 49.6, 48.8, 48.1, 47.4, 46.7, 45.9, 45.2, 44.5, 43.7, 43, 42.3, 41.5, 40.8, 40, 39.3, 38.5, 37.7, 36.9, 36.2, 35.4, 34.6, 33.8, 33, 32.2, 31.4, 30.6, 29.7, 28.9, 28.1, 27.2, 26.4, 25.5, 24.6, 23.7, 22.9, 22, 21, 20.1, 19.2, 18.2, 17.3, 16.3, 15.3, 14.3, 13.3, 12.3, 11.2, 10.2, 9.1, 8, 6.9, 5.7, 4.6, 3.4, 2.2, 0.9, -0.3, -1.6, -2.9, -4.3, -5.7, -7.1, -8.6, -10.2, -11.7, -13.4, -15.1, -16.8, -18.6, -20.5, -22.5, -24.6, -26.8, -29.1, -31.6, -34.2, -37, -40.1, -43.4, -47, -51.1, -55.7, -61, -67.3, -75.2, -86, -86, 254, 254 }; /** * Computes the soil temperature in Farenheit from a lookup table * given the ADC reading from the sensor * * @author Jaidev Prabhu * * @version 2004/8/27 jdprabhu Initial version * */ float xconvert_spectrum_soiltemp(uint16_t data) { uint8_t index = (uint8_t) data; float fTemp = SpectrumLookUpTable[index]; return fTemp; } --- NEW FILE: xsocket.c --- /** * Handles low-level socket communication. * * @file xsocket.c * @author Martin Turon * @version 2004/8/20 mturon Initial version * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: xsocket.c,v 1.1 2005/05/23 21:34:38 doolin Exp $ */ #include "xsensors.h" #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <errno.h> #define SOCKET_DEVICE "localhost" //!< Default hostname to use #define SOCKET_PORT_SF 9001 //!< Serial Forwarder default port #define SOCKET_PORT_MIB600 10002 //!< MIB600 default port #define SOCKET_ERROR -1 static const char *g_server = SOCKET_DEVICE; static unsigned g_port = SOCKET_PORT_SF; /** Sets the hostname to connect to. */ void xsocket_set_server(const char *server) { if (!*server) return; g_server = server; } /** Returns the hostname to connect to. */ const char *xsocket_get_server() { return g_server; } /** Sets the tcp/ip port to connect to. */ void xsocket_set_port(const char *port) { if (!strcmp(port, "mib600")) { g_port = 10002; } else { g_port = atoi(port); } } /** Returns the tcp/ip port to connect to. */ unsigned xsocket_get_port() { return g_port; } int saferead(int fd, void *buffer, int count) { int actual = 0; while (count > 0) { int n = read(fd, buffer, count); if (n == -1 && errno == EINTR) continue; if (n == -1) return -1; if (n == 0) return actual; count -= n; actual += n; buffer += n; } return actual; } int safewrite(int fd, const void *buffer, int count) { int actual = 0; while (count > 0) { int n = write(fd, buffer, count); if (n == -1 && errno == EINTR) continue; if (n == -1) return -1; count -= n; actual += n; buffer += n; } return actual; } int xsocket_start_sf(int fd) /* Effects: Checks that fd is following the serial forwarder protocol Returns: 0 if it is, -1 otherwise */ { int platform = 0; char check[2]; char nonce[6]; /* Indicate version and check if serial forwarder on the other end (life is easy as we're the earliest protocol version) */ nonce[0] = 'T'; nonce[1] = ' '; nonce[2] = (char) (platform & 0xff); nonce[3] = (char) ((platform >> 8) & 0xff); nonce[4] = (char) ((platform >> 16) & 0xff); nonce[5] = (char) ((platform >> 24) & 0xff); if (safewrite(fd, nonce, 6) != 6 || saferead(fd, check, 6) != 6 || check[0] != 'T' || check[1] < ' ') { return -1; } return 0; } /** * Opens up a stream to the tcp/ip socket port. * * @return Handle to the socket as an integer. * @author Martin Turon * @version 2004/8/20 mturon Intial revision */ int xsocket_port_open() { const char *name = g_server; unsigned long port = g_port; /* open socket for read/write */ struct hostent *l_host; struct sockaddr_in l_socket; int fd; l_socket.sin_family = AF_INET; l_socket.sin_port = htons(port); l_socket.sin_addr.s_addr = INADDR_ANY; l_host = gethostbyname(name); if (l_host == NULL) { printf("xsocket: Unknown host name: %s\n", name); exit(1); } memcpy(&(l_socket.sin_addr), l_host->h_addr, l_host->h_length); fd = socket(PF_INET, SOCK_STREAM, 0); if (fd == SOCKET_ERROR){ fprintf(stderr, "xsocket: Failed to open %s\n", name); perror(""); fprintf(stderr, "Verify that user has permission to open device.\n"); exit(2); } while (connect(fd, (struct sockaddr *)&l_socket, sizeof(l_socket)) == SOCKET_ERROR) { printf("xsocket: No response from %s...\n", name); sleep(1); } // int one = 1; // setsockopt(fd, SOL_SOCKET, SO_BROADCAST,(char *) &one, sizeof(one)); if (xmain_get_verbose()) printf("%s input stream opened\n", name); xsocket_start_sf(fd); return fd; } /** Reads one XSensorPacket from the serial port. */ int xsocket_read_packet(int fd, unsigned char *buffer) { // Use single byte reads for now as they are more stable. unsigned char len; if (saferead(fd, &len, 1) != 1) return -1; if (saferead(fd, buffer, len) != len) { return -1; } return len; } |
From: David M. D. <do...@us...> - 2005-05-23 21:34:48
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/amtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646/tools/src/xlisten/amtypes Added Files: health.c surge.c Log Message: More code clean up. Fixed xbow makefile. Deleted some dead code from app. --- NEW FILE: health.c --- /** * Handles conversion to engineering units of mts500 packets. * * @file health.c * @author Martin Turon * @version 2005/1/21 mturon Initial version * * Copyright (c) 2005 Crossbow Technology, Inc. All rights reserved. * * $Id: health.c,v 1.1 2005/05/23 21:34:38 doolin Exp $ */ #include "../xdb.h" #include "../xsensors.h" typedef struct DBGEstEntry { uint16_t id; uint8_t hopcount; uint8_t sendEst; } __attribute__ ((packed)) DBGEstEntry; typedef struct HealthData { // MultihopMsg uint16_t nodeid; uint16_t originaddr; int16_t seqno; uint8_t hopcount; // HealthMsg uint8_t estEntries; DBGEstEntry estList[4]; } __attribute__ ((packed)) HealthData; extern XPacketHandler health_packet_handler; #define health_nhood(x) ((x)->estEntries & 0xF) /** HEALTH Specific outputs of raw readings within an XBowSensorboardPacket */ void health_print_raw(XbowSensorboardPacket *packet) { HealthData *data = (HealthData *)packet; printf("health id=%04x seq=%04x hops=%02x nhood=%02x\n", data->nodeid, data->seqno, data->hopcount, health_nhood(data)); } void health_print_cooked(XbowSensorboardPacket *packet) { HealthData *data = (HealthData *)packet; int nhood = health_nhood(data); printf("HEALTH : node_id=%i seq_no=%i hops=%i nhood=%i\n", data->nodeid, data->seqno, data->hopcount, nhood ); while(nhood--) { printf(" neighbor: id=%i hops=%i est=%i\n", data->estList[nhood].id, data->estList[nhood].hopcount, data->estList[nhood].sendEst ); } printf("\n"); } const char *health_db_create_table = "CREATE TABLE %s%s ( result_time timestamp without time zone, " "nodeid integer,parent integer,epoch integer," "voltage integer,temp integer,light integer," "accel_x integer,accel_y integer," "mag_x integer,mag_y integer)"; const char *health_db_create_rule = "CREATE RULE cache_%s AS ON INSERT TO %s DO ( " "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " "INSERT INTO %s_L VALUES (NEW.*); )"; /** * Logs raw readings to a Postgres database. * * @author Martin Turon * * @version 2004/7/28 mturon Initial revision * */ void health_log_raw(XbowSensorboardPacket *packet) { #if 0 HealthData *data = (HealthData *)packet; char command[512]; char *table = xdb_get_table(); if (!*table) table = "health_results"; if (!health_packet_handler.flags.table_init) { int exists = xdb_table_exists(table); if (!exists) { // Create results table. sprintf(command, health_db_create_table, table, ""); xdb_execute(command); // Create last result cache sprintf(command, health_db_create_table, table, "_L"); xdb_execute(command); // Add rule to populate last result table sprintf(command, health_db_create_rule, table, table, table, table); xdb_execute(command); // Add results table to query log. int q_id = XTYPE_HEALTH, sample_time = 99000; sprintf(command, "INSERT INTO task_query_log " "(query_id, tinydb_qid, query_text, query_type, " "table_name) VALUES (%i, %i, 'SELECT nodeid,parent," "epoch,voltage,temp,light,accel_x,accel_y,mag_x,mag_y " "SAMPLE PERIOD %i', 'sensor', '%s')", q_id, q_id, sample_time, table); xdb_execute(command); // Log start time of query in time log. sprintf(command, "INSERT INTO task_query_time_log " "(query_id, start_time) VALUES (%i, now())", q_id); xdb_execute(command); } health_packet_handler.flags.table_init = 1; } sprintf(command, "INSERT into %s " "(result_time,nodeid,parent,epoch,voltage,temp,light," "accel_x,accel_y,mag_x,mag_y)" " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u,%u)", table, //timestring, data->nodeid, data->parent, health_get_epoch(data), health_get_vref(data), data->thermistor<<2, data->light, data->accelX<<2, data->accelY<<2, data->magX, data->magY ); xdb_execute(command); #endif } XPacketHandler health_packet_handler = { AMTYPE_HEALTH, //XTYPE_HEALTH, "$Id: health.c,v 1.1 2005/05/23 21:34:38 doolin Exp $", health_print_raw, health_print_cooked, health_print_raw, health_print_cooked, health_log_raw }; void health_initialize() { xpacket_add_amtype(&health_packet_handler); } --- NEW FILE: surge.c --- /** * Handles conversion to engineering units of mts500 packets. * * @file mts300.c * @author Martin Turon, Hu Siquan * @version 2004/3/10 mturon Initial version * @n 2004/4/15 husiquan Added temp,light,accel,mic,sounder,mag * @n 2004/8/2 mturon Added database logging * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: surge.c,v 1.1 2005/05/23 21:34:38 doolin Exp $ */ #include "../xdb.h" #include "../xsensors.h" typedef struct SurgeData { // MultihopMsg uint16_t destaddr; uint16_t nodeid; int16_t seqno; uint8_t hopcount; // SurgeMsg uint8_t type; uint16_t current; uint16_t parent; uint32_t seq_no; // encoded vref in higher 9 bits uint8_t light; uint8_t thermistor; uint8_t magX; uint8_t magY; uint8_t accelX; uint8_t accelY; } __attribute__ ((packed)) SurgeData; /** Mad, wild, jhill-i-fied voltage encoding, saves space, cost: time! ;) */ #define surge_get_vref(x) (((x)->seq_no & 0xFF800000) >> 23) #define surge_get_epoch(x) ((x)->seq_no & 0x007FFFFF) extern XPacketHandler surge_packet_handler; /** * Computes the Clairex CL94L light sensor reading * * @author Hu Siquan * * @return Voltage of ADC channel as an unsigned integer in mV * * @version 2004/4/19 husq Initial revision * */ uint16_t surge_convert_light(uint16_t light, uint16_t vref) { float Vbat = xconvert_battery_mica2(vref); uint16_t Vadc = (uint16_t) (light * Vbat / 1023); return Vadc; } /** * Computes the ADC count of the Magnetometer - for X axis reading into * Engineering Unit (mgauss), no calibration * * SENSOR Honeywell HMC1002 * SENSITIVITY 3.2mv/Vex/gauss * EXCITATION 3.0V (nominal) * AMPLIFIER GAIN 2262 * ADC Input 22mV/mgauss * * @author Hu Siquan * * @version 2004/4/26 husq Initial Version * */ float surge_convert_mag_x(uint16_t data,uint16_t vref) { // float Vbat = surge_convert_battery(vref); // float Vadc = data * Vbat / 1023; // return Vadc/(2.262*3.0*3.2); float Magx = data / (1.023*2.262*3.2); return Magx; } /** * Computes the ADC count of the Magnetometer - for Y axis reading into * Engineering Unit (mgauss), no calibration * * SENSOR Honeywell HMC1002 * SENSITIVITY 3.2mv/Vex/gauss * EXCITATION 3.0V (nominal) * AMPLIFIER GAIN 2262 * ADC Input 22mV/mgauss * * @author Hu Siquan * * @version 2004/4/26 husq Initial Version * */ float surge_convert_mag_y(uint16_t data,uint16_t vref) { // float Vbat = surge_convert_battery(vref); // float Vadc = (data * Vbat / 1023); // return Vadc/(2.262*3.0*3.2); float Magy = data / (1.023*2.262*3.2); return Magy; } /** SURGE Specific outputs of raw readings within an XBowSensorboardPacket */ void surge_print_raw(XbowSensorboardPacket *packet) { SurgeData *data = (SurgeData *)packet; printf("surge id=%02x parent=%02x seq=%04x vref=%04x \n" " thrm=%04x light=%04x accelX=%04x accelY=%04x " "magX=%04x magY=%04x\n", data->nodeid, data->parent, surge_get_epoch(data), surge_get_vref(data), data->thermistor, data->light, data->accelX, data->accelY, data->magX, data->magY); } void surge_print_cooked(XbowSensorboardPacket *packet) { SurgeData *data = (SurgeData *)packet; printf("SURGE [sensor data converted to engineering units]:\n" " health: node id=%i parent=%i seq_no=%i\n" " battery = %i mv\n" " temperature = %0.2f degC\n" " light: = %i ADC mv\n" " AccelX: = %f g, AccelY: = %f g\n" " MagX: = %0.2f mgauss, MagY: = %0.2f mgauss\n", data->nodeid, data->parent, surge_get_epoch(data), xconvert_battery_mica2(surge_get_vref(data)), xconvert_thermistor_temperature(data->thermistor<<2), surge_convert_light(data->light, surge_get_vref(data)), xconvert_accel(data->accelX<<2), xconvert_accel(data->accelY<<2), surge_convert_mag_x(data->magX,surge_get_vref(data)), surge_convert_mag_y(data->magY,surge_get_vref(data)) ); printf("\n"); } const char *surge_db_create_table = "CREATE TABLE %s%s ( result_time timestamp without time zone, " "nodeid integer,parent integer,epoch integer," "voltage integer,temp integer,light integer," "accel_x integer,accel_y integer," "mag_x integer,mag_y integer)"; const char *surge_db_create_rule = "CREATE RULE cache_%s AS ON INSERT TO %s DO ( " "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " "INSERT INTO %s_L VALUES (NEW.*); )"; /** * Logs raw readings to a Postgres database. * * @author Martin Turon * * @version 2004/7/28 mturon Initial revision * */ void surge_log_raw(XbowSensorboardPacket *packet) { SurgeData *data = (SurgeData *)packet; char command[512]; char *table = xdb_get_table(); if (!*table) table = "surge_results"; if (!surge_packet_handler.flags.table_init) { int exists = xdb_table_exists(table); if (!exists) { // Create results table. sprintf(command, surge_db_create_table, table, ""); xdb_execute(command); // Create last result cache sprintf(command, surge_db_create_table, table, "_L"); xdb_execute(command); // Add rule to populate last result table sprintf(command, surge_db_create_rule, table, table, table, table); xdb_execute(command); // Add results table to query log. int q_id = XTYPE_SURGE, sample_time = 99000; sprintf(command, "INSERT INTO task_query_log " "(query_id, tinydb_qid, query_text, query_type, " "table_name) VALUES (%i, %i, 'SELECT nodeid,parent," "epoch,voltage,temp,light,accel_x,accel_y,mag_x,mag_y " "SAMPLE PERIOD %i', 'sensor', '%s')", q_id, q_id, sample_time, table); xdb_execute(command); // Log start time of query in time log. sprintf(command, "INSERT INTO task_query_time_log " "(query_id, start_time) VALUES (%i, now())", q_id); xdb_execute(command); } surge_packet_handler.flags.table_init = 1; } sprintf(command, "INSERT into %s " "(result_time,nodeid,parent,epoch,voltage,temp,light," "accel_x,accel_y,mag_x,mag_y)" " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u,%u)", table, //timestring, data->nodeid, data->parent, surge_get_epoch(data), surge_get_vref(data), data->thermistor<<2, data->light, data->accelX<<2, data->accelY<<2, data->magX, data->magY ); xdb_execute(command); } XPacketHandler surge_packet_handler = { AMTYPE_SURGE_MSG, //XTYPE_SURGE, "$Id: surge.c,v 1.1 2005/05/23 21:34:38 doolin Exp $", surge_print_raw, surge_print_cooked, surge_print_raw, surge_print_cooked, surge_log_raw }; void surge_initialize() { xpacket_add_amtype(&surge_packet_handler); } |
From: David M. D. <do...@us...> - 2005-05-23 21:34:47
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646/apps/XSensorMTS400 Modified Files: .cvsignore Makefile TestMTS400M.nc appFeatures.h sensorboardApp.h Log Message: More code clean up. Fixed xbow makefile. Deleted some dead code from app. Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestMTS400M.nc 23 May 2005 19:09:43 -0000 1.2 --- TestMTS400M.nc 23 May 2005 21:34:37 -0000 1.3 *************** *** 264,268 **** char stringcommand[] = "$PSRF100,0,9600,8,1,0*0C"; ! char gga_fields[GGA_FIELDS][GPS_CHAR_PER_FIELD]; // = {{0}}; --- 264,268 ---- char stringcommand[] = "$PSRF100,0,9600,8,1,0*0C"; ! Index: sensorboardApp.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/sensorboardApp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sensorboardApp.h 19 May 2005 17:29:49 -0000 1.1 --- sensorboardApp.h 23 May 2005 21:34:37 -0000 1.2 *************** *** 2,34 **** #define MAKE_GPS_ENA_OUTPUT() sbi(DDRE,6) #define SET_GPS_ENA() cbi(PORTE,6) #define CLR_GPS_ENA() sbi(PORTE,6) - #define GPS_MSG_LENGTH 100 - #define GPS_CHAR 11 - #define GGA_FIELDS 8 - #define GPS_CHAR_PER_FIELD 10 - #define GPS_DELIMITER ',' - #define GPS_END_MSG '*' - // 18 bytes. - // - //struct _gga_msg - //{ - // uint8_t hours; - // uint8_t minutes; - // float dec_sec; - // uint8_t Lat_deg; - // float Lat_dec_min; - // uint8_t Long_deg; - // float Long_dec_min; - // uint8_t NSEWind; - // uint8_t num_sats; - //}; - //typedef struct _gga_msg GGA_Msg; - // - // typedef struct XSensorHeader{ --- 2,13 ---- + + // TODO: Delete this bullshit if possible. #define MAKE_GPS_ENA_OUTPUT() sbi(DDRE,6) #define SET_GPS_ENA() cbi(PORTE,6) #define CLR_GPS_ENA() sbi(PORTE,6) typedef struct XSensorHeader{ Index: appFeatures.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/appFeatures.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appFeatures.h 19 May 2005 17:29:49 -0000 1.1 --- appFeatures.h 23 May 2005 21:34:37 -0000 1.2 *************** *** 22,26 **** #endif ! #define FEATURE_GPS_ONLY 1 #ifndef FEATURE_GPS_ONLY --- 22,26 ---- #endif ! #define FEATURE_GPS_ONLY 0 #ifndef FEATURE_GPS_ONLY Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 19 May 2005 19:48:01 -0000 1.2 --- Makefile 23 May 2005 21:34:37 -0000 1.3 *************** *** 1,2 **** --- 1,3 ---- + COMPONENT=TestMTS400 SENSORBOARD=mts400 *************** *** 8,13 **** XBOWBETAROOT=$(TOSROOT)/contrib/xbow/beta/tos ! PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps include ../MakeXbowlocal include ${TOSROOT}/tools/make/Makerules --- 9,22 ---- XBOWBETAROOT=$(TOSROOT)/contrib/xbow/beta/tos ! PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) \ ! -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib \ ! -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) ! -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps include ../MakeXbowlocal include ${TOSROOT}/tools/make/Makerules + + + + + Index: .cvsignore =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 23 May 2005 19:09:43 -0000 1.2 --- .cvsignore 23 May 2005 21:34:37 -0000 1.3 *************** *** 1 **** ! buil *~ --- 1 ---- ! build *~ |
From: David M. D. <do...@us...> - 2005-05-23 21:34:45
|
Update of /cvsroot/firebug/fireboard/beta/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646/apps Modified Files: MakeXbowlocal Log Message: More code clean up. Fixed xbow makefile. Deleted some dead code from app. Index: MakeXbowlocal =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/MakeXbowlocal,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MakeXbowlocal 19 May 2005 17:29:49 -0000 1.1 --- MakeXbowlocal 23 May 2005 21:34:36 -0000 1.2 *************** *** 20,24 **** # - default mote group ########################################################################## ! DEFAULT_LOCAL_GROUP=0x7D ########################################################################## --- 20,25 ---- # - default mote group ########################################################################## ! #DEFAULT_LOCAL_GROUP=0x7D ! DEFAULT_LOCAL_GROUP=0x7E ########################################################################## *************** *** 73,77 **** --- 74,80 ---- # CHANNEL_04 - 434.108 MHz CHANNEL_06 - 434.618 MHz # + CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_433_002_MHZ + #CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_434_845_MHZ #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_433BAND_CHANNEL_00 *************** *** 122,126 **** ! CFLAGS +=-DCC2420_TXPOWER=TXPOWER_MAX #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M0DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M3DBM --- 125,129 ---- ! #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_MAX #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M0DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M3DBM *************** *** 158,162 **** #CFLAGS +=-DCC2420_DEF_CHANNEL=24 #CFLAGS +=-DCC2420_DEF_CHANNEL=25 ! CFLAGS +=-DCC2420_DEF_CHANNEL=26 ########################################################################## --- 161,165 ---- #CFLAGS +=-DCC2420_DEF_CHANNEL=24 #CFLAGS +=-DCC2420_DEF_CHANNEL=25 ! #CFLAGS +=-DCC2420_DEF_CHANNEL=26 ########################################################################## |
From: David M. D. <do...@us...> - 2005-05-23 19:09:52
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25641 Modified Files: .cvsignore TestMTS400.nc TestMTS400M.nc Log Message: Initial reformatting, some compiler clean up. Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMTS400M.nc 19 May 2005 17:29:49 -0000 1.1 --- TestMTS400M.nc 23 May 2005 19:09:43 -0000 1.2 *************** *** 1,3 **** ! /* tab:4 * * --- 1,3 ---- ! /* * * *************** *** 22,26 **** * [...1392 lines suppressed...] } --- 820,836 ---- if(success || cmdCnt>8 ) {atomic state = START; cmdCnt =0;} else{ ! call GpsSend.send(stringcommand,24); } ! return SUCCESS; } /**************************************************************************** ! * Uart msg rcvd. ! * This app doesn't respond to any incoming uart msg ! * Just return ! ****************************************************************************/ event TOS_MsgPtr Receive.receive(TOS_MsgPtr data) { ! return data; } Index: TestMTS400.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMTS400.nc 19 May 2005 17:29:49 -0000 1.1 --- TestMTS400.nc 23 May 2005 19:09:43 -0000 1.2 *************** *** 1,3 **** ! /* tab:4 * * --- 1,3 ---- ! /* * * *************** *** 22,26 **** * */ ! /* tab:4 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By * downloading, copying, installing or using the software you agree to --- 22,26 ---- * */ ! /* * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By * downloading, copying, installing or using the software you agree to Index: .cvsignore =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 19 May 2005 19:48:53 -0000 1.1 --- .cvsignore 23 May 2005 19:09:43 -0000 1.2 *************** *** 0 **** --- 1 ---- + buil *~ |
From: David M. D. <do...@us...> - 2005-05-19 20:04:48
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/amtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5367/amtypes Log Message: Directory /cvsroot/firebug/fireboard/beta/tools/src/xlisten/amtypes added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 20:04:21
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5174 Modified Files: Makefile xdb.c xdb.h xlisten.c xpacket.c xsensors.h xserial.c Log Message: Using xbow stable for this code. Index: xpacket.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xpacket.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xpacket.c 19 May 2005 19:58:17 -0000 1.1 --- xpacket.c 19 May 2005 20:04:08 -0000 1.2 *************** *** 12,19 **** #include "xsensors.h" static unsigned g_datastart = XPACKET_DATASTART; ! static XPacketHandler *g_packetTable[256]; /** --- 12,20 ---- #include "xsensors.h" + #include "xpacket.h" static unsigned g_datastart = XPACKET_DATASTART; ! static XPacketHandler *g_packetTable[512]; /** *************** *** 25,28 **** --- 26,35 ---- void xpacket_initialize() { + health_initialize(); /* From amtypes/health.c */ + + mica2_initialize(); /* From boards/mica2.c */ + mica2dot_initialize(); /* From boards/mica2.c */ + micaz_initialize(); /* From boards/mica2.c */ + surge_initialize(); /* From boards/surge.c */ *************** *** 41,44 **** --- 48,55 ---- mep500_initialize(); /* From boards/mep500.c */ mep401_initialize(); /* From boards/mep401.c */ + ggbacltst_initialize(); /* From boards/ggbacltst.c */ + msp410_initialize(); /* From boards/msp410.c */ + + xtutorial_initialize(); /* From boards/xtutorial.c */ } *************** *** 135,138 **** --- 146,150 ---- case AMTYPE_XSENSOR: case AMTYPE_SURGE_MSG: + case AMTYPE_HEALTH: datastart = XPACKET_DATASTART_STANDARD; break; *************** *** 186,189 **** --- 198,213 ---- /** + * Adds a packet handler for the given AM packet type. + * + * @author Martin Turon + * @version 2004/7/28 mturon Intial version + */ + void xpacket_add_amtype(XPacketHandler *handler) + { + if (!handler) return; + g_packetTable[handler->type + XPACKET_AM_TABLE] = handler; + } + + /** * Print out the timestamp of when the packet was heard. * *************** *** 191,204 **** * @version 2004/9/27 mturon Intial version */ ! void xpacket_print_time() { char timestring[TIMESTRING_SIZE]; Timestamp *time_now = timestamp_new(); timestamp_get_string(time_now, timestring); ! printf("[%s]\n", timestring); timestamp_delete(time_now); } /** * Print out the version information for all the packet handlers. * --- 215,242 ---- * @version 2004/9/27 mturon Intial version */ ! void xpacket_print_timestamp() { char timestring[TIMESTRING_SIZE]; Timestamp *time_now = timestamp_new(); timestamp_get_string(time_now, timestring); ! printf("%s", timestring); timestamp_delete(time_now); } /** + * Print out the timestamp of when the packet was heard. + * + * @author Martin Turon + * @version 2004/9/27 mturon Intial version + */ + void xpacket_print_time() + { + printf("["); + xpacket_print_timestamp(); + printf("]\n"); + } + + + /** * Print out the version information for all the packet handlers. * *************** *** 209,212 **** --- 247,251 ---- { int i = 256; + printf("XSensor boards\n"); while (--i >= 0) { if ((g_packetTable[i]) && (g_packetTable[i]->version)) *************** *** 214,226 **** g_packetTable[i]->type, g_packetTable[i]->version); } } ! XPacketHandler *xsensor_get_handler(uint8_t board_id) { ! int i = 256; while (--i >= 0) { ! if ((g_packetTable[i]) && ! (g_packetTable[i]->type == board_id)) ! return g_packetTable[i]; } return NULL; --- 253,273 ---- g_packetTable[i]->type, g_packetTable[i]->version); } + i = 512; + printf("AM packet types\n"); + while (--i >= XPACKET_AM_TABLE) { + if ((g_packetTable[i]) && (g_packetTable[i]->version)) + printf(" %02x: %s\n", + g_packetTable[i]->type, g_packetTable[i]->version); + } } ! XPacketHandler *xsensor_get_handler(uint8_t type_id, int table) { ! int i = 256, entry; while (--i >= 0) { ! entry = table + i; ! if (!(g_packetTable[entry])) continue; ! if (g_packetTable[entry]->type == type_id) ! return g_packetTable[entry]; } return NULL; *************** *** 232,236 **** switch (am_type) { - case AMTYPE_SURGE_MSG: case AMTYPE_XMULTIHOP: case AMTYPE_XUART: --- 279,282 ---- *************** *** 245,252 **** return NULL; } ! return xsensor_get_handler(packet->board_id); } ! case AMTYPE_MHOP_DEBUG: default: break; --- 291,301 ---- return NULL; } ! return xsensor_get_handler(packet->board_id, XPACKET_BOARD_TABLE); } ! case AMTYPE_HEALTH: ! case AMTYPE_SURGE_MSG: ! return xsensor_get_handler(am_type, XPACKET_AM_TABLE); ! default: break; *************** *** 394,408 **** void xpacket_export_parsed(unsigned char *tos_packet) { ! int i; ! uint16_t *packet = (uint16_t *)xpacket_get_sensor_data(tos_packet); if (xpacket_print_common((XbowSensorboardPacket *)packet)) return; ! packet += 2; // Ignore board_id and packet_id ! for (i=0; i<8; i++) { ! if (i>0) printf(","); ! printf("%d",packet[i]); } ! printf("\n"); } --- 443,466 ---- void xpacket_export_parsed(unsigned char *tos_packet) { ! int i=0; ! uint8_t *packet = (uint8_t *)xpacket_get_sensor_data(tos_packet); if (xpacket_print_common((XbowSensorboardPacket *)packet)) return; ! TosMsg *tosmsg = (TosMsg *)tos_packet; ! MultihopMsg *mhop = (MultihopMsg *)(tos_packet + sizeof(TosMsg)); ! xpacket_print_timestamp(); ! printf (", %u,%u,%u, %u,%u,%u, ", ! tosmsg->am_type, tosmsg->group, tosmsg->length, ! mhop->nodeid, mhop->seqno, mhop->hops ! ); ! ! // i=2 --> skip board_id/packet_id, node/parent ! for (i=0; i<tosmsg->length; i++) { // include CRC ! printf("%u",packet[i]); ! printf(","); } ! uint16_t crc = *(uint16_t *)((char *)mhop + tosmsg->length); ! printf(" %u\n",crc); } Index: xsensors.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xsensors.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xsensors.h 19 May 2005 19:58:17 -0000 1.1 --- xsensors.h 19 May 2005 20:04:08 -0000 1.2 *************** *** 48,51 **** --- 48,56 ---- XTYPE_MEP500, + // mote boards + XTYPE_MICA2 = 0x60, + XTYPE_MICA2DOT, + XTYPE_MICAZ, + // mica2 sensorboards XTYPE_MDA400 = 0x80, *************** *** 57,65 **** XTYPE_MTS420, XTYPE_MEP401, } XbowSensorboardType; typedef enum { AMTYPE_XUART = 0x00, ! AMTYPE_MHOP_DEBUG = 0x03, AMTYPE_SURGE_MSG = 0x11, AMTYPE_XDEBUG = 0x31, --- 62,76 ---- XTYPE_MTS420, XTYPE_MEP401, + XTYPE_XTUTORIAL = 0x88, + XTYPE_GGBACLTST, + + // mica2 integrated boards + XTYPE_MSP410 = 0xA0, + } XbowSensorboardType; typedef enum { AMTYPE_XUART = 0x00, ! AMTYPE_HEALTH = 0x03, AMTYPE_SURGE_MSG = 0x11, AMTYPE_XDEBUG = 0x31, *************** *** 107,110 **** --- 118,124 ---- #define XPACKET_DATASTART 12 //!< Default offset to data payload + #define XPACKET_BOARD_TABLE 0 //!< offset to XSensor board table + #define XPACKET_AM_TABLE 256 //!< offset to AM lookup table + enum { XPACKET_DECODE_MODE_AUTO = 0, *************** *** 151,154 **** --- 165,169 ---- void xpacket_decode (unsigned char *tos_packet, int len, int mode); void xpacket_add_type (XPacketHandler *handler); + void xpacket_add_amtype (XPacketHandler *handler); void xpacket_print_output (unsigned out_flags, unsigned char *tos_packet); void xpacket_print_time (); *************** *** 173,176 **** --- 188,196 ---- void xsocket_set_server (const char *server); const char * xsocket_get_server (); + int xsocket_read_packet (int serline, unsigned char *buffer); + + void mica2_initialize(); /* From boards/mica2.c */ + void mica2dot_initialize(); /* From boards/mica2dot.c */ + void micaz_initialize(); /* From boards/micaz.c */ /* Sensorboard specific conversion routines. */ *************** *** 189,195 **** --- 209,220 ---- void mep500_initialize(); /* From boards/mep500.c */ void mep401_initialize(); /* From boards/mep401.c */ + void ggbacltst_initialize(); /* From boards/ggbacltst.c */ + void msp410_initialize(); /* From boards/msp410.c */ void surge_initialize(); /* From boards/surge.c */ + void health_initialize(); /* From amtypes/health.c */ + + void xtutorial_initialize(); /* From baords/xtutorial.c */ #endif /* __SENSORS_H__ */ Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xdb.c 19 May 2005 19:58:17 -0000 1.1 --- xdb.c 19 May 2005 20:04:08 -0000 1.2 *************** *** 85,100 **** { int errno = 0; PGconn *conn = xdb_connect(); PQsendQuery(conn, command); PGresult *res = PQgetResult(conn); ! printf("%s\n", command); ! while (res != NULL) { errno = PQresultStatus(res); if (errno > PGRES_COMMAND_OK) fprintf(stderr, "error: DATABASE command failed: %i\n", errno); - res = PQgetResult(conn); PQclear(res); } /* close the connection to the database and cleanup */ PQfinish(conn); --- 85,101 ---- { int errno = 0; + printf("%s\n", command); + PGconn *conn = xdb_connect(); PQsendQuery(conn, command); PGresult *res = PQgetResult(conn); ! if (res != NULL) { errno = PQresultStatus(res); if (errno > PGRES_COMMAND_OK) fprintf(stderr, "error: DATABASE command failed: %i\n", errno); PQclear(res); } + /* close the connection to the database and cleanup */ PQfinish(conn); Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 19 May 2005 19:58:17 -0000 1.1 --- Makefile 19 May 2005 20:04:08 -0000 1.2 *************** *** 1,32 **** ! # Makefile for xlisten # $Id$ ! ! CC = gcc ! ARMCC = arm-linux-gcc ! INCDIR = /usr/local/arm/3.3.2/pgsql/include ! LIBDIR = /usr/local/arm/3.3.2/pgsql/lib ! LFLAGS = -lpq -lm ! CFLAGS = -O2 -Wall -Wno-format ! ! # Main xlisten sources ! SRCS = xlisten.c xpacket.c xconvert.c xdb.c ! SRCS += xserial.c xsocket.c ! ! # Add Mote Sensor board support ! SRCS += boards/mts300.c boards/mts400.c boards/mts510.c boards/mts101.c ! SRCS += boards/mep500.c boards/mep401.c boards/surge.c ! ! # Add Mote Data Aquisition board support ! SRCS += boards/mda500.c boards/mda300.c ! ! SRCS += timestamp/timestamp.c ! ! all: xlisten ! ! xlisten: $(SRCS) ! $(CC) $(CFLAGS) -o $@ $(SRCS) $(LFLAGS) ! ! xlisten-arm: $(SRCS) ! $(ARMCC) -I$(INCDIR) $(CFLAGS) -o $@ $(SRCS) -L$(LIBDIR) $(LFLAGS) ! ! clean: ! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe --- 1,43 ---- ! # Makefile for xlisten # $Id$ ! ! CC = gcc ! ARMCC = arm-linux-gcc ! INCDIR = /usr/local/arm/3.3.2/pgsql/include ! LIBDIR = /usr/local/arm/3.3.2/pgsql/lib ! LFLAGS = -lpq -lm ! CFLAGS = -O2 -Wall -Wno-format ! ! # Main xlisten sources ! SRCS = xlisten.c xpacket.c xconvert.c xdb.c ! SRCS += xserial.c xsocket.c ! ! # Add Mote Sensor board support ! SRCS += boards/mts300.c boards/mts400.c boards/mts510.c boards/mts101.c ! SRCS += boards/mep500.c boards/mep401.c boards/ggbacltst.c ! SRCS += boards/mica2.c boards/mica2dot.c boards/micaz.c ! ! # Add Mote Data Aquisition board support ! SRCS += boards/mda500.c boards/mda300.c ! ! # Add Mica2 integrated sensorboards ! SRCS += boards/msp410.c ! ! # Add support for "virtual" board that XsensorTutorial ! # uses during Training seminar ! SRCS += boards/xtutorial.c ! ! # Add AM types ! SRCS += amtypes/health.c amtypes/surge.c ! ! SRCS += timestamp/timestamp.c ! ! all: xlisten ! ! xlisten: $(SRCS) ! $(CC) $(CFLAGS) -o $@ $(SRCS) $(LFLAGS) ! ! xlisten-arm: $(SRCS) ! $(ARMCC) -I$(INCDIR) $(CFLAGS) -o $@ $(SRCS) -L$(LIBDIR) $(LFLAGS) ! ! clean: ! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe Index: xserial.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xserial.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xserial.c 19 May 2005 19:58:17 -0000 1.1 --- xserial.c 19 May 2005 20:04:08 -0000 1.2 *************** *** 73,76 **** --- 73,77 ---- struct termios newtio; bzero(&newtio, sizeof(newtio)); + newtio.c_cc[VMIN] = 1; newtio.c_cflag = CS8 | CLOCAL | CREAD; newtio.c_iflag = IGNBRK | IGNPAR; Index: xlisten.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xlisten.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xlisten.c 19 May 2005 19:58:17 -0000 1.1 --- xlisten.c 19 May 2005 20:04:08 -0000 1.2 *************** *** 40,44 **** unsigned mode_version : 1; //!< print versions of all modules unsigned mode_header : 1; //!< user using custom packet header ! unsigned mode_socket : 1; //!< connect to a serial forwarder unsigned mode_framing : 2; //!< auto=0, framed=1, unframed=2 } bits; --- 40,45 ---- unsigned mode_version : 1; //!< print versions of all modules unsigned mode_header : 1; //!< user using custom packet header ! unsigned mode_socket : 1; //!< connect to a serial socket ! unsigned mode_sf : 1; //!< connect to a serial forwarder unsigned mode_framing : 2; //!< auto=0, framed=1, unframed=2 } bits; *************** *** 108,117 **** case 'x': switch (argv[argc][2]) { case 'r': g_params.bits.export_parsed = 1; break; - default: g_params.bits.export_cooked = 1; break; } ! break; ! case 'f': { switch (argv[argc][2]) { case '=': // specify arbitrary offset --- 109,119 ---- case 'x': switch (argv[argc][2]) { + case 'c': g_params.bits.export_cooked = 1; break; + default: case 'r': g_params.bits.export_parsed = 1; break; } ! break; ! case 'f': switch (argv[argc][2]) { case '=': // specify arbitrary offset *************** *** 121,138 **** case 'a': // automatic deframing g_params.bits.mode_framing = 0; ! break; case '0': case 'n': // assume no framing g_params.bits.mode_framing = 2; ! break; case '1': // force framing ! default: g_params.bits.mode_framing = 1; break; } break; ! } case 'w': --- 123,140 ---- case 'a': // automatic deframing g_params.bits.mode_framing = 0; ! break; case '0': case 'n': // assume no framing g_params.bits.mode_framing = 2; ! break; case '1': // force framing ! default: g_params.bits.mode_framing = 1; break; } break; ! case 'w': *************** *** 151,155 **** xpacket_set_start(offset); break; ! } case 'l': --- 153,157 ---- xpacket_set_start(offset); break; ! } case 'l': *************** *** 157,162 **** if (argv[argc][2] == '=') { xdb_set_table(argv[argc]+3); ! // xdb_create_table(argv[argc]+3); ! } case 'b': --- 159,164 ---- if (argv[argc][2] == '=') { xdb_set_table(argv[argc]+3); ! } ! break; case 'b': *************** *** 168,173 **** case 's': ! if (argv[argc][2] == '=') { ! xserial_set_device(argv[argc]+3); } break; --- 170,191 ---- case 's': ! switch (argv[argc][2]) { ! case '=': ! xserial_set_device(argv[argc]+3); ! break; ! ! case 'f': ! g_params.bits.mode_sf = 1; ! g_params.bits.mode_socket = 1; ! if (argv[argc][3] == '=') { ! server = argv[argc]+4; ! port = strchr(server, ':'); ! if (port) { ! *port++ = '\0'; ! xsocket_set_port(port); ! } ! xsocket_set_server(server); ! } ! break; } break; *************** *** 178,181 **** --- 196,200 ---- case 'i': + g_params.bits.mode_sf = 0; g_params.bits.mode_socket = 1; if (argv[argc][2] == '=') { *************** *** 235,254 **** "\nUsage: xlisten <-?|r|p|c|x|l|d|v|q> <-l=table>" "\n <-s=device> <-b=baud> <-i=server:port>" ! "\n -? = display help [help]" ! "\n -r = raw display of tos packets [raw]" ! "\n -a = ascii display of tos packets [ascii]" ! "\n -p = parse packet into raw sensor readings [parsed]" ! "\n -x = export readings in csv spreadsheet format [export]" ! "\n -c = convert data to engineering units [cooked]" ! "\n -l = log data to database or file [logged]" ! "\n -d = debug serial port by dumping bytes [debug]" ! "\n -b = set the baudrate [baud=#|mica2|mica2dot]" ! "\n -s = set serial port device [device=com1]" ! "\n -i = use serial forwarder input [inet=host:port]" ! "\n -o = output (forward serial) to port [onet=port] -!TBA!-" ! "\n -h = specify header size [header=offset]" ! "\n -t = display time packet was received [timed]" ! "\n -q = quiet mode (suppress headers)" ! "\n -v = show version of all modules" "\n" ); --- 254,275 ---- "\nUsage: xlisten <-?|r|p|c|x|l|d|v|q> <-l=table>" "\n <-s=device> <-b=baud> <-i=server:port>" ! "\n -? = display help [help]" ! "\n -r = raw display of tos packets [raw]" ! "\n -a = ascii display of tos packets [ascii]" ! "\n -p = parse packet into raw sensor readings [parsed]" ! "\n -c = convert data to engineering units [cooked]" ! "\n -l = log data to database or file [logged]" ! "\n -xr = export raw readings in csv spreadsheet format [export]" ! "\n -xc = export cooked in csv spreadsheet format [export]" ! "\n -d = debug serial port by dumping bytes [debug]" ! "\n -b = set the baudrate [baud=#|mica2|mica2dot]" ! "\n -s = set serial port device [device=com1]" ! "\n -i = use socket input [inet=host:port]" ! "\n -sf = use serial forwarder input [inet=host:port]" ! "\n -f = specify framing (0=auto|1=on|2=off)" ! "\n -h = specify header size [header=offset]" ! "\n -t = display time packet was received [timed]" ! "\n -q = quiet mode (suppress headers)" ! "\n -v = show version of all modules" "\n" ); *************** *** 297,301 **** while (1) { ! length = xserial_port_read_packet(g_istream, buffer); if (length < XPACKET_MIN_SIZE) --- 318,328 ---- while (1) { ! if (g_params.bits.mode_sf) { ! // Serial forwarder read ! length = xsocket_read_packet(g_istream, buffer); ! } else { ! // Serial read direct, or over socket (mib600) ! length = xserial_port_read_packet(g_istream, buffer); ! } if (length < XPACKET_MIN_SIZE) *************** *** 308,312 **** if (g_params.bits.display_ascii) xpacket_print_ascii(buffer, length); ! xpacket_decode(buffer, length, g_params.bits.mode_framing); if (g_params.bits.display_parsed) xpacket_print_parsed(buffer); --- 335,340 ---- if (g_params.bits.display_ascii) xpacket_print_ascii(buffer, length); ! if (!g_params.bits.mode_sf) ! xpacket_decode(buffer, length, g_params.bits.mode_framing); if (g_params.bits.display_parsed) xpacket_print_parsed(buffer); *************** *** 339,349 **** @n -x = export readings in csv spreadsheet format [export] @n -c = convert data to engineering units [cooked] ! @n -t = display time packet was received [timed]" ! @n -a = ascii display of tos packets [ascii]" @n -l = log data to database [logged] @n -d = debug serial port by dumping bytes [debug] @n -b = set the baudrate [baud=#|mica2|mica2dot] @n -s = set serial port device [device=com1] ! @n -i = use serial forwarder input [inet=host:port]" @n -h = specify size of TOS_msg header [header=size] @n -v = display complete version information for all modules [version] --- 367,378 ---- @n -x = export readings in csv spreadsheet format [export] @n -c = convert data to engineering units [cooked] ! @n -t = display time packet was received [timed] ! @n -a = ascii display of tos packets [ascii] @n -l = log data to database [logged] @n -d = debug serial port by dumping bytes [debug] @n -b = set the baudrate [baud=#|mica2|mica2dot] @n -s = set serial port device [device=com1] ! @n -i = use socket input [inet=host:port] ! @n -sf = use serial forwarder input [inet=host:port] @n -h = specify size of TOS_msg header [header=size] @n -v = display complete version information for all modules [version] *************** *** 367,370 **** --- 396,405 ---- This flag gives the user the ability to specify which COM port or device xlisten should use. The default port is /dev/ttyS0 or the UNIX equivalent to COM1. The given port must be passed directly after the equals sign with no spaces, i.e. -s=com3. + @subsection internet -i=hostname:port [inet] + This flag tells xlisten to attach to a virtual serial connection over a TCP/IP internet socket. Specify the hostname and port to connect in the argument. The default hostname is localhost, and the default port 9001. The keyword 'mib600' can be passed as an alias to port 10002 when connecting to that hardware device. The hostname and port must be passed directly after the equals sign with no spaces with a optional colon inbetween, i.e. -i=remote, -i=10.1.1.1:9000, -i=mymib:mib600, -i=:9002, -i=localhost:9003, or -i=stargate.xbow.com. + + @subsection serial forwarder -sf=hostname:port [inet] + This flag tells xlisten to attach to a serial forwarder connection over a TCP/IP internet socket. The hostname and port arguments are the same as the -i flag. The -sf flag tells xlisten to specifically use the TinyOS serial forwarder protocol. + @subsection raw -r [raw] Raw mode displays the actual TOS packets as a sequence of bytes as seen coming over the serial line. Sample output follows: |
From: David M. D. <do...@us...> - 2005-05-19 20:04:19
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/timestamp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5174/timestamp Modified Files: timestamp.c timestamp.h Log Message: Using xbow stable for this code. |
From: David M. D. <do...@us...> - 2005-05-19 20:04:19
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5174/boards Modified Files: mda300.c mts101.c mts400.c Log Message: Using xbow stable for this code. Index: mts400.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/mts400.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mts400.c 19 May 2005 19:58:18 -0000 1.1 --- mts400.c 19 May 2005 20:04:09 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- * @version 2004/3/10 mturon Initial version * @n 2004/3/28 husiquan Added temp,pressure,accel,light,gps + * @n 2004/11/15 husiquan Added database logging * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. *************** *** 13,21 **** */ #include <math.h> [...970 lines suppressed...] mts400_print_cooked, mts400_print_raw, ! mts400_print_cooked, ! mts400_log_raw }; *************** *** 635,639 **** mts420_print_cooked, mts420_print_raw, ! mts420_print_cooked }; --- 1056,1061 ---- mts420_print_cooked, mts420_print_raw, ! mts420_print_cooked, ! mts420_log_raw }; Index: mda300.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/mda300.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mda300.c 19 May 2005 19:58:18 -0000 1.1 --- mda300.c 19 May 2005 20:04:08 -0000 1.2 *************** *** 68,71 **** --- 68,84 ---- } __attribute__ ((packed)) XSensorMDA300Data5; + //pp:multihop need only the packet6 + typedef struct XSensorMDA300Data6 { + uint16_t vref; + uint16_t humid; + uint16_t humtemp; + uint16_t adc0; + uint16_t adc1; + uint16_t adc2; + uint16_t dig0; + uint16_t dig1; + uint16_t dig2; + } __attribute__ ((packed)) XSensorMDA300Data6; + extern XPacketHandler mda300_packet_handler; /** *************** *** 101,105 **** case 3: { XSensorMDA300Data3 *data = (XSensorMDA300Data3 *)packet->data; ! printf("mda300 id=%02x d1=%04x d2=%04x d3=%04x d4=%04x d5=%04x\n", packet->node_id, data->digi0, data->digi1, data->digi2, data->digi3, data->digi4, data->digi5); --- 114,118 ---- case 3: { XSensorMDA300Data3 *data = (XSensorMDA300Data3 *)packet->data; ! printf("mda300 id=%02x d1=%04x d2=%04x d3=%04x d4=%04x d5=%04x", packet->node_id, data->digi0, data->digi1, data->digi2, data->digi3, data->digi4, data->digi5); *************** *** 124,127 **** --- 137,151 ---- break; } + case 6: { + XSensorMDA300Data6 *data = (XSensorMDA300Data6 *)packet->data; + printf("mda300 id=%02x bat=%04x hum=%04x temp=%04x " + " adc0=%04x adc1=%04x adc2=%04x\n" + " dig0=%04x dig1=%04x dig2=%04x\n", + packet->node_id, data->vref, + data->humid, data->humtemp, + data->adc0, data->adc1, data->adc2, + data->dig0, data->dig1, data->dig2); + break; + } default: *************** *** 219,222 **** --- 243,271 ---- } + /** MDA300 specific display of converted readings for packet 5 */ + void mda300_print_cooked_6(XbowSensorboardPacket *packet) + { + XSensorMDA300Data6 *data = (XSensorMDA300Data6 *)packet->data; + XSensorSensirion xsensor; + xsensor.humidity=data->humid; + xsensor.thermistor=data->humtemp; + printf("MDA300 [sensor data converted to engineering units]:\n" + " health: node id=%i parent=%i battery=%i mV\n" + " echo10: Soil Moisture=%0.2f %%\n" + " echo20: Soil Moisture=%0.2f %%\n" + " soil temperature =%0.2f F\n" + " temperature: =%0.2f C \n" + " humidity: =%0.1f %% \n\n", + packet->node_id, packet->parent, + xconvert_battery_mica2(data->vref), + xconvert_echo10(data->adc0), + xconvert_echo20(data->adc1), + xconvert_spectrum_soiltemp(data->adc2), + xconvert_sensirion_temp(&(xsensor)), + xconvert_sensirion_humidity(&(xsensor)) + ); + } + + /** MDA300 specific display of converted readings from an XSensor packet. */ void mda300_print_cooked(XbowSensorboardPacket *packet) *************** *** 243,246 **** --- 292,298 ---- break; + case 6: + mda300_print_cooked_6(packet); + break; default: printf("MDA300 Error: unknown packet id (%i)\n\n", packet->packet_id); *************** *** 248,251 **** --- 300,337 ---- } + const char *mda300_db_create_table[6] = + { + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "nodeid integer, parent integer, " + "adc0 integer, adc1 integer, adc2 integer,adc3 integer,adc4 integer,adc5 integer,adc6 integer )", + + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "nodeid integer, parent integer, " + "adc7 integer, adc8 integer,adc9 integer,adc10 integer,adc11 integer,adc12 integer,adc13 integer)", + + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "nodeid integer, parent integer, " + "digi0 integer,digi1 integer,digi2 integer,digi3 integer,digi4 integer,digi5 integer)", + + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "nodeid integer, parent integer, " + "voltage integer,sensirionhumidity integer, sensirionthermistor integer, counter integer)", + + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "epoch integer, nodeid integer, parent integer, " + "echo10 integer, echo20 integer, soiltemp integer, " + "voltage integer,humid integer, humtemp integer)", + + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "nodeid integer, parent integer, " + "adc0 integer, adc1 integer, adc2 integer, " + "digi0 integer,digi1 integer,digi2 integer," + "voltage integer,humid integer, humtemp integer)" + }; + const char *mda300_db_create_rule = + "CREATE RULE cache_%s AS ON INSERT TO %s DO ( " + "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " + "INSERT INTO %s_L VALUES (NEW.*); )"; + /** *************** *** 259,267 **** void mda300_log_raw(XbowSensorboardPacket *packet) { ! XSensorMDA300Data5 *data = (XSensorMDA300Data5 *)packet->data; ! if (packet->packet_id != 5) return; ! char command[512]; ! char *table = "mda300_results"; sprintf(command, --- 345,461 ---- void mda300_log_raw(XbowSensorboardPacket *packet) { ! uint8_t i; ! char command[512]; ! char *tablename[6]; ! char tmpName[20]; ! char* table; ! table = xdb_get_table(); ! if (!*table) ! { ! sprintf(tmpName,"mda300s%i_results",packet->packet_id); ! table=tmpName; ! } ! tablename[0]="mda300p1_results"; ! tablename[1]="mda300p2_results"; ! tablename[2]="mda300p3_results"; ! tablename[3]="mda300p4_results"; ! tablename[4]="mda300p5_results"; ! tablename[5]="mda300p6_results"; ! ! if (!mda300_packet_handler.flags.table_init) { ! int exists = xdb_table_exists(table); ! if (!exists) { ! for(i=0;i<6;i++) ! { ! // Create results table. ! sprintf(command, mda300_db_create_table[i], tablename[i], ""); ! xdb_execute(command); ! // Create last result cache ! sprintf(command, mda300_db_create_table[i], tablename[i], "_L"); ! xdb_execute(command); ! ! // Add rule to populate last result table ! sprintf(command, mda300_db_create_rule, tablename[i], tablename[i], tablename[i], tablename[i]); ! xdb_execute(command); ! ! // Add results table to query log. ! int q_id = XTYPE_MDA300, sample_time = 99000; ! sprintf(command, "INSERT INTO task_query_log " ! "(query_id, tinydb_qid, query_text, query_type, " ! "table_name) VALUES (%i, %i, 'SELECT nodeid,parent," ! "adc0, adc1, adc2,adc3,adc4,adc5,adc6, " ! "adc7, adc8, adc9, adc10, adc11, adc12, adc13," ! "digi0, digi1, digi2, digi3, digi4, digi5," ! "voltage,sensirionhumidity,sensirionthermistor,counter " ! "SAMPLE PERIOD %i', 'sensor', '%s')", q_id, q_id, ! sample_time, tablename[i]); ! xdb_execute(command); ! ! // Log start time of query in time log. ! sprintf(command, "INSERT INTO task_query_time_log " ! "(query_id, start_time) VALUES (%i, now())", q_id); ! xdb_execute(command); ! } ! } ! mda300_packet_handler.flags.table_init = 1; ! } ! ! switch(packet->packet_id){ ! case 1:{ ! XSensorMDA300Data1 *data = (XSensorMDA300Data1 *)packet->data; ! ! sprintf(command, ! "INSERT into %s " ! "(result_time,nodeid,parent,adc0, adc1, adc2,adc3,adc4,adc5,adc6)" ! " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u)", ! tablename[0], ! //timestring, ! packet->node_id, packet->parent, ! data->adc0, data->adc1,data->adc2, data->adc3, data->adc4, data->adc5, data->adc6 ! ); ! break; ! } ! case 2:{ ! XSensorMDA300Data2 *data = (XSensorMDA300Data2 *)packet->data; ! sprintf(command, ! "INSERT into %s " ! "(result_time,nodeid,parent,adc7, adc8, adc9, adc10, adc11, adc12, adc13)" ! " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u)", ! tablename[1], ! //timestring, ! packet->node_id, packet->parent, ! data->adc9, data->adc10, data->adc11, data->adc12, data->adc13 ! ); ! break; ! } ! case 3:{ ! XSensorMDA300Data3 *data = (XSensorMDA300Data3 *)packet->data; ! sprintf(command, ! "INSERT into %s " ! "(result_time,nodeid,parent,digi0, digi1, digi2, digi3, digi4, digi5)" ! " values (now(),%u,%u,%u,%u,%u,%u,%u,%u)", ! tablename[2], ! //timestring, ! packet->node_id, packet->parent, ! data->digi0, data->digi1, data->digi2, data->digi3, data->digi4, data->digi5 ! ); ! break; ! } ! case 4:{ ! XSensorMDA300Data4 *data = (XSensorMDA300Data4 *)packet->data; ! sprintf(command, ! "INSERT into %s " ! "(result_time,nodeid,parent,voltage,sensirionhumidity, sensirionthermistor, counter)" ! " values (now(),%u,%u,%u,%u,%u,%u)", ! tablename[3], ! //timestring, ! packet->node_id, packet->parent, ! data->battery, data->sensirion.humidity,data->sensirion.thermistor, data->counter ! ); ! break; ! } ! case 5:{ ! XSensorMDA300Data5 *data = (XSensorMDA300Data5 *)packet->data; sprintf(command, *************** *** 270,274 **** "humid,humtemp,echo10,echo20,soiltemp)" " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u)", ! table, //timestring, packet->node_id, packet->parent, --- 464,468 ---- "humid,humtemp,echo10,echo20,soiltemp)" " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u)", ! tablename[4], //timestring, packet->node_id, packet->parent, *************** *** 276,282 **** data->sensirion.humidity, data->sensirion.thermistor, data->adc0, data->adc1, data->adc2 ! ); xdb_execute(command); } --- 470,503 ---- data->sensirion.humidity, data->sensirion.thermistor, data->adc0, data->adc1, data->adc2 ! ); ! break; ! } ! case 6:{ ! XSensorMDA300Data6 *data = (XSensorMDA300Data6 *)packet->data; ! ! sprintf(command, ! "INSERT into %s " ! "(result_time,nodeid,parent,voltage," ! "humid,humtemp,echo10,echo20,soiltemp,digi0, digi1, digi2)" ! " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u)", ! tablename[5], ! //timestring, ! packet->node_id, packet->parent, ! data->vref, ! data->humid, data->humtemp, ! data->adc0, data->adc1, data->adc2, ! data->dig0, data->dig1, data->dig2 ! ); ! break; ! } ! ! default: ! //printf("mda300 error: unknown packet_id (%i)\n", packet->packet_id); ! break; ! } xdb_execute(command); + + } Index: mts101.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/mts101.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mts101.c 19 May 2005 19:58:18 -0000 1.1 --- mts101.c 19 May 2005 20:04:09 -0000 1.2 *************** *** 24,27 **** --- 24,29 ---- } XSensorMTS101Data; + extern XPacketHandler mts101_packet_handler; + /** * Converts mica2 battery reading from raw ADC data to engineering units. *************** *** 155,158 **** --- 157,231 ---- } + const char *mts101_db_create_table = + "CREATE TABLE %s%s ( result_time timestamp without time zone, " + "epoch integer, nodeid integer, parent integer, " + "voltage integer, temp integer, light integer)"; + + const char *mts101_db_create_rule = + "CREATE RULE cache_%s AS ON INSERT TO %s DO ( " + "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " + "INSERT INTO %s_L VALUES (NEW.*); )"; + + /** + * Logs raw readings to a Postgres database. + * + * @author Martin Turon + * + * @version 2004/7/28 mturon Initial revision + * + */ + void mts101_log_raw(XbowSensorboardPacket *packet) + { + XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; + + char command[512]; + char *table = xdb_get_table(); + if (!*table) table = "mts101_results"; + + if (!mts101_packet_handler.flags.table_init) { + int exists = xdb_table_exists(table); + if (!exists) { + // Create results table. + sprintf(command, mts101_db_create_table, table, ""); + xdb_execute(command); + // Create last result cache + sprintf(command, mts101_db_create_table, table, "_L"); + xdb_execute(command); + + // Add rule to populate last result table + sprintf(command, mts101_db_create_rule, table, table, table, table); + xdb_execute(command); + + // Add results table to query log. + int q_id = XTYPE_MTS101, sample_time = 99000; + sprintf(command, "INSERT INTO task_query_log " + "(query_id, tinydb_qid, query_text, query_type, " + "table_name) VALUES (%i, %i, 'SELECT nodeid,parent,voltage,temp,light " + "SAMPLE PERIOD %i', 'sensor', '%s')", q_id, q_id, + sample_time, table); + xdb_execute(command); + + // Log start time of query in time log. + sprintf(command, "INSERT INTO task_query_time_log " + "(query_id, start_time) VALUES (%i, now())", q_id); + xdb_execute(command); + } + mts101_packet_handler.flags.table_init = 1; + } + + sprintf(command, + "INSERT into %s " + "(result_time,nodeid,parent,voltage,temp,light)" + " values (now(),%u,%u,%u,%u,%u)", + table, + //timestring, + packet->node_id, packet->parent, + data->battery, data->thermistor, data->light + ); + + xdb_execute(command); + } + + XPacketHandler mts101_packet_handler = { *************** *** 162,166 **** mts101_print_cooked, mts101_print_raw, ! mts101_print_cooked }; --- 235,240 ---- mts101_print_cooked, mts101_print_raw, ! mts101_print_cooked, ! mts101_log_raw }; |
From: David M. D. <do...@us...> - 2005-05-19 19:58:29
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755/boards Added Files: mda300.c mts101.c mts400.c Log Message: Starting code for xlisten modifications. --- NEW FILE: mts400.c --- /** * Handles conversion to engineering units of mts400/420 packets. * * @file mts400.c * @author Martin Turon, Hu Siquan * * @version 2004/3/10 mturon Initial version * @n 2004/3/28 husiquan Added temp,pressure,accel,light,gps * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: mts400.c,v 1.1 2005/05/19 19:58:18 doolin Exp $ */ #include <math.h> #include "../xsensors.h" /** MTS400/420 XSensor packet 1 -- contains all MTS400/420 weather sensors readings */ typedef struct { uint16_t battery; uint16_t humidity; uint16_t temp; uint16_t cal_word1; //!< Pressure calibration word 1 uint16_t cal_word2; //!< Pressure calibration word 2 uint16_t cal_word3; //!< Pressure calibration word 3 uint16_t cal_word4; //!< Pressure calibration word 4 uint16_t intersematemp; uint16_t intersemapressure; uint16_t taosch0; uint16_t taosch1; uint16_t accel_x; } XSensorMTS400Data1; /** * Packet data size limitations force us to stretch * accel_y information into reserved section of packet. * header reserved = high byte, footer reserved2 = low byte. * This accel_y access code is not the most elegant, but serves * as a reminder to heed size limitations in the AM packet. * * @version 2004/4/29 mturon Initial version */ #define reserved parent #define reserved2 terminator #define GET_ACCEL_Y (packet->reserved << 8) | (packet->reserved2) /** MTS420 XSensor packet 2 -- contains gps readings */ typedef struct { uint8_t hours; //Hours uint8_t minutes;//Minutes uint8_t Lat_deg;//Latitude degrees uint8_t Long_deg;//Longitude degrees uint32_t dec_sec;//Decimal seconds uint32_t Lat_dec_min;//Latitude decimal minutes uint32_t Long_dec_min;//Longitude decimal minutes uint8_t NSEWind;//NSEWind uint8_t Fixed; // as to whether the packet is valid(i.e. has the gps Fixed on to the sattelites). }XSensorMTS420GPSData; /** * Converts mica2 battery reading from raw ADC data to engineering units. * * @author Martin Turon * * To compute the battery voltage after measuring the voltage ref: * BV = RV*ADC_FS/data * where: * BV = Battery Voltage * ADC_FS = 1023 * RV = Voltage Reference for mica2 (1.223 volts) * data = data from the adc measurement of channel 1 * BV (volts) = 1252.352/data * BV (mv) = 1252352/data * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @version 2004/3/29 mturon Initial revision * */ uint16_t mts400_convert_battery(XbowSensorboardPacket *packet) { XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; float x = (float)data->battery; uint16_t vdata = (uint16_t) (1252352 / x); return vdata; } /** * Computes the pressure ADC count of Intersema MS5534A barometric * pressure/temperature sensor - reading into Engineering Units (mbar) * * @author Hu Siquan * * Intersema MS5534A barometric pressure/temperature sensor * - 6 cal coefficients (C1..C6) are extracted from 4,16 bit,words from sensor * - Temperature measurement: * UT1=8*C5+20224 * dT=data-UT1 * Temp=(degC x10)=200+dT(C6+50)/1024 * - Pressure measurement: * OFF=C2*4 + ((C4-512)*dT)/1024 * SENS=C1+(C3*dT)/1024 + 24576 * X=(SENS*(PressureData-7168))/16384 - OFF * Press(mbar)= X/32+250 * * @version 2004/3/29 husiquan Initial revision */ int mts400_convert_intersemapressure(XbowSensorboardPacket *packet) { float UT1,dT; float OFF,SENS,X,Press; uint16_t PressureData, TempData; uint16_t calibration[4]; //intersema calibration words uint16_t C1,C2,C3,C4,C5;//,C6; //intersema calibration coefficients XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; calibration[0] = data->cal_word1; calibration[1] = data->cal_word2; calibration[2] = data->cal_word3; calibration[3] = data->cal_word4; PressureData = data->intersemapressure; TempData = data->intersematemp; C1 = calibration[0] >> 1; C2 = ((calibration[2] & 0x3f) << 6) | (calibration[3] & 0x3f); C3 = calibration[3] >> 6; C4 = calibration[2] >> 6; C5 = ((calibration[0] & 1) << 10) | (calibration[1] >> 6); // C6 = calibration[1] & 0x3f; UT1=8*(float)C5+20224; dT = (float)TempData-UT1; OFF = (float)C2*4 + (((float)C4-512.0)*dT)/1024; SENS = (float)C1 + ((float)C3*dT)/1024 + 24576; X = (SENS*((float)PressureData-7168.0))/16384 - OFF; Press = X/32.0 + 250.0; return (int)Press; } /** * Computes the temperature ADC count of Intersema MS5534A barometric * pressure/temperature sensor - reading into Engineering Unit (degC) * * @author Hu Siquan * * @version 2004/3/29 husiquan Initial revision */ int mts400_convert_intersematemp(XbowSensorboardPacket *packet) { float UT1,dT,Temp; uint16_t TempData; uint16_t calibration[2]; //intersema calibration words uint16_t C5,C6; //intersema calibration coefficients XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; TempData = data->intersematemp; calibration[0] = data->cal_word1; calibration[1] = data->cal_word2; C5 = ((calibration[0] & 1) << 10) | (calibration[1] >> 6); C6 = calibration[1] & 0x3f; UT1=8*(float)C5+20224; dT = (float)TempData-UT1; //temperature (degCx10) Temp = 200.0 + dT*((float)C6+50.0)/1024.0; //temperature (degC) Temp /=10.0; return (int)Temp; } /** * Computes the humidity ADC count of Sensirion SHT11 humidity/temperature * sensor - reading into Engineering Units (%) * * @author Hu Siquan * * Sensirion SHT11 humidity/temperature sensor * - Humidity data is 12 bit: * Linear calc (no temp correction) * fRH = -4.0 + 0.0405 * data -0.0000028 * data^2 'RH linear * With temperature correction: * fRH = (fTemp - 25) * (0.01 + 0.00008 * data) + fRH 'RH true * - Temperature data is 14 bit * Temp(degC) = -38.4 + 0.0098 * data * * @version 2004/3/29 husiquan Initial revision */ int mts400_convert_humidity(XbowSensorboardPacket *packet){ float fTemp,fHumidity; uint16_t HumData, TempData; XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; HumData = data->humidity; TempData = data->temp; fTemp = -38.4 + 0.0098*(float)TempData; fHumidity = -4.0 + 0.0405 * HumData -0.0000028 * HumData * HumData; fHumidity= (fTemp-25.0)* (0.01 + 0.00008 * HumData) + fHumidity; return (int)fHumidity; } /** * Computes the temperature ADC count of Sensirion SHT11 humidity/temperature * sensor - reading into Engineering Units (degC) * * @author Hu Siquan * * @version 2004/3/29 husiquan Initial revision */ int mts400_convert_temp(XbowSensorboardPacket *packet) { float fTemp; uint16_t TempData; XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; TempData = data->temp; fTemp = -38.4 + 0.0098*(float)TempData; return (int)fTemp; } /** * Computes the ADC count of Taos- tsl2250 light sensor - reading into * Engineering Unit (lux) * * @author Hu Siquan * * Taos- tsl2250 light sensor * Two ADC channels: * ADC Count Value (ACNTx) = INT(16.5*[CV-1]) +S*CV * where CV = 2^^C * C = (data & 0x7) >> 4 * S = data & 0xF * Light level (lux) = ACNT0*0.46*(e^^-3.13*R) * R = ACNT1/ACNT0 * * @version 2004/3/29 husiquan Initial revision */ float mts400_convert_light(XbowSensorboardPacket *packet) { uint16_t taosch0, taosch1; uint16_t ChData,CV1,CH1,ST1; int ACNT0,ACNT1; float CNT1,R,Lux; XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; taosch0 = data->taosch0; taosch1 = data->taosch1; ChData = taosch0 & 0x00ff; if (ChData == 0xff) return -1.0; // Taos Ch0 data: OVERFLOW ST1 = ChData & 0xf; CH1 = (ChData & 0x70) >> 4; CV1 = 1 << CH1; CNT1 = (int)(16.5*(CV1-1)) + ST1*CV1; ACNT0 = (int)CNT1; ChData = taosch1 & 0xff; if (ChData == 0xff) return -1.0; // Taos Ch1 data: OVERFLOW ST1 = ChData & 0xf; CH1 = (ChData & 0x70) >> 4; CV1 = 1 << CH1; CNT1 = (int)(16.5*(CV1-1)) + ST1*CV1; ACNT1 = (int)CNT1; R = ((float)ACNT1)/((float)ACNT0); Lux = (float)ACNT0*0.46/exp(3.13*R); return Lux; } /** * Computes the ADC count of a Accelerometer - for X axis reading into * Engineering Unit (mg) * * @author Hu Siquan * * ADXL202E Accelerometer * At 3.0 supply this sensor's sensitivty is ~167mv/g * 0 g is at ~1.5V or ~VCC/2 - this varies alot. * For an accurate calibration measure each axis at +/- 1 g and * compute the center point (0 g level) as 1/2 of difference. * Note: this app doesn't measure the battery voltage, it assumes 3.2 volts * To getter better accuracy measure the battery voltage as this effects the * full scale of the Atmega128 ADC. * bits/mv = 1024/(1000*VBATT) * bits/g = 1024/(1000*VBATT)(bits/mv) * 167(mv/g) * = 171/VBATT (bits/g) * C = 0.171/VBATT (bits/mg) * Accel(mg) ~ (ADC DATA - 512) /C * * @version 2004/3/29 husiquan Initial revision */ float mts400_convert_accel_x(XbowSensorboardPacket *packet) { uint16_t AccelData; XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; AccelData = data->accel_x; /* float Accel, C; XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; AccelData = data->accel_x; //float VBATT = 3.2; float VBATT = mts400_convert_battery(packet); C = 171.0/VBATT; Accel = ((float)AccelData - 512.0)/C; return Accel;*/ uint16_t minus_one_calibration; uint16_t plus_one_calibration; float scale_factor; float reading; minus_one_calibration = 417; plus_one_calibration = 537; scale_factor = ( plus_one_calibration - minus_one_calibration ) / 2; reading = 1.0 - (plus_one_calibration - AccelData) / scale_factor; reading = reading*1000.0; return reading; } /** * Computes the ADC count of a Accelerometer - for Y axis reading into * Engineering Unit (mg) * * @author Hu Siquan * * @version 2004/3/29 husiquan Initial revision * */ float mts400_convert_accel_y(XbowSensorboardPacket *packet) { uint16_t AccelData; //XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; AccelData = GET_ACCEL_Y; /* // float VBATT = 3.2; float VBATT = mts400_convert_battery(packet); // mV C = 171.0/VBATT; Accel = ((float)AccelData - 512.0)/C; // SODbg(DBG_BOOT, "AccelY data %i AcceY(mg) %i \n",data, (int)Accel); return Accel;*/ uint16_t minus_one_calibration; uint16_t plus_one_calibration; float scale_factor; float reading; minus_one_calibration = 272; plus_one_calibration = 666; scale_factor = ( plus_one_calibration - minus_one_calibration ) / 2; reading = 1.0 - (plus_one_calibration - AccelData) / scale_factor; reading = reading*1000.0; return reading; } /** * Computes the gps GGA decimal seconds * * @author Hu Siquan * * @version 2004/4/2 husiquan Initial revision * */ double mts420_convert_dec_sec(XbowSensorboardPacket *packet){ XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; return (data->dec_sec)/1000.0; } /** * Computes the gps GGA Latitude seconds * * @author Hu Siquan * * @version 2004/4/2 husiquan Initial revision * */ double mts420_convert_Lat_dec_min(XbowSensorboardPacket *packet){ XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; return (data->Lat_dec_min)/10000.0; } /** * Computes the gps GGA Longitude seconds * * @author Hu Siquan * * @version 2004/4/2 husiquan Initial revision * */ float mts420_convert_Long_dec_min(XbowSensorboardPacket *packet){ XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; return (data->Long_dec_min)/10000.0; } /** * Computes the gps GGA North/South indicator * * @author Hu Siquan * * @version 2004/4/2 husiquan Initial revision * */ char mts420_convert_NS_ind(XbowSensorboardPacket *packet){ XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; return ((data->NSEWind>>4)==0)?'S':'N'; } /** * Computes the gps GGA East/West indicator * * @author Hu Siquan * * @version 2004/4/2 husiquan Initial revision * */ char mts420_convert_EW_ind(XbowSensorboardPacket *packet){ XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; return ((data->NSEWind&0xf)==0)?'E':'W'; } /** MTS400 Specific outputs of raw readings within an XBowSensorboardPacket */ void mts400_print_raw(XbowSensorboardPacket *packet) { XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; printf("mts400 id=%02x " "battery=%04x humidity=%04x temp=%04x \n" "intersema calibration words(1..4) = %04x,%04x,%04x,%04x \n" "intersematemp=%04x intersemapressure=%04x \n" "taosch0=%04x taosch1=%04x accel_x=%04x accel_y=%04x\n", packet->node_id, data->battery, data->humidity, data->temp, data->cal_word1,data->cal_word2,data->cal_word3,data->cal_word4, data->intersematemp, data->intersemapressure, data->taosch0,data->taosch1, data->accel_x, GET_ACCEL_Y); } void mts400_print_cooked(XbowSensorboardPacket *packet) { XSensorMTS400Data1 *pd; pd = (XSensorMTS400Data1 *) packet->data; float light = mts400_convert_light(packet); // cooked output printf("MTS400 [sensor data converted to engineering units]:\n" " health: node id = %i\n" " battery: = %i mv \n" " humidity: = %i %% \n" " Temperature: = %i degC \n" " IntersemaTemperature: = %i degC \n" " IntersemaPressure: = %i mbar \n", packet->node_id, mts400_convert_battery(packet), mts400_convert_humidity(packet), mts400_convert_temp(packet), mts400_convert_intersematemp(packet), mts400_convert_intersemapressure(packet) ); if(light<-0.5) printf(" One of the CHs overflow,Light reading invalid.\n"); else printf(" Light: = %f lux \n",light); printf(" X-axis Accel: = %f mg \n" " Y-axis Accel: = %f mg \n", mts400_convert_accel_x(packet), mts400_convert_accel_y(packet)); printf("\n"); } /** MTS420 Specific outputs of raw readings within an XBowSensorboardPacket */ void mts420_print_raw(XbowSensorboardPacket *packet) { switch(packet->packet_id){ case 1:{ XSensorMTS400Data1 *data = (XSensorMTS400Data1 *)packet->data; printf("mts420 id=%02x " "vref=%04x humidity=%04x temp=%04x \n" "intersema calibration words(1..4) = %04x,%04x,%04x,%04x \n" "intersematemp=%04x intersemapressure=%04x \n" "taosch0=%04x taosch1=%04x accel_x=%04x accel_y=%04x\n", packet->node_id, data->battery, data->humidity, data->temp, data->cal_word1, data->cal_word2, data->cal_word3, data->cal_word4, data->intersematemp, data->intersemapressure, data->taosch0, data->taosch1, data->accel_x, GET_ACCEL_Y); break; } case 2:{ XSensorMTS420GPSData *data = (XSensorMTS420GPSData *)packet->data; printf("mts420 id=%02x " "Hours=%02x Minutes=%02x Decimal seconds = %08x\n" "Latitude degrees = %02x Latitude decimal minutes = %08x \n" "Longitude degrees = %02x Longitude decimal minutes=%08x \n" "NSEWind =%02x GPS Fixed=%02x \n", packet->node_id, data->hours, data->minutes, data->dec_sec, data->Lat_deg, data->Lat_dec_min, data->Long_deg, data->Long_dec_min, data->NSEWind,data->Fixed); break; } default: printf("MTS420 error: unknown packet_id (%i)\n", packet->packet_id); } } void mts420_print_cooked_1(XbowSensorboardPacket *packet) { XSensorMTS400Data1 *pd; pd = (XSensorMTS400Data1 *) packet->data; float light = mts400_convert_light(packet); // cooked output printf("MTS420 [sensor data converted to engineering units]:\n" " health: node id = %i\n" " battery: = %i mv \n" " humidity: = %i %% \n" " Temperature: = %i degC \n" " IntersemaTemperature: = %i degC \n" " IntersemaPressure: = %i mbar \n", packet->node_id, mts400_convert_battery(packet), mts400_convert_humidity(packet), mts400_convert_temp(packet), mts400_convert_intersematemp(packet), mts400_convert_intersemapressure(packet) ); if(light<-0.5) printf(" One of the CHs overflow,Light reading invalid.\n"); else printf(" Light: = %f lux \n",light); printf(" X-axis Accel: = %f mg \n" " Y-axis Accel: = %f mg \n", mts400_convert_accel_x(packet), mts400_convert_accel_y(packet)); printf("\n"); } void mts420_print_cooked_gps(XbowSensorboardPacket *packet) { XSensorMTS420GPSData *data; data = (XSensorMTS420GPSData *) packet->data; printf("MTS420 [gps data converted to engineering units]:\n" " health: node id=%i \n" " GGA - Global Positioning System Fix Data\n" " Fix taken at %i:%i:%f UTC\n" " Latitude %i deg %f' %c \n" " Longitude %i deg %f' %c \n" " Fix Quality: %s \n", packet->node_id, data->hours, data->minutes, mts420_convert_dec_sec(packet), data->Lat_deg, mts420_convert_Lat_dec_min(packet),mts420_convert_NS_ind(packet), data->Long_deg, mts420_convert_Long_dec_min(packet),mts420_convert_EW_ind(packet), (data->Fixed == 0)?"invalid":"valid"); printf("\n"); } void mts420_print_cooked(XbowSensorboardPacket *packet) { switch(packet->packet_id){ case 1: mts420_print_cooked_1(packet); break; case 2: mts420_print_cooked_gps(packet); break; default: printf("MTS420 Error: unknown packet id (%i)\n\n", packet->packet_id); } } XPacketHandler mts400_packet_handler = { XTYPE_MTS400, "$Id: mts400.c,v 1.1 2005/05/19 19:58:18 doolin Exp $", mts400_print_raw, mts400_print_cooked, mts400_print_raw, mts400_print_cooked }; void mts400_initialize() { xpacket_add_type(&mts400_packet_handler); } XPacketHandler mts420_packet_handler = { XTYPE_MTS420, "$Id: mts400.c,v 1.1 2005/05/19 19:58:18 doolin Exp $", mts420_print_raw, mts420_print_cooked, mts420_print_raw, mts420_print_cooked }; void mts420_initialize() { xpacket_add_type(&mts420_packet_handler); } --- NEW FILE: mda300.c --- /** * Handles conversion to engineering units of mda300 packets. * * @file mda300.c * @author Martin Turon * @version 2004/3/23 mturon Initial version * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: mda300.c,v 1.1 2005/05/19 19:58:18 doolin Exp $ */ #include <math.h> #ifdef __arm__ #include <sys/types.h> #endif #include "../xsensors.h" /** MDA300 XSensor packet 1 -- contains single analog adc channels */ typedef struct { uint16_t adc0; uint16_t adc1; uint16_t adc2; uint16_t adc3; uint16_t adc4; uint16_t adc5; uint16_t adc6; } XSensorMDA300Data1; /** MDA300 XSensor packet 2 -- contains precision analog adc channels. */ typedef struct { uint16_t adc7; uint16_t adc8; uint16_t adc9; uint16_t adc10; uint16_t adc11; uint16_t adc12; uint16_t adc13; } XSensorMDA300Data2; /** MDA300 XSensor packet 3 -- contains digital channels. */ typedef struct { uint16_t digi0; uint16_t digi1; uint16_t digi2; uint16_t digi3; uint16_t digi4; uint16_t digi5; } XSensorMDA300Data3; /** MDA300 XSensor packet 4 -- contains misc other sensor data. */ typedef struct { uint16_t battery; XSensorSensirion sensirion; uint16_t counter; } XSensorMDA300Data4; /** MDA300 XSensor packet 5 -- contains MultiHop packets. */ typedef struct { uint16_t seq_no; uint16_t adc0; uint16_t adc1; uint16_t adc2; uint16_t battery; XSensorSensirion sensirion; } __attribute__ ((packed)) XSensorMDA300Data5; /** * MDA300 Specific outputs of raw readings within a XSensor packet. * * @author Martin Turon * * @version 2004/3/23 mturon Initial version */ void mda300_print_raw(XbowSensorboardPacket *packet) { switch (packet->packet_id) { case 1: { XSensorMDA300Data1 *data = (XSensorMDA300Data1 *)packet->data; printf("mda300 id=%02x a0=%04x a1=%04x a2=%04x a3=%04x " "a4=%04x a5=%04x a6=%04x\n", packet->node_id, data->adc0, data->adc1, data->adc2, data->adc3, data->adc4, data->adc5, data->adc6); break; } case 2: { XSensorMDA300Data2 *data = (XSensorMDA300Data2 *)packet->data; printf("mda300 id=%02x a7=%04x a8=%04x a9=%04x a10=%04x " "a11=%04x a12=%04x a13=%04x\n", packet->node_id, data->adc7, data->adc8, data->adc9, data->adc10, data->adc11, data->adc12, data->adc13); break; } case 3: { XSensorMDA300Data3 *data = (XSensorMDA300Data3 *)packet->data; printf("mda300 id=%02x d1=%04x d2=%04x d3=%04x d4=%04x d5=%04x\n", packet->node_id, data->digi0, data->digi1, data->digi2, data->digi3, data->digi4, data->digi5); break; } case 4: { XSensorMDA300Data4 *data = (XSensorMDA300Data4 *)packet->data; printf("mda300 id=%02x bat=%04x hum=%04x temp=%04x cntr=%04x\n", packet->node_id, data->battery, data->sensirion.humidity, data->sensirion.thermistor, data->counter); break; } case 5: { XSensorMDA300Data5 *data = (XSensorMDA300Data5 *)packet->data; printf("mda300 id=%02x bat=%04x hum=%04x temp=%04x " " echo10=%04x echo20=%04x soiltemp=%04x\n", packet->node_id, data->battery, data->sensirion.humidity, data->sensirion.thermistor, data->adc0, data->adc1, data->adc2); break; } default: printf("mda300 error: unknown packet_id (%i)\n",packet->packet_id); } } /** MDA300 specific display of converted readings for packet 1 */ void mda300_print_cooked_1(XbowSensorboardPacket *packet) { printf("MDA300 [sensor data converted to engineering units]:\n" " health: node id=%i packet=%i\n" " adc chan 0: voltage=%i mV\n" " adc chan 1: voltage=%i mV\n" " adc chan 2: voltage=%i mV\n" " adc chan 3: voltage=%i mV\n" " adc chan 4: voltage=%i mV\n" " adc chan 5: voltage=%i mV\n" " adc chan 6: voltage=%i mV\n\n", packet->node_id, packet->packet_id, xconvert_adc_single(packet->data[0]), xconvert_adc_single(packet->data[1]), xconvert_adc_single(packet->data[2]), xconvert_adc_single(packet->data[3]), xconvert_adc_single(packet->data[4]), xconvert_adc_single(packet->data[5]), xconvert_adc_single(packet->data[6])); } /** MDA300 specific display of converted readings for packet 2 */ void mda300_print_cooked_2(XbowSensorboardPacket *packet) { printf("MDA300 [sensor data converted to engineering units]:\n" " health: node id=%i packet=%i\n" " adc chan 7: voltage=%i uV\n" " adc chan 8: voltage=%i uV\n" " adc chan 9: voltage=%i uV\n" " adc chan 10: voltage=%i uV\n" " adc chan 11: voltage=%i mV\n" " adc chan 12: voltage=%i mV\n" " adc chan 13: voltage=%i mV\n\n", packet->node_id, packet->packet_id, xconvert_adc_precision(packet->data[0]), xconvert_adc_precision(packet->data[1]), xconvert_adc_precision(packet->data[2]), xconvert_adc_precision(packet->data[3]), xconvert_adc_single(packet->data[4]), xconvert_adc_single(packet->data[5]), xconvert_adc_single(packet->data[6])); } /** MDA300 specific display of converted readings for packet 3 */ void mda300_print_cooked_3(XbowSensorboardPacket *packet) { printf("MDA300 [sensor data converted to engineering units]:\n" " health: node id=%i packet=%i\n\n", packet->node_id, packet->packet_id); } /** MDA300 specific display of converted readings for packet 4 */ void mda300_print_cooked_4(XbowSensorboardPacket *packet) { XSensorMDA300Data4 *data = (XSensorMDA300Data4 *)packet->data; printf("MDA300 [sensor data converted to engineering units]:\n" " health: node id=%i packet=%i\n" " battery voltage: =%i mV \n" " temperature: =%0.2f C \n" " humidity: =%0.1f %% \n\n", packet->node_id, packet->packet_id, xconvert_battery_mica2(data->battery), xconvert_sensirion_temp(&(data->sensirion)), xconvert_sensirion_humidity(&(data->sensirion)) ); } /** MDA300 specific display of converted readings for packet 5 */ void mda300_print_cooked_5(XbowSensorboardPacket *packet) { XSensorMDA300Data5 *data = (XSensorMDA300Data5 *)packet->data; printf("MDA300 [sensor data converted to engineering units]:\n" " health: node id=%i parent=%i battery=%i mV seq_no=%i\n" " echo10: Soil Moisture=%0.2f %%\n" " echo20: Soil Moisture=%0.2f %%\n" " soil temperature =%0.2f F\n" " temperature: =%0.2f C \n" " humidity: =%0.1f %% \n\n", packet->node_id, packet->parent, xconvert_battery_mica2(data->battery), data->seq_no, xconvert_echo10(data->adc0), xconvert_echo20(data->adc1), xconvert_spectrum_soiltemp(data->adc2), xconvert_sensirion_temp(&(data->sensirion)), xconvert_sensirion_humidity(&(data->sensirion)) ); } /** MDA300 specific display of converted readings from an XSensor packet. */ void mda300_print_cooked(XbowSensorboardPacket *packet) { switch (packet->packet_id) { case 1: mda300_print_cooked_1(packet); break; case 2: mda300_print_cooked_2(packet); break; case 3: mda300_print_cooked_3(packet); break; case 4: mda300_print_cooked_4(packet); break; case 5: mda300_print_cooked_5(packet); break; default: printf("MDA300 Error: unknown packet id (%i)\n\n", packet->packet_id); } } /** * Logs raw readings to a Postgres database. * * @author Martin Turon * * @version 2004/7/28 mturon Initial revision * */ void mda300_log_raw(XbowSensorboardPacket *packet) { XSensorMDA300Data5 *data = (XSensorMDA300Data5 *)packet->data; if (packet->packet_id != 5) return; char command[512]; char *table = "mda300_results"; sprintf(command, "INSERT into %s " "(result_time,nodeid,parent,epoch,voltage," "humid,humtemp,echo10,echo20,soiltemp)" " values (now(),%u,%u,%u,%u,%u,%u,%u,%u,%u)", table, //timestring, packet->node_id, packet->parent, data->seq_no, data->battery, data->sensirion.humidity, data->sensirion.thermistor, data->adc0, data->adc1, data->adc2 ); xdb_execute(command); } XPacketHandler mda300_packet_handler = { XTYPE_MDA300, "$Id: mda300.c,v 1.1 2005/05/19 19:58:18 doolin Exp $", mda300_print_raw, mda300_print_cooked, mda300_print_raw, mda300_print_cooked, mda300_log_raw }; void mda300_initialize() { xpacket_add_type(&mda300_packet_handler); } --- NEW FILE: mts101.c --- /** * Handles conversion to engineering units of mts101 packets. * * @file mts101.c * @author Hu Siquan * @version 2004/4/12 husq Initial version * * Refer to: * - Xbow MTS/MDA Sensor and DataAcquistion Manual * * Copyright (c) 2004 Crossbow Technology, Inc. All rights reserved. * * $Id: mts101.c,v 1.1 2005/05/19 19:58:18 doolin Exp $ */ #include <math.h> #include "../xsensors.h" /** MTS101 XSensor packet 1 -- contains battery, thermistor, and adc2-7. */ typedef struct { uint16_t battery; uint16_t thermistor; uint16_t light; } XSensorMTS101Data; /** * Converts mica2 battery reading from raw ADC data to engineering units. * * @author Martin Turon * * To compute the battery voltage after measuring the voltage ref: * BV = RV*ADC_FS/data * where: * BV = Battery Voltage * ADC_FS = 1023 * RV = Voltage Reference for mica2 (1.223 volts) * data = data from the adc measurement of channel 1 * BV (volts) = 1252.352/data * BV (mv) = 1252352/data * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @version 2004/3/29 mturon Initial revision * */ uint16_t mts101_convert_battery(XbowSensorboardPacket *packet) { XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; float x = (float)data->battery; uint16_t vdata = (uint16_t) (1252352 / x); return vdata; } /** * Converts thermistor reading from raw ADC data to engineering units. * * @author Martin Turon, Alan Broad * * To compute the thermistor resistance after measuring the thermistor voltage: * - Thermistor is a temperature variable resistor * - There is a 10K resistor in series with the thermistor resistor. * - Compute expected adc output from voltage on thermistor as: * ADC= 1023*Rthr/(R1+Rthr) * where R1 = 10K * Rthr = unknown thermistor resistance * Rthr = R1*(ADC_FS-ADC)/ADC * where ADC_FS = 1023 * * Note: * The thermistor resistance to temperature conversion is highly non-linear. * * @return Thermistor resistance as a uint16 in unit (Ohms) * * @version 2004/3/11 mturon Initial revision * */ uint16_t mts101_convert_thermistor_resistance(XbowSensorboardPacket *packet) { XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; float x = (float)data->thermistor; uint16_t vdata = 10000*(1023-x) /x ; return vdata; } /** * Converts thermistor reading from raw ADC data to engineering units. * * @author Martin Turon * * @return Temperature reading from thermistor as a float in degrees Celcius * * @version 2004/3/22 mturon Initial revision * */ float mts101_convert_thermistor_temperature(XbowSensorboardPacket *packet) { //XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; float temperature, a, b, c, Rt; a = 0.001307050; b = 0.000214381; c = 0.000000093; Rt = mts101_convert_thermistor_resistance(packet); temperature = 1 / (a + b * log(Rt) + c * pow(log(Rt),3)); temperature -= 273.15; // Convert from Kelvin to Celcius return temperature; } /** * Computes the Clairex CL94L light sensor reading * * @author Hu Siquan * * @return Voltage of ADC channel as an unsigned integer in mV * * @version 2004/4/12 husq Initial revision * @n 2004/4/19 husq Convert ADC reading to mv * */ uint16_t mts101_convert_light(XbowSensorboardPacket *packet) { XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; float Vbat = mts101_convert_battery(packet); uint16_t Vadc = (uint16_t) ((data->light) * Vbat / 1023); return Vadc; } /** MTS101 Specific outputs of raw readings within an XBowSensorboardPacket */ void mts101_print_raw(XbowSensorboardPacket *packet) { XSensorMTS101Data *data = (XSensorMTS101Data *)packet->data; printf("mts101 id=%02x battery=%04x thrm=%04x light=%04x\n", packet->node_id, data->battery, data->thermistor, data->light); } /** MTS101 specific display of converted readings from XBowSensorboardPacket */ void mts101_print_cooked(XbowSensorboardPacket *packet) { printf("MTS101 [sensor data converted to engineering units]:\n" " health: node id=%i\n" " battery: = %i mv \n" " tempurature: =%0.2f degC\n" " light: = %i mv \n", packet->node_id, mts101_convert_battery(packet), mts101_convert_thermistor_temperature(packet), mts101_convert_light(packet)); printf("\n"); } XPacketHandler mts101_packet_handler = { XTYPE_MTS101, "$Id: mts101.c,v 1.1 2005/05/19 19:58:18 doolin Exp $", mts101_print_raw, mts101_print_cooked, mts101_print_raw, mts101_print_cooked }; void mts101_initialize() { xpacket_add_type(&mts101_packet_handler); } |
From: David M. D. <do...@us...> - 2005-05-19 19:58:29
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/timestamp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755/timestamp Added Files: timestamp.c timestamp.h Log Message: Starting code for xlisten modifications. --- NEW FILE: timestamp.h --- /** * Standard TinyOS license here. */ /** * Parts of this code were developed as part of * the NSF-ITR FireBug project. * * @author David M. Doolin * * @url http://firebug.sourceforge.net * */ /** * $Id: timestamp.h,v 1.1 2005/05/19 19:58:18 doolin Exp $ */ #ifndef FB_TIMESTAMP_H #define FB_TIMESTAMP_H #ifdef __cplusplus extern "C" { #endif #define TIMESTRING_SIZE 128 /** Incomplete type, easier to extend later. */ typedef struct _timestamp Timestamp; Timestamp * timestamp_new (void); void timestamp_delete (Timestamp * ts); /** A handy format matching a mysql's time stamping syntax. * The date written as text can be imported directly into * a mysql table. */ void timestamp_get_ymdhms (Timestamp * ts, char * timestring); void timestamp_get_string (Timestamp * ts, char * timestring); #ifdef __cplusplus } #endif #endif /* FB_TIMESTAMP_H */ --- NEW FILE: timestamp.c --- /** * Standard TinyOS license here. */ /** * Parts of this code were developed as part of * the NSF-ITR FireBug project. * * @author David M. Doolin * * @url http://firebug.sourceforge.net * */ /** * $Id: timestamp.c,v 1.1 2005/05/19 19:58:18 doolin Exp $ */ #include <time.h> #include <stdlib.h> #include <memory.h> #include <locale.h> #include "timestamp.h" #ifdef __cplusplus extern "C" { #endif struct _timestamp { struct tm * time; }; Timestamp * timestamp_new (void) { Timestamp * ts = (Timestamp*)malloc(sizeof(Timestamp)); // Shred memory to indicate initialization status. memset((void*)ts,0xda,sizeof(Timestamp)); return ts; } void timestamp_delete (Timestamp * ts) { // Shred memory going out to indicate invalid access. memset((void*)ts,0xdd,sizeof(Timestamp)); free(ts); } /** @brief Get a timestamp in MySQL compatible format. * The innards could probably be slightly * improved. See header file to check/adjust * TIMESTRING_SIZE * * @author David M. Doolin */ void timestamp_get_ymdhms (Timestamp * ts, char timestring[TIMESTRING_SIZE]) { struct tm * l_time = ts->time; time_t timetype; timetype = time(NULL); l_time = localtime(&timetype); strftime(timestring, TIMESTRING_SIZE, "%Y%m%d%H%M%S", l_time); } /** * Return string of timestamp in YYYY/MM/DD hh:mm:ss format. * * @version 2004/9/27 mturon Initial revision */ void timestamp_get_string (Timestamp * ts, char timestring[TIMESTRING_SIZE]) { struct tm * l_time = ts->time; time_t timetype; timetype = time(NULL); l_time = localtime(&timetype); strftime(timestring, TIMESTRING_SIZE, "%Y/%m/%d %H:%M:%S", l_time); } #ifdef __cplusplus } #endif |
From: David M. D. <do...@us...> - 2005-05-19 19:56:52
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3485/boards Log Message: Directory /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 19:56:52
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/timestamp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3485/timestamp Log Message: Directory /cvsroot/firebug/fireboard/beta/tools/src/xlisten/timestamp added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 19:56:22
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3374/xlisten Log Message: Directory /cvsroot/firebug/fireboard/beta/tools/src/xlisten added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 19:54:27
|
Update of /cvsroot/firebug/fireboard/beta/tools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2858/src Log Message: Directory /cvsroot/firebug/fireboard/beta/tools/src added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 19:53:45
|
Update of /cvsroot/firebug/fireboard/beta/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2575/tools Log Message: Directory /cvsroot/firebug/fireboard/beta/tools added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 19:49:02
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1738 Added Files: .cvsignore Log Message: Added ignore file. --- NEW FILE: .cvsignore --- |
From: David M. D. <do...@us...> - 2005-05-19 19:48:10
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1517/XSensorMTS400 Modified Files: Makefile Log Message: Change include path for xbow code. Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 19 May 2005 17:29:49 -0000 1.1 --- Makefile 19 May 2005 19:48:01 -0000 1.2 *************** *** 3,8 **** MSG_SIZE=120 ! XBOWROOT=%T/../contrib/xbow/tos ! XBOWBETAROOT=%T/../contrib/xbow/beta/tos PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps --- 3,10 ---- MSG_SIZE=120 ! #XBOWROOT=%T/../contrib/xbow/tos ! #XBOWBETAROOT=%T/../contrib/xbow/beta/tos ! XBOWROOT=$(TOSROOT)/contrib/xbow/tos ! XBOWBETAROOT=$(TOSROOT)/contrib/xbow/beta/tos PFLAGS=-I$(XBOWBETAROOT)/lib/Xee -I$(XBOWROOT)/platform/$(PLATFORM) -I$(XBOWROOT)/AXStack/$(PLATFORM) -I$(XBOWROOT)/lib -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD) -I$(XBOWBETAROOT)/sensorboards/$(SENSORBOARD)/gps |
From: David M. D. <do...@us...> - 2005-05-19 17:31:17
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6273/GPS Log Message: Directory /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 17:30:51
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6202/mts400 Log Message: Directory /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 added to the repository |
From: David M. D. <do...@us...> - 2005-05-19 17:30:27
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6163/XSensorMTS400 Added Files: README Log Message: Added xbow beta fireboard code. --- NEW FILE: README --- README Description: -Read temperature, humidity, light, accel,pressure sensor readings -Read GPS data(MTS420CA only) -Output message to uart port -Output message to radio port State-Machine of mts400: (not #define MTS420) START ----> BUSY ----->BATT_DONE ---> BUSY -----> HUMIDITY_DONE ---> BUSY -----> PRESSURE_DONE ----> BUSY -----> LIGHT_DONE ----> BUSY -----> ACCEL_DONE -> START State-Machine of mts420: (#define MTS420) START ----> BUSY ----->BATT_DONE ---> BUSY -----> HUMIDITY_DONE ---> BUSY -----> PRESSURE_DONE ----> BUSY -----> LIGHT_DONE ----> BUSY -----> ACCEL_DONE ----> BUSY -----> GPS_BUSY -----> GPS_DONE -> START If a user wants only gps output, simply change the state-machine to: START -> GPS_BUSY ----> GPS_DONE -> START by comment the non-GPS part in Timer.fired(): e.g.: switch(l_state) { case START: /* atomic{ state = BUSY; sensor_state = SENSOR_BATT_START; } call Leds.greenToggle(); return call ADCBATT.getData(); //get vref data; case BATT_DONE: atomic{ state = BUSY; sensor_state = SENSOR_HUMIDITY_START; } return call TempHumControl.start(); case HUMIDITY_DONE: atomic { state = BUSY; sensor_state = SENSOR_PRESSURE_START; } return call PressureControl.start(); case PRESSURE_DONE: atomic { state = BUSY; sensor_state = SENSOR_LIGHT_START; } return call TaosControl.start(); case LIGHT_DONE: atomic { state = BUSY; sensor_state = SENSOR_ACCEL_START; } return call AccelCmd.PowerSwitch(1); //power on case ACCEL_DONE: */ call Leds.greenOff(); #ifdef MTS420 atomic state = GPS_BUSY; return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx #else atomic state = START; return SUCCESS; #endif break; #ifdef MTS420 case GPS_BUSY: if (gps_wait_cnt >= GPS_MAX_WAIT) { // gps rcvd pkt before time out? call GpsCmd.TxRxSwitch(0); // no,disable gps tx/rx switches atomic state = START; return SUCCESS; } else { gps_wait_cnt++; //keep waiting for gps pkt return SUCCESS; } break; case GPS_DONE: atomic state = START; return SUCCESS; break; #endif } |
From: David M. D. <do...@us...> - 2005-05-19 17:29:58
|
Update of /cvsroot/firebug/fireboard/beta/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5982 Added Files: MakeXbowlocal Log Message: Added xbow beta fireboard code. --- NEW FILE: MakeXbowlocal --- ########################################################################## # # MakeXbowlocal - Local Defines related to apps in contrib/xbow directory # ########################################################################## ########################################################################## # Settings for the the Mote Programmer, # If you are using MIB510 and it is connected to COM1 # of your PC use the following setting # For MIB600 use "eprb" setting and provide the hostname/IP address ########################################################################## #DEFAULT_PROGRAM=mib510 #DEFAULT_PROGRAM=eprb #MIB510=COM1 #EPRB=10.1.1.238 ########################################################################## # set Mote group id # - default mote group ########################################################################## DEFAULT_LOCAL_GROUP=0x7D ########################################################################## # set radio channel (freq) # -Uncomment ONLY one line to choose the desired radio operating freq. # -Select band based on freq label tag on mote (916,433..) # (i.e. 433Mhz channel will not work for mote configured for 916Mhz) ########################################################################## # # 916 MHz Band # # CHANNEL_00 - 903 MHz CHANNEL_02 - 904 MHz CHANNEL_04 - 905 MHz # CHANNEL_06 - 906 MHz CHANNEL_08 - 907 MHz CHANNEL_10 - 908 MHz # CHANNEL_12 - 909 MHz CHANNEL_14 - 910 MHz CHANNEL_16 - 911 MHz # CHANNEL_18 - 912 MHz CHANNEL_20 - 913 MHz CHANNEL_22 - 914 MHz # CHANNEL_24 - 915 MHz CHANNEL_26 - 916 MHz CHANNEL_28 - 917 MHz # CHANNEL_30 - 918 MHz CHANNEL_32 - 919 MHz CHANNEL_34 - 920 MHz # CHANNEL_36 - 921 MHz CHANNEL_38 - 922 MHz CHANNEL_40 - 923 MHz # CHANNEL_42 - 924 MHz CHANNEL_44 - 925 MHz CHANNEL_46 - 926 MHz # CHANNEL_48 - 927 MHz #CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_914_077_MHZ #CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_915_998_MHZ #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_00 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_02 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_04 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_06 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_08 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_10 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_12 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_14 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_16 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_18 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_20 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_22 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_24 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_26 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_28 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_30 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_32 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_34 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_36 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_38 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_40 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_42 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_44 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_46 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_916BAND_CHANNEL_48 #-------------------------------------------------------------------------- # 433 MHz Band # # CHANNEL_00 - 433.113 MHz CHANNEL_02 - 433.616 MHz # CHANNEL_04 - 434.108 MHz CHANNEL_06 - 434.618 MHz # CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_433_002_MHZ #CFLAGS = -DCC1K_DEFAULT_FREQ=CC1K_434_845_MHZ #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_433BAND_CHANNEL_00 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_433BAND_CHANNEL_02 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_433BAND_CHANNEL_04 #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_433BAND_CHANNEL_06 ##-------------------------------------------------------------------------- # 315 MHz Band # # CHANNEL_00 - 315 MHz # ##-------------------------------------------------------------------------- #CFLAGS = -DCC1K_DEFAULT_FREQ=RADIO_315BAND_CHANNEL_00 ########################################################################## ########################################################################## # Set Radio Power # - Radio transmit power is by a value (RTP) between 0x00 and 0xFF # - RTP = 0 for least power; =0xFF for max transmit power #------------------------------------------------------------------------- # For Mica2 and Mica2Dot # Freq Band: Output Power(dBm) RTP # 916 Mhz -20 0x02 # -10 0x09 # 0 (1mw) 0x80 # 5 0xFF # 433 Mhz -20 0x01 # -10 0x05 # 0 (1mw) 0x0F # 10 0xFF ########################################################################## CFLAGS += -DRADIO_XMIT_POWER=0xFF ############################################## # # MICAZ RF Power Levels #TXPOWER_MAX TXPOWER_0DBM #TXPOWER_0DBM 0x1f //0dBm #TXPOWER_M3DBM 0x23 //-3dBm #TXPOWER_M5DBM 0x19 //-5dBm #TXPOWER_M10DBM 0x0B //-10dBm #TXPOWER_M15DBM 0x07 //-15dBm #TXPOWER_M25DBM 0x03 //-25dBm #TXPOWER_MIN TXPOWER_M25DBM ########################################## CFLAGS +=-DCC2420_TXPOWER=TXPOWER_MAX #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M0DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M3DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M5DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M10DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M15DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_M25DBM #CFLAGS +=-DCC2420_TXPOWER=TXPOWER_MIN ######################################################### # # Zigbee Channel Selection # CHANNEL_11 - 2405 MHz CHANNEL_12 - 2410 MHz CHANNEL_13 - 2415 MHz # CHANNEL_14 - 2420 MHz CHANNEL_15 - 2425 MHz CHANNEL_16 - 2430 MHz # CHANNEL_17 - 2435 MHz CHANNEL_18 - 2440 MHz CHANNEL_19 - 2445 MHz # CHANNEL_20 - 2450 MHz CHANNEL_21 - 2455 MHz CHANNEL_22 - 2460 MHz # CHANNEL_23 - 2465 MHz CHANNEL_24 - 2470 MHz CHANNEL_25 - 2475 MHz # CHANNEL_26 - 2480 MHz # # 15, 20, 25 & 26 seem to be non-overlapping with 802.11 ######################################################### #CFLAGS +=-DCC2420_DEF_CHANNEL=11 #CFLAGS +=-DCC2420_DEF_CHANNEL=12 #CFLAGS +=-DCC2420_DEF_CHANNEL=13 #CFLAGS +=-DCC2420_DEF_CHANNEL=14 #CFLAGS +=-DCC2420_DEF_CHANNEL=15 #CFLAGS +=-DCC2420_DEF_CHANNEL=16 #CFLAGS +=-DCC2420_DEF_CHANNEL=17 #CFLAGS +=-DCC2420_DEF_CHANNEL=18 #CFLAGS +=-DCC2420_DEF_CHANNEL=19 #CFLAGS +=-DCC2420_DEF_CHANNEL=20 #CFLAGS +=-DCC2420_DEF_CHANNEL=21 #CFLAGS +=-DCC2420_DEF_CHANNEL=22 #CFLAGS +=-DCC2420_DEF_CHANNEL=23 #CFLAGS +=-DCC2420_DEF_CHANNEL=24 #CFLAGS +=-DCC2420_DEF_CHANNEL=25 CFLAGS +=-DCC2420_DEF_CHANNEL=26 ########################################################################## |