Skip to content

Commit

Permalink
Imported app v2.5 code
Browse files Browse the repository at this point in the history
  • Loading branch information
scaryghost committed Mar 12, 2015
1 parent 4cb9fe6 commit 816e4e9
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 137 deletions.
21 changes: 0 additions & 21 deletions res/layout/fragment_gpio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,6 @@ contact MbientLab Inc, at www.mbientlab.com.
</EditText>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2" >

<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.50"
android:text="@string/label_firmware_version" />

<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.50"
android:text="@string/label_gpio_firmware" />

</LinearLayout>

<View
android:layout_width="fill_parent"
android:layout_height="1dp"
Expand Down
4 changes: 3 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ contact MbientLab Inc, at www.mbientlab.com.

<string name="text_connected">Device Connected</string>
<string name="text_lost_connection">Connection Lost</string>
<string name="text_reset">Reset Issued</string>

<string name="mw_about_text">The MetaWear app provides a GUI for interacting with a MetaWear board and serves as an example on how to use the MetaWear API.</string>

Expand Down Expand Up @@ -141,7 +142,8 @@ contact MbientLab Inc, at www.mbientlab.com.
<string name="label_log_start">Log</string>
<string name="label_log_save">Save</string>
<string name="label_log_help">Select a sensor you wish to log. Press the Log button to begin logging and the Save button to download and email the data.
For the best results, your device should be on Android 4.4 or higher. The screen\'s orientation will be locked while the panel is active.</string>
For the best results, your device should be on Android 4.4 or higher and you should disconnect after each log download.
The screen\'s orientation will be locked while the panel is active.</string>

<string name="label_neopixel_strand">Strand</string>
<string name="label_neopixel_num_leds"># of LEDs</string>
Expand Down
6 changes: 3 additions & 3 deletions src/com/mbientlab/metawear/app/AppFragments.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
*/
package com.mbientlab.metawear.app;

import java.util.HashMap;
import java.util.TreeMap;

/**
* @author etsai
*
*/
public class AppFragments {
private static final HashMap<String, Class<? extends ModuleFragment>> fragments;
private static final TreeMap<String, Class<? extends ModuleFragment>> fragments;
private static final String[] items;

static {
fragments= new HashMap<>();
fragments= new TreeMap<>();
fragments.put("Device Information", DeviceInfoFragment.class);
fragments.put("LED", LEDFragment.class);
fragments.put("Accelerometer", AccelerometerFragment.class);
Expand Down
1 change: 1 addition & 0 deletions src/com/mbientlab/metawear/app/DeviceInfoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
public void onClick(View v) {
if (mwMnger.controllerReady()) {
debugController.resetDevice();
Toast.makeText(getActivity(), R.string.text_reset, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), R.string.error_connect_board, Toast.LENGTH_LONG).show();
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/mbientlab/metawear/app/EventFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public String description() {
eventController.stopRecord();

Temperature tempController= (Temperature) mwMnger.getCurrentController().getModuleController(Module.TEMPERATURE);
tempController.enableSampling().withSampingPeriod(500)
tempController.enableSampling().withSamplingPeriod(500)
.withTemperatureDelta(2).commit();
}

Expand Down
41 changes: 4 additions & 37 deletions src/com/mbientlab/metawear/app/GPIOFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.CompoundButton.OnCheckedChangeListener;

/**
* @author etsai
Expand All @@ -63,47 +60,25 @@ public class GPIOFragment extends ModuleFragment {
private EditText pinText;
private GPIO gpioController;
private PullMode pullMode;
private boolean olderFirmware;

private ModuleCallbacks mCallbacks= new GPIO.Callbacks() {
@Override
public void receivedAnalogInputAsAbsValue(short value) {
if (olderFirmware && isVisible()) {
((TextView) getView().findViewById(R.id.textView4)).setText(String.format(Locale.US, "%d mV", value));
}
}

@Override
public void receivedAnalogInputAsSupplyRatio(short value) {
if (olderFirmware && isVisible()) {
((TextView) getView().findViewById(R.id.textView5)).setText(String.format(Locale.US, "%d", value));
}
}

@Override
public void receivedDigitalInput(byte value) {
if (olderFirmware && isVisible()) {
((TextView) getView().findViewById(R.id.textView8)).setText(String.format(Locale.US, "%d", value));
}
}

@Override
public void receivedAnalogInputAsAbsValue(byte pin, short value) {
if (!olderFirmware && isVisible()) {
public void receivedAnalogInputAsAbsReference(byte pin, short value) {
if (isVisible()) {
((TextView) getView().findViewById(R.id.textView4)).setText(String.format(Locale.US, "%d mV", value));
}
}

@Override
public void receivedAnalogInputAsSupplyRatio(byte pin, short value) {
if (!olderFirmware && isVisible()) {
if (isVisible()) {
((TextView) getView().findViewById(R.id.textView5)).setText(String.format(Locale.US, "%d", value));
}
}

@Override
public void receivedDigitalInput(byte pin, byte value) {
if (!olderFirmware && isVisible()) {
if (isVisible()) {
((TextView) getView().findViewById(R.id.textView8)).setText(String.format(Locale.US, "%d", value));
}
}
Expand All @@ -130,14 +105,6 @@ public void onNothingSelected(AdapterView<?> parent) { }
pullModeSpinner.setAdapter(new ArrayAdapter<PullMode>(getActivity(),
R.layout.command_row, R.id.command_name, PullMode.values));

((CheckBox) view.findViewById(R.id.checkBox1)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
olderFirmware= isChecked;
}
});

((Button) view.findViewById(R.id.button1)).setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down
Loading

0 comments on commit 816e4e9

Please sign in to comment.