Changeset 0b72779 in orbit for android/src
- Timestamp:
- 12/25/13 14:46:39 (9 years ago)
- Branches:
- master, Servo
- Children:
- 8b32216
- Parents:
- 2e2c676
- Location:
- android/src/info/puzzlebox/orbit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
android/src/info/puzzlebox/orbit/AudioHandler.java
rb411f40 r0b72779 21 21 private boolean firstRun = true; 22 22 23 // private long sleepTimer = 100; // sleep in milliseconds23 // private long sleepTimer = 100; // sleep in milliseconds 24 24 25 25 private final Object mutex = new Object(); … … 119 119 running = true; 120 120 121 Log.v(TAG, "run()");122 Log.v(TAG, "running: " + running);121 // Log.v(TAG, "run()"); 122 // Log.v(TAG, "running: " + running); 123 123 124 124 // Create and start the HandlerThread - it requires a custom name … … 128 128 // Get the looper from the handlerThread 129 129 // Note: this may return null 130 // Looper looper = handlerThread.getLooper();130 // Looper looper = handlerThread.getLooper(); 131 131 132 132 // Create a new handler - passing in the looper to use and this class as 133 133 // the message handler 134 // Handler handler = new Handler(looper, this);134 // Handler handler = new Handler(looper, this); 135 135 136 136 … … 255 255 // float[] wave=code2wave(code); 256 256 257 // updateControlSignal(throttle,yaw,pitch,channel);257 // updateControlSignal(throttle,yaw,pitch,channel); 258 258 updateControlSignal(); 259 259 -
android/src/info/puzzlebox/orbit/FragmentTabAdvanced.java
r2e2c676 r0b72779 247 247 * Set Custom Device Settings 248 248 */ 249 ((OrbitTabActivity)getActivity()).setDeviceCustomSettings();249 setDeviceCustomSettings(); 250 250 251 251 … … 457 457 458 458 // ################################################################ 459 459 460 460 public void onCheckBoxGenerateAudioClicked(View view) { 461 461 … … 862 862 863 863 // ################################################################ 864 865 public void setDeviceCustomSettings() { 866 867 /** 868 * Performs customs settings according to http://orbit.puzzlebox.info/tracker/wiki/OrbitDeviceCompatibility 869 */ 870 871 String deviceManufacturer = Build.MANUFACTURER; //.toLowerCase(Locale.ENGLISH); 872 String deviceModel = Build.MODEL; //.toLowerCase(Locale.ENGLISH); 873 String deviceDevice = Build.DEVICE; //.toLowerCase(Locale.ENGLISH); 874 875 Log.v(TAG, "Device Information:\n"); 876 Log.v(TAG, ((OrbitTabActivity)getActivity()).getDeviceDetails()); 877 878 // Nexus 7 879 if ((deviceManufacturer.contains("asus")) && 880 (deviceModel.contains("Nexus 7")) && 881 (deviceDevice.contains("grouper"))) { 882 Log.v(TAG, "Device detected: Google Nexus 7 (2012)"); 883 // if (checkBoxGenerateAudio.isChecked()) 884 // checkBoxGenerateAudio.performClick(); 885 886 } 887 888 // Samsung Galaxy S4 (US) 889 else if ((deviceManufacturer.contains("samsung")) && 890 (deviceModel.contains("SGH-M919"))) { 891 Log.v(TAG, "Device detected: Samsung Galaxy S4 (US)"); 892 if (checkBoxGenerateAudio.isChecked()) 893 checkBoxGenerateAudio.performClick(); 894 } 895 896 // Samsung Galaxy S4 (EU) 897 else if ((deviceManufacturer.contains("samsung")) && 898 (deviceModel.contains("GT-I9505"))) { 899 Log.v(TAG, "Device detected: Samsung Galaxy S4 (EU)"); 900 if (checkBoxGenerateAudio.isChecked()) 901 checkBoxGenerateAudio.performClick(); 902 } 903 904 // HTC One X 905 else if ((deviceManufacturer.contains("HTC")) && 906 (deviceModel.contains("HTC One X"))) { 907 Log.v(TAG, "Device detected: HTC One X"); 908 if (! checkBoxInvertControlSignal.isChecked()) 909 checkBoxInvertControlSignal.performClick(); 910 } 911 912 else { 913 Log.v(TAG, "No custom device settings found."); 914 } 915 916 } // setDeviceCustomSettings 917 918 919 // ################################################################ 864 920 // ################################################################ 865 921 … … 873 929 private int throttleStepDefault = 1; 874 930 private int throttleStepSleepDefault = 100; 931 private double throttleStepAccelerateThreshold = 0.5; // 0.667 = 2/3rds between current Throttle and point where blades stop spinning 932 private double throttleStepAccelerateMultiplyer = 2; 933 private double throttleStepAccelerateValue = 0.333; // 0.5 = divide sleep time in half 934 875 935 public int throttlePrevious; 876 936 public boolean keepDescending = true; … … 898 958 if ((! stepAccelerated) && 899 959 (fragmentAdvanced.seekBarThrottle.getProgress() - throttleTarget) <= 900 (int) ((throttlePrevious - throttleTarget) * 0.667)) { 901 throttleStep = throttleStep * 2; 902 // throttleStepSleep = (int) (throttleStepSleep * 0.667); 903 throttleStepSleep = (int) (throttleStepSleep * 0.5); 960 (int) ((throttlePrevious - throttleTarget) * throttleStepAccelerateThreshold)) { 961 throttleStep = throttleStep * throttleStepAccelerateMultiplyer; 962 throttleStepSleep = (int) (throttleStepSleep * throttleStepAccelerateValue); 904 963 stepAccelerated = true; 905 964 } -
android/src/info/puzzlebox/orbit/OrbitTabActivity.java
r2e2c676 r0b72779 1153 1153 // ################################################################ 1154 1154 1155 public void setDeviceCustomSettings() {1156 1157 /**1158 * Performs customs settings according to http://orbit.puzzlebox.info/tracker/wiki/OrbitDeviceCompatibility1159 */1160 1161 String deviceManufacturer = Build.MANUFACTURER; //.toLowerCase(Locale.ENGLISH);1162 String deviceModel = Build.MODEL; //.toLowerCase(Locale.ENGLISH);1163 String deviceDevice = Build.DEVICE; //.toLowerCase(Locale.ENGLISH);1164 1165 Log.v(TAG, "Device Information:\n");1166 Log.v(TAG, getDeviceDetails());1167 1168 FragmentTabAdvanced fragmentAdvanced =1169 (FragmentTabAdvanced) getSupportFragmentManager().findFragmentByTag( getTabFragmentAdvanced() );1170 1171 // Nexus 71172 if ((deviceManufacturer.contains("asus")) &&1173 (deviceModel.contains("Nexus 7")) &&1174 (deviceDevice.contains("grouper"))) {1175 Log.v(TAG, "Device detected: Google Nexus 7 (2012)");1176 // if (fragmentAdvanced != null) {1177 //// fragmentAdvanced.checkBoxInvertControlSignal.setChecked(true);1178 //// fragmentAdvanced.checkBoxGenerateAudio.setChecked(true);1179 // fragmentAdvanced.checkBoxInvertControlSignal.performClick();1180 // fragmentAdvanced.checkBoxGenerateAudio.performClick();1181 // }1182 }1183 1184 // Samsung Galaxy S4 (US)1185 else if ((deviceManufacturer.contains("samsung")) &&1186 (deviceModel.contains("SGH-M919"))) {1187 Log.v(TAG, "Device detected: Samsung Galaxy S4 (US)");1188 if (fragmentAdvanced != null) {1189 fragmentAdvanced.checkBoxGenerateAudio.performClick();1190 }1191 }1192 1193 // Samsung Galaxy S4 (EU)1194 else if ((deviceManufacturer.contains("samsung")) &&1195 (deviceModel.contains("GT-I9505"))) {1196 Log.v(TAG, "Device detected: Samsung Galaxy S4 (EU)");1197 if (fragmentAdvanced != null) {1198 fragmentAdvanced.checkBoxGenerateAudio.performClick();1199 }1200 }1201 1202 // HTC One X1203 else if ((deviceManufacturer.contains("HTC")) &&1204 (deviceModel.contains("HTC One X"))) {1205 Log.v(TAG, "Device detected: HTC One X");1206 if (fragmentAdvanced != null) {1207 fragmentAdvanced.checkBoxInvertControlSignal.performClick();1208 }1209 }1210 1211 else {1212 Log.v(TAG, "No custom device settings found.");1213 }1214 1215 } // setDeviceCustomSettings1155 // public void setDeviceCustomSettings() { 1156 // 1157 // /** 1158 // * Performs customs settings according to http://orbit.puzzlebox.info/tracker/wiki/OrbitDeviceCompatibility 1159 // */ 1160 // 1161 // String deviceManufacturer = Build.MANUFACTURER; //.toLowerCase(Locale.ENGLISH); 1162 // String deviceModel = Build.MODEL; //.toLowerCase(Locale.ENGLISH); 1163 // String deviceDevice = Build.DEVICE; //.toLowerCase(Locale.ENGLISH); 1164 // 1165 // Log.v(TAG, "Device Information:\n"); 1166 // Log.v(TAG, getDeviceDetails()); 1167 // 1168 // FragmentTabAdvanced fragmentAdvanced = 1169 // (FragmentTabAdvanced) getSupportFragmentManager().findFragmentByTag( getTabFragmentAdvanced() ); 1170 // 1171 // // Nexus 7 1172 // if ((deviceManufacturer.contains("asus")) && 1173 // (deviceModel.contains("Nexus 7")) && 1174 // (deviceDevice.contains("grouper"))) { 1175 // Log.v(TAG, "Device detected: Google Nexus 7 (2012)"); 1176 // // if (fragmentAdvanced != null) { 1177 // //// fragmentAdvanced.checkBoxInvertControlSignal.setChecked(true); 1178 // //// fragmentAdvanced.checkBoxGenerateAudio.setChecked(true); 1179 // // fragmentAdvanced.checkBoxInvertControlSignal.performClick(); 1180 // // fragmentAdvanced.checkBoxGenerateAudio.performClick(); 1181 // // } 1182 // } 1183 // 1184 // // Samsung Galaxy S4 (US) 1185 // else if ((deviceManufacturer.contains("samsung")) && 1186 // (deviceModel.contains("SGH-M919"))) { 1187 // Log.v(TAG, "Device detected: Samsung Galaxy S4 (US)"); 1188 // if (fragmentAdvanced != null) { 1189 // fragmentAdvanced.checkBoxGenerateAudio.performClick(); 1190 // } 1191 // } 1192 // 1193 // // Samsung Galaxy S4 (EU) 1194 // else if ((deviceManufacturer.contains("samsung")) && 1195 // (deviceModel.contains("GT-I9505"))) { 1196 // Log.v(TAG, "Device detected: Samsung Galaxy S4 (EU)"); 1197 // if (fragmentAdvanced != null) { 1198 // fragmentAdvanced.checkBoxGenerateAudio.performClick(); 1199 // } 1200 // } 1201 // 1202 // // HTC One X 1203 // else if ((deviceManufacturer.contains("HTC")) && 1204 // (deviceModel.contains("HTC One X"))) { 1205 // Log.v(TAG, "Device detected: HTC One X"); 1206 // if (fragmentAdvanced != null) { 1207 // fragmentAdvanced.checkBoxInvertControlSignal.performClick(); 1208 // } 1209 // } 1210 // 1211 // else { 1212 // Log.v(TAG, "No custom device settings found."); 1213 // } 1214 // 1215 // } // setDeviceCustomSettings 1216 1216 1217 1217
Note: See TracChangeset
for help on using the changeset viewer.