Changeset 0337b74 in orbit
- Timestamp:
- 07/27/13 01:20:31 (9 years ago)
- Branches:
- master, RawEEG, Servo, Tab_Interface, pyramid
- Children:
- 0e5d193
- Parents:
- 4f3fd92
- Location:
- android
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
android/res/layout-large/activity_main.xml
r5c11ea9 r0337b74 125 125 </LinearLayout> 126 126 127 <com.androidplot.xy.XYPlot 128 android:id="@+id/eegRawHistoryPlot" 129 android:layout_width="fill_parent" 130 android:layout_height="wrap_content" 131 android:layout_marginLeft="10dp" 132 android:layout_marginRight="10dp" 133 android:layout_marginTop="10dp" 134 android:layout_weight="1" 135 title="EEG Raw Wave" /> 136 127 137 <LinearLayout 128 138 android:id="@+id/layoutAudioService" -
android/res/layout-small/activity_main.xml
r8358488 r0337b74 128 128 </LinearLayout> 129 129 130 <com.androidplot.xy.XYPlot 131 android:id="@+id/eegRawHistoryPlot" 132 android:layout_width="fill_parent" 133 android:layout_height="wrap_content" 134 android:layout_marginLeft="10dp" 135 android:layout_marginRight="10dp" 136 android:layout_marginTop="10dp" 137 android:layout_weight="1" 138 title="EEG Raw Wave" /> 139 130 140 <LinearLayout 131 141 android:id="@+id/layoutAudioService" -
android/res/layout-xlarge/activity_main.xml
r8358488 r0337b74 125 125 </LinearLayout> 126 126 127 <com.androidplot.xy.XYPlot 128 android:id="@+id/eegRawHistoryPlot" 129 android:layout_width="fill_parent" 130 android:layout_height="wrap_content" 131 android:layout_marginLeft="10dp" 132 android:layout_marginRight="10dp" 133 android:layout_marginTop="10dp" 134 android:layout_weight="1" 135 title="EEG Raw Wave" /> 136 127 137 <LinearLayout 128 138 android:id="@+id/layoutAudioService" -
android/res/layout/activity_main.xml
r5c11ea9 r0337b74 128 128 </LinearLayout> 129 129 130 <com.androidplot.xy.XYPlot 131 android:id="@+id/eegRawHistoryPlot" 132 android:layout_width="fill_parent" 133 android:layout_height="wrap_content" 134 android:layout_marginLeft="10dp" 135 android:layout_marginRight="10dp" 136 android:layout_marginTop="10dp" 137 android:layout_weight="1" 138 title="EEG Raw Wave" /> 139 130 140 <LinearLayout 131 141 android:id="@+id/layoutAudioService" -
android/src/info/puzzlebox/orbit/OrbitActivity.java
rd6fbdfb r0337b74 36 36 import android.graphics.drawable.ShapeDrawable; 37 37 import android.graphics.drawable.shapes.RoundRectShape; 38 import android.hardware.SensorEvent; 38 39 import android.util.Log; 39 40 import android.view.Gravity; … … 55 56 import com.neurosky.thinkgear.TGDevice; 56 57 58 //import com.androidplot.util.PlotStatistics; 59 import com.androidplot.util.PlotStatistics; 60 import com.androidplot.xy.*; 61 57 62 58 63 public class OrbitActivity extends Activity implements SeekBar.OnSeekBarChangeListener { … … 68 73 boolean eegConnecting = false; 69 74 boolean demoFlightMode = false; 75 // int[]rawEEG = {}; 70 76 71 77 … … 97 103 int viewSpaceGenerateAudioWidth = 120; 98 104 105 private static final int EEG_RAW_HISTORY_SIZE = 512; // number of points to plot in EEG history 106 private XYPlot eegRawHistoryPlot = null; 107 private SimpleXYSeries eegRawHistorySeries = null; 108 109 99 110 LinearLayout layoutControl; 100 111 LinearLayout layoutAudioService; … … 227 238 progressBarPower.setProgressDrawable(progressPower); 228 239 progressBarPower.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal)); 240 241 242 // setup the Raw EEG History plot: 243 eegRawHistoryPlot = (XYPlot) findViewById(R.id.eegRawHistoryPlot); 244 eegRawHistorySeries = new SimpleXYSeries("Raw EEG"); 245 eegRawHistorySeries.useImplicitXVals(); 246 eegRawHistoryPlot.setRangeBoundaries(-32767, 32767, BoundaryMode.FIXED); 247 eegRawHistoryPlot.setDomainBoundaries(0, EEG_RAW_HISTORY_SIZE, BoundaryMode.FIXED); 248 eegRawHistoryPlot.addSeries(eegRawHistorySeries, new LineAndPointFormatter(Color.rgb(200, 100, 100), Color.BLACK, null, null)); 249 eegRawHistoryPlot.setDomainStepValue(5); 250 eegRawHistoryPlot.setTicksPerRangeLabel(3); 251 eegRawHistoryPlot.getDomainLabelWidget().pack(); 252 // eegRawHistoryPlot.setRangeLabel("Amplitude"); 253 eegRawHistoryPlot.getRangeLabelWidget().pack(); 254 255 final PlotStatistics histStats = new PlotStatistics(1000, false); 256 257 eegRawHistoryPlot.addListener(histStats); 258 229 259 230 260 seekBarAttention = (SeekBar)findViewById(R.id.seekBarAttention); … … 691 721 //raw1 = msg.arg1; 692 722 //tv.append("Got raw: " + msg.arg1 + "\n"); 723 724 // rawEEG[rawEEG.length] = msg.arg1; 725 726 eegRawHistorySeries.addLast(null, msg.arg1); 727 728 if (eegRawHistorySeries.size() == EEG_RAW_HISTORY_SIZE) { 729 updateEEGRawHistory(); 730 } 731 693 732 break; 694 733 case TGDevice.MSG_HEART_RATE: … … 938 977 * which is used to fly the helicopter 939 978 */ 940 941 942 943 944 945 946 947 979 980 // Set Attention and Meditation to zero if we've lost signal 981 if (eegSignal < 100) { 982 eegAttention = 0; 983 eegMeditation = 0; 984 progressBarAttention.setProgress(eegAttention); 985 progressBarMeditation.setProgress(eegMeditation); 986 } 948 987 949 988 eegPower = calculateSpeed(); … … 976 1015 977 1016 } // updatePower 1017 1018 1019 // ################################################################ 1020 1021 public void updateEEGRawHistory() { 1022 1023 // add the latest history sample: 1024 // eegRawHistorySeries.addLast(null, sensorEvent.values[0]); 1025 1026 // update the plot with the updated history Lists: 1027 // eegRawHistorySeries.setModel(eegRawHistory, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY); 1028 1029 // redraw the Plots: 1030 eegRawHistoryPlot.redraw(); 1031 1032 // get rid the oldest sample in history: 1033 if (eegRawHistorySeries.size() > EEG_RAW_HISTORY_SIZE) { 1034 // eegRawHistorySeries.removeFirst(); 1035 eegRawHistorySeries = new SimpleXYSeries("Raw EEG"); 1036 eegRawHistorySeries.useImplicitXVals(); 1037 } 1038 1039 1040 } 978 1041 979 1042
Note: See TracChangeset
for help on using the changeset viewer.