We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7bfdf4 commit 770bdc1Copy full SHA for 770bdc1
1 file changed
src/org/audiosync/MainActivity.java
@@ -27,7 +27,7 @@ protected void onCreate(Bundle savedInstanceState) {
27
28
@Override
29
public void onClick(View arg0) {
30
- int[] bytes_to_send = new int[3];
+ int[] bytes_to_send = new int[4];
31
try {
32
bytes_to_send[0] = Integer.parseInt(sceneInp.getText().toString());
33
bytes_to_send[1] = Integer.parseInt(shotInp.getText().toString());
@@ -39,6 +39,13 @@ public void onClick(View arg0) {
39
}
40
41
42
+ int checksum = 0;
43
+ for (int i : bytes_to_send) {
44
+ checksum += i;
45
+ }
46
+ checksum %= 255;
47
+ bytes_to_send[3] = checksum;
48
+
49
} catch (NumberFormatException e) {
50
Toast.makeText(MainActivity.this, "invalid numbers in textfields", Toast.LENGTH_SHORT).show();
51
return;
0 commit comments