Thread: [Firebug-cvs] fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection DataCollect.java,1.4
Brought to you by:
doolin
From: Karthik D. <da...@us...> - 2005-08-29 22:45:08
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32227/net/sf/firebug/DataCollection Modified Files: DataCollect.java Log Message: Working humidity sensor with calibration and temperature correction Index: DataCollect.java =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/DataCollection/DataCollect.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DataCollect.java 29 Aug 2005 19:15:56 -0000 1.4 --- DataCollect.java 29 Aug 2005 22:45:00 -0000 1.5 *************** *** 133,136 **** --- 133,145 ---- } + public double humidity_temp(int raw_temp) { + return (-39.60 + 0.01*(raw_temp&0x3F40)); + } + + public double humidity(int raw_humidity, double temp) { + double hum = (-4 + 0.0405*raw_humidity + (-2.8 *Math.pow(10.0,-6.0))*(Math.pow(raw_humidity,2))); + return ((temp - 25.0)*(0.01 + 0.00008*raw_humidity) + hum); + } + public DataCollect() { dlist = new LinkedList(); *************** *** 147,151 **** } } ! public void packetReceived(byte[] packet) { } --- 156,160 ---- } } ! public void packetReceived(byte[] packet) { } *************** *** 193,200 **** System.out.println("Sensor reading"); ! if(get_data(msg.get_seq_no(), (long)msg.get_src()) == 0) { prt("not duplicate with seq no " + msg.get_seq_no()); /* Not a duplicate */ ! if((index = get_calibration(msg.get_seq_no(), (long)msg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ --- 202,209 ---- System.out.println("Sensor reading"); ! if(get_data((long)msg.get_seq_no(), (long)msg.get_src()) == 0) { prt("not duplicate with seq no " + msg.get_seq_no()); /* Not a duplicate */ ! if((index = get_calibration((long)msg.get_seq_no(), (long)msg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ *************** *** 205,209 **** dlist.add(msg); prt("Sending to print"); ! printData(index, get_data(msg.get_seq_no(), (long)msg.get_src())); } } --- 214,218 ---- dlist.add(msg); prt("Sending to print"); ! printData(index, get_data((long)msg.get_seq_no(), (long)msg.get_src())); } } *************** *** 223,230 **** System.out.println("Calibration"); // CalibrationMsg cMsg = new CalibrationMsg(m.dataGet(),m.offset_data(0)); ! if(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()) == 0) { /* Not a duplicate */ prt("not duplicate with seq no " + msg.get_seq_no()); ! if((index = get_data(cMsg.get_seq_no(), (long)cMsg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ --- 232,239 ---- System.out.println("Calibration"); // CalibrationMsg cMsg = new CalibrationMsg(m.dataGet(),m.offset_data(0)); ! if(get_calibration((long)cMsg.get_seq_no(), (long)cMsg.get_src()) == 0) { /* Not a duplicate */ prt("not duplicate with seq no " + msg.get_seq_no()); ! if((index = get_data((long)cMsg.get_seq_no(), (long)cMsg.get_src())) == 0) { /* No calibration data received yet. So, add to the list */ *************** *** 235,239 **** clist.add(cMsg); prt("Send to print"); ! printData(get_calibration(cMsg.get_seq_no(), (long)cMsg.get_src()), index); } } --- 244,248 ---- clist.add(cMsg); prt("Send to print"); ! printData(get_calibration((long)cMsg.get_seq_no(), (long)cMsg.get_src()), index); } } *************** *** 249,253 **** System.out.println("Raw temperature: "+ dMsg.get_temperature()); System.out.println("Raw humidity : "+ dMsg.get_humidity()); ! System.out.println("Raw voltage : "+ dMsg.get_ivolt()); System.out.println("Raw Pressure : "+ dMsg.get_pressure()); --- 258,263 ---- System.out.println("Raw temperature: "+ dMsg.get_temperature()); System.out.println("Raw humidity : "+ dMsg.get_humidity()); ! System.out.println("Raw voltage : "+ dMsg.get_ivolt()); ! System.out.println("Raw itemp : "+ dMsg.get_itemp()); System.out.println("Raw Pressure : "+ dMsg.get_pressure()); *************** *** 257,260 **** --- 267,272 ---- System.out.println("Pressure : "+pressure_mbar(dMsg.get_pressure(), dMsg.get_temperature(), cMsg.get_calibration())); System.out.println("Voltage : "+voltage(dMsg.get_ivolt())); + System.out.println("Humidity Temp : "+humidity_temp(dMsg.get_itemp())); + System.out.println("Humidity : "+humidity(dMsg.get_humidity(), pressure_temp(dMsg.get_temperature(), cMsg.get_calibration()))); /* Delete the printed data */ dlist.remove(dindex); *************** *** 272,276 **** DataCollectionMsg msg = (DataCollectionMsg) it.next(); ! if(msg.get_seq_no() == seqno && msg.get_src() == src) { found=true; break; --- 284,288 ---- DataCollectionMsg msg = (DataCollectionMsg) it.next(); ! if(((long)msg.get_seq_no()) == seqno && ((long)msg.get_src()) == src) { found=true; break; *************** *** 296,300 **** CalibrationMsg msg = (CalibrationMsg) it.next(); ! if(msg.get_seq_no() == seqno && msg.get_src() == src) { found=true; break; --- 308,312 ---- CalibrationMsg msg = (CalibrationMsg) it.next(); ! if(((long)msg.get_seq_no()) == seqno && ((long)msg.get_src()) == src) { found=true; break; |