[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/harvard/spaulding/src/gui
Block.java, 1.2, 1.3 Node.java, 1.1.1.1,
1.2 NodeStatusPanel.java, 1.1.1.1,
1.2 RealTimeSamplesPanel.java, 1.2, 1.3 SpauldingApp.java, 1.2, 1.3
Konrad Lorincz
konradlorincz at users.sourceforge.net
Thu Dec 20 13:36:04 PST 2007
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/harvard/spaulding/src/gui
Block.java, 1.1.1.1, 1.2 Makefile, 1.1.1.1,
1.2 RealTimeSamplesPanel.java, 1.1.1.1, 1.2 Session.java,
1.1.1.1, 1.2 SpauldingApp.java, 1.1.1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/harvard/spaulding/src/realTimeSamples
RealTimeSamples.h, 1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28342/src/gui
Modified Files:
Block.java Node.java NodeStatusPanel.java
RealTimeSamplesPanel.java SpauldingApp.java
Log Message:
Added support to display differently sampled frequency channels in the gui
Index: Block.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/Block.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Block.java 20 Dec 2007 01:29:34 -0000 1.2
--- Block.java 20 Dec 2007 21:36:02 -0000 1.3
***************
*** 64,72 ****
private int nbrChannels;
private boolean wasParsed = false;
- // these should come from MIG
- private static final int RAW_BLOCK_TIMER_RATE = SpauldingApp.LOCAL_TIME_RATE_HZ;
- // private static final int NBR_SAMPLES_PER_BLOCK = 114;//120;
- // private static final int SIMULTCHAN_SAMPLES_PER_BLOCK = NBR_SAMPLES_PER_BLOCK / MercurySampling.MERCURY_NBR_CHANS;
- // private static final int SIMULTCHAN_SAMPLING_RATE = MercurySampling.MERCURY_SAMPLING_RATE;
// ======================= Methods =============================
--- 64,67 ----
***************
*** 80,94 ****
public long getBlockID() {return blockID;}
! // public static double nbrBlocksPerSamplingTimeMS(long samplingTimeMS)
! // {
! // final double SIMULTCHAN_SAMPLES_PER_MS = (double)SIMULTCHAN_SAMPLING_RATE/1000.0;
! // double nbrBlocks = (double)(samplingTimeMS * SIMULTCHAN_SAMPLES_PER_MS) / (double)SIMULTCHAN_SAMPLES_PER_BLOCK;
! //
! // System.out.println("********** Block.nbrBlocksPerSamplingTimeMS() - time= " + samplingTimeMS +
! // " => nbrBlocks= " + nbrBlocks);
! // return nbrBlocks;
! // }
!
! public void setBlockBytes(int offset, short[] bytes)
{
for (int i = 0; i < bytes.length; ++i)
--- 75,79 ----
public long getBlockID() {return blockID;}
! public synchronized void setBlockBytes(int offset, short[] bytes)
{
for (int i = 0; i < bytes.length; ++i)
***************
*** 148,152 ****
private double blockTimeRawToMS(long rawTime)
{
! return (double)rawTime/(double)RAW_BLOCK_TIMER_RATE;
}
--- 133,137 ----
private double blockTimeRawToMS(long rawTime)
{
! return (double)rawTime/(double)SpauldingApp.LOCAL_TIME_RATE_HZ;
}
***************
*** 185,189 ****
* code will need to be updated as well.
*/
! private void parseBlock()
{
if (wasParsed)
--- 170,174 ----
* code will need to be updated as well.
*/
! private synchronized void parseBlock()
{
if (wasParsed)
***************
*** 230,237 ****
}
catch (ArrayIndexOutOfBoundsException e) {
! System.out.printf("offset= %d, curChan= %d, sampleIndex= %d, samplingRate= %d, nbrSamples= %d",
offset, curChan, sampleIndex, samplingRate, nbrSamples);
e.printStackTrace();
! System.exit(1);
}
}
--- 215,223 ----
}
catch (ArrayIndexOutOfBoundsException e) {
! System.err.printf("\noffset= %d, curChan= %d, sampleIndex= %d, samplingRate= %d, nbrSamples= %d",
offset, curChan, sampleIndex, samplingRate, nbrSamples);
e.printStackTrace();
! System.out.println("About to exit");
! //System.exit(1);
}
}
Index: Node.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/Node.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Node.java 22 Aug 2007 00:43:54 -0000 1.1.1.1
--- Node.java 20 Dec 2007 21:36:02 -0000 1.2
***************
*** 44,48 ****
interface NodeListener
{
! public void newSamplesAdded(double firstMCSTimeSec, int[] samples);
public void newReplyMsg(ReplyMsg replyMsg);
}
--- 44,48 ----
interface NodeListener
{
! public void newSamplingMsg(SamplingMsg samplingMsg);
public void newReplyMsg(ReplyMsg replyMsg);
}
***************
*** 124,132 ****
}
! public void addSamples(double firstMCSTimeSec, int[] samples)
{
// notify the NodeListeners
for (NodeListener nl : this.nodeListeners)
! nl.newSamplesAdded(firstMCSTimeSec, samples);
}
--- 124,132 ----
}
! public void newSamplingMsg(SamplingMsg samplingMsg)
{
// notify the NodeListeners
for (NodeListener nl : this.nodeListeners)
! nl.newSamplingMsg(samplingMsg);
}
***************
*** 143,150 ****
case 0: return "Acc X";
case 1: return "Acc Y";
! case 2: return "Acc Z ";
case 3: return "Gyro X";
case 4: return "Gyro Y";
case 5: return "Gyro Z";
default: return "Unknown Channel";
}
--- 143,151 ----
case 0: return "Acc X";
case 1: return "Acc Y";
! case 2: return "Acc Z";
case 3: return "Gyro X";
case 4: return "Gyro Y";
case 5: return "Gyro Z";
+ case 6: return "EMG";
default: return "Unknown Channel";
}
Index: NodeStatusPanel.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/NodeStatusPanel.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NodeStatusPanel.java 22 Aug 2007 00:43:54 -0000 1.1.1.1
--- NodeStatusPanel.java 20 Dec 2007 21:36:02 -0000 1.2
***************
*** 395,399 ****
// ----------- Listening Interfaces ---------
! public void newSamplesAdded(double firstMCSTimeSec, int[] samples)
{ // Just ignore, we don't care about new samples
}
--- 395,399 ----
// ----------- Listening Interfaces ---------
! public void newSamplingMsg(SamplingMsg samplingMsg)
{ // Just ignore, we don't care about new samples
}
Index: RealTimeSamplesPanel.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/RealTimeSamplesPanel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RealTimeSamplesPanel.java 20 Dec 2007 01:29:34 -0000 1.2
--- RealTimeSamplesPanel.java 20 Dec 2007 21:36:02 -0000 1.3
***************
*** 55,69 ****
}
! public void newSamplesAdded(double firstMCSTimeSec, int[] samples)
{
! // for (int i = 0; i < samples.length; ++i) {
! // int chanID = i % MercurySampling.MERCURY_NBR_CHANS;
! // double deltaTimeSec = (double) RealTimeSamples.REALTIMESAMPLES_DOWNSAMPLE_FACTOR *
! // (double)((int)i/(int)MercurySampling.MERCURY_NBR_CHANS) /
! // (double)MercurySampling.MERCURY_SAMPLING_RATE;
! // double currMCSTimeSec = firstMCSTimeSec + deltaTimeSec;
! //
! // getGraphPanel(chanID).addData(currMCSTimeSec, (samples[i] & 0x0fff));
! // }
}
--- 55,83 ----
}
! public void newSamplingMsg(SamplingMsg samplingMsg)
{
! double timeSec = (double)samplingMsg.get_timeStamp()/(double)SpauldingApp.LOCAL_TIME_RATE_HZ;
! int samplingRate = samplingMsg.get_samplingRate();
! short[] channelIDs = samplingMsg.get_channelIDs();
! int nbrSamples = samplingMsg.get_nbrSamples();
! int[] samples = samplingMsg.get_samples();
!
! // (1) - Determine how many channels there are
! int nbrChannels = 0;
! for (short chanID: channelIDs) {
! if (chanID != MultiChanSampling.CHAN_INVALID)
! nbrChannels++;
! }
!
! // (2) - Get the samples
! for (int i = 0; i < nbrSamples; ++i) {
! int chanIndex = i % nbrChannels;
! if (nbrChannels == 1) // Quick HACK to identify EMG
! chanIndex = 6;
! double deltaTimeSec = (double)(i/nbrChannels) / (double)samplingRate;
! double currMCSTimeSec = timeSec + deltaTimeSec;
! getGraphPanel(chanIndex).addData(currMCSTimeSec, (samples[i] & 0x0fff));
! }
!
}
***************
*** 79,83 ****
gp = new GraphPanel(node.getChannelStr(channelID), "Elapsed time (sec)",
"ADC value", new double[] {0}, new double[] {0});
! gp.setMaxNbrValues(1200);
gp.setPreferredSize(new Dimension(600, 150));
graphPanels.put(channelID, gp);
--- 93,97 ----
gp = new GraphPanel(node.getChannelStr(channelID), "Elapsed time (sec)",
"ADC value", new double[] {0}, new double[] {0});
! gp.setMaxNbrValues(3500);
gp.setPreferredSize(new Dimension(600, 150));
graphPanels.put(channelID, gp);
Index: SpauldingApp.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/SpauldingApp.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SpauldingApp.java 20 Dec 2007 01:29:34 -0000 1.2
--- SpauldingApp.java 20 Dec 2007 21:36:02 -0000 1.3
***************
*** 59,63 ****
private static final DecimalFormat dbFormat = new DecimalFormat("#.000");
public static final int LOCAL_TIME_RATE_HZ = 32768;
! private static final boolean PRINT_SAMPLES_ENABLED = true;
public static final String SESSIONS_DIR_STR = "sessions";
--- 59,63 ----
private static final DecimalFormat dbFormat = new DecimalFormat("#.000");
public static final int LOCAL_TIME_RATE_HZ = 32768;
! private static final boolean PRINT_SAMPLES_ENABLED = false;
public static final String SESSIONS_DIR_STR = "sessions";
***************
*** 267,271 ****
long timeStamp = sMsg.get_timeStamp();
double timeSec = (double)timeStamp/(double)LOCAL_TIME_RATE_HZ;
- //double timeSec = (System.currentTimeMillis()-startTime)/1000.0;
int nbrSamples = sMsg.get_nbrSamples();
--- 267,270 ----
***************
*** 299,305 ****
if (i % nbrChannels == 0) { // newline
double deltaTimeSec = (double)(i/nbrChannels) / (double)samplingRate;
- // (double) RealTimeSamples.REALTIMESAMPLES_DOWNSAMPLE_FACTOR *
- // (double)((int)i/(int)MercurySampling.MERCURY_NBR_CHANS) /
- // (double)MercurySampling.MERCURY_SAMPLING_RATE;
double currMCSTimeSec = timeSec + deltaTimeSec;
System.out.print("\n timeSec= " + dbFormat.format(currMCSTimeSec) + ", samples= ");
--- 298,301 ----
***************
*** 309,319 ****
}
! // // Update the node
! // Node currNode = nodes.get(srcAddr);
! // if (currNode != null)
! // currNode.addSamples(timeSec, samples);
! // else {
! // // Drop it. We firste need to receive a ReplyStatusMsg to create a node
! // }
}
--- 305,315 ----
}
! // Update the node
! Node currNode = nodes.get(srcAddr);
! if (currNode != null)
! currNode.newSamplingMsg(sMsg);
! else {
! // Drop it. We firste need to receive a ReplyStatusMsg to create a node
! }
}
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/harvard/spaulding/src/gui
Block.java, 1.1.1.1, 1.2 Makefile, 1.1.1.1,
1.2 RealTimeSamplesPanel.java, 1.1.1.1, 1.2 Session.java,
1.1.1.1, 1.2 SpauldingApp.java, 1.1.1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/harvard/spaulding/src/realTimeSamples
RealTimeSamples.h, 1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list