Skip to content

Commit e8912ac

Browse files
committed
Merge branch 'release/v0.5-beta'
2 parents b8f4d91 + a12460f commit e8912ac

29 files changed

+973
-194
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
applicationId "com.fewlaps.flone"
1010
minSdkVersion 15
1111
targetSdkVersion 23
12-
versionCode 5
13-
versionName "0.4 beta"
12+
versionCode 6
13+
versionName "0.5 beta"
1414
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1515
}
1616
lintOptions {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.fewlaps.flone.data.bean;
2+
3+
public class PhoneSensorsData {
4+
protected double heading = 0;
5+
protected double pitch = 0;
6+
protected double roll = 0;
7+
8+
public PhoneSensorsData(double heading, double pitch, double roll) {
9+
this.heading = heading;
10+
this.pitch = pitch;
11+
this.roll = roll;
12+
}
13+
14+
public double getHeading() {
15+
return heading;
16+
}
17+
18+
public double getPitch() {
19+
return pitch;
20+
}
21+
22+
public double getRoll() {
23+
return roll;
24+
}
25+
}

app/src/main/java/com/fewlaps/flone/io/bean/DroneSensorData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
* @author Roc Boronat (roc@fewlaps.com)
55
* @date 07/05/2015
66
*/
7-
public class DroneSensorData extends SensorInformation {
7+
public class DroneSensorData extends MultiWiiValues {
88
}
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
package com.fewlaps.flone.io.bean;
2+
3+
import com.fewlaps.flone.io.communication.RCSignals;
4+
5+
public class MultiWiiValues {
6+
protected double throttle = 0;
7+
protected double heading = 0;
8+
protected double pitch = 0;
9+
protected double roll = 0;
10+
protected double aux1 = 0;
11+
protected double aux2 = 0;
12+
protected double aux3 = 0;
13+
protected double aux4 = 0;
14+
15+
public double getThrottle() {
16+
return throttle;
17+
}
18+
19+
public void setThrottle(double throttle) {
20+
this.throttle = throttle;
21+
}
22+
23+
public double getHeading() {
24+
return heading;
25+
}
26+
27+
public void setHeading(double heading) {
28+
this.heading = heading;
29+
}
30+
31+
public double getPitch() {
32+
return pitch;
33+
}
34+
35+
public void setPitch(double pitch) {
36+
this.pitch = pitch;
37+
}
38+
39+
public double getRoll() {
40+
return roll;
41+
}
42+
43+
public void setRoll(double roll) {
44+
this.roll = roll;
45+
}
46+
47+
public double getAux1() {
48+
return aux1;
49+
}
50+
51+
public void setAux1(double aux1) {
52+
this.aux1 = aux1;
53+
}
54+
55+
public double getAux2() {
56+
return aux2;
57+
}
58+
59+
public void setAux2(double aux2) {
60+
this.aux2 = aux2;
61+
}
62+
63+
public double getAux3() {
64+
return aux3;
65+
}
66+
67+
public void setAux3(double aux3) {
68+
this.aux3 = aux3;
69+
}
70+
71+
public double getAux4() {
72+
return aux4;
73+
}
74+
75+
public void setAux4(double aux4) {
76+
this.aux4 = aux4;
77+
}
78+
79+
public boolean isDifferentThanRcValues(RCSignals rc) {
80+
if (rc.get(RCSignals.THROTTLE) != throttle) {
81+
return true;
82+
}
83+
if (rc.get(RCSignals.ROLL) != roll) {
84+
return true;
85+
}
86+
if (rc.get(RCSignals.PITCH) != pitch) {
87+
return true;
88+
}
89+
if (rc.get(RCSignals.YAW) != heading) {
90+
return true;
91+
}
92+
if (rc.get(RCSignals.AUX1) != aux1) {
93+
return true;
94+
}
95+
if (rc.get(RCSignals.AUX2) != aux2) {
96+
return true;
97+
}
98+
if (rc.get(RCSignals.AUX3) != aux3) {
99+
return true;
100+
}
101+
if (rc.get(RCSignals.AUX4) != aux4) {
102+
return true;
103+
}
104+
105+
return false;
106+
}
107+
108+
public void update(double heading, double pitch, double roll) {
109+
this.heading = heading;
110+
this.pitch = pitch;
111+
this.roll = roll;
112+
}
113+
114+
public void update(RCSignals rc) {
115+
update(rc.get(RCSignals.THROTTLE),
116+
rc.get(RCSignals.YAW),
117+
rc.get(RCSignals.PITCH),
118+
rc.get(RCSignals.ROLL),
119+
rc.get(RCSignals.AUX1),
120+
rc.get(RCSignals.AUX2),
121+
rc.get(RCSignals.AUX3),
122+
rc.get(RCSignals.AUX4)
123+
);
124+
}
125+
126+
public void update(double throttle, double heading, double pitch, double roll, double aux1, double aux2, double aux3, double aux4) {
127+
this.throttle = throttle;
128+
this.heading = heading;
129+
this.pitch = pitch;
130+
this.roll = roll;
131+
this.aux1 = aux1;
132+
this.aux2 = aux2;
133+
this.aux3 = aux3;
134+
this.aux4 = aux4;
135+
}
136+
}

app/src/main/java/com/fewlaps/flone/io/bean/SensorInformation.java

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.fewlaps.flone.io.bean;
2+
3+
/**
4+
* @author Roc Boronat (roc@fewlaps.com)
5+
* @date 07/05/2015
6+
*/
7+
public class UsingRawDataChangeRequest {
8+
boolean useRawData;
9+
10+
public UsingRawDataChangeRequest(boolean useRawData) {
11+
this.useRawData = useRawData;
12+
}
13+
14+
public boolean isUsingRawData() {
15+
return useRawData;
16+
}
17+
}

app/src/main/java/com/fewlaps/flone/io/communication/Bluetooth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public boolean Write(byte[] arr) {
126126
}
127127

128128
@Override
129-
public void Close() {
129+
public void close() {
130130
CloseSocket();
131131
}
132132

app/src/main/java/com/fewlaps/flone/io/communication/Communication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public boolean Write(byte[] arr){
131131
return true;
132132
}
133133

134-
public abstract void Close();
134+
public abstract void close();
135135

136136
public abstract void Disable();
137137

app/src/main/java/com/fewlaps/flone/io/communication/RCSignals.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.fewlaps.flone.io.communication;
22

3+
import java.util.Arrays;
4+
35
public class RCSignals {
46
public static int RC_MIN = 1000;
57
public static int RC_MAX = 2000;
@@ -210,12 +212,32 @@ public int[] get() {
210212

211213
@Override
212214
public String toString() {
213-
return "Throttle: " + get(THROTTLE) + "\n" + toStringNoThrottle();
215+
StringBuilder sb = new StringBuilder();
216+
sb.append(" THROT:" + get(THROTTLE));
217+
sb.append(" ROLL:" + get(ROLL));
218+
sb.append(" PITCH:" + get(PITCH));
219+
sb.append(" YAW:" + get(YAW));
220+
sb.append(" AUX1:" + get(AUX1));
221+
// sb.append(" AUX2:" + get(AUX2));
222+
// sb.append(" AUX3:" + get(AUX3));
223+
// sb.append(" AUX4:" + get(AUX4));
224+
225+
return sb.toString();
214226
}
215227

216-
public String toStringNoThrottle() {
217-
return "Roll: " + get(ROLL) + "\n"
218-
+ "Pitch: " + get(PITCH) + "\n"
219-
+ "Yaw: " + get(YAW) + "\n";
228+
@Override
229+
public boolean equals(Object o) {
230+
if (this == o) return true;
231+
if (o == null || getClass() != o.getClass()) return false;
232+
233+
RCSignals rcSignals = (RCSignals) o;
234+
235+
return Arrays.equals(rc_signals_raw, rcSignals.rc_signals_raw);
236+
237+
}
238+
239+
@Override
240+
public int hashCode() {
241+
return Arrays.hashCode(rc_signals_raw);
220242
}
221243
}

app/src/main/java/com/fewlaps/flone/io/communication/Wifi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public byte Read() {
140140
}
141141

142142
@Override
143-
public void Close() {
143+
public void close() {
144144
Connected = false;
145145
if (mySocket != null && mySocket.isConnected())
146146
try {

0 commit comments

Comments
 (0)