Skip to content

Commit 0f1e43e

Browse files
HW Settings Fixes
Signed-off-by: Keith Conger <keith.conger@blackboxembedded.com>
1 parent 2e11808 commit 0f1e43e

8 files changed

Lines changed: 306 additions & 303 deletions

File tree

app/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdk = 36
4+
compileSdk = 37
55
defaultConfig {
66
applicationId "com.blackboxembedded.WunderLINQ"
77
minSdkVersion 26
88
targetSdkVersion 36
9-
versionCode 216
10-
versionName "2.99.7"
9+
versionCode 215
10+
versionName "2.99.6"
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1212
vectorDrawables.useSupportLibrary = true
1313
Properties properties = new Properties()
@@ -58,8 +58,8 @@ dependencies {
5858
implementation 'androidx.preference:preference:1.2.1'
5959
implementation 'androidx.gridlayout:gridlayout:1.1.0'
6060
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
61-
implementation "androidx.lifecycle:lifecycle-viewmodel:2.10.0"
62-
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.10.0"
61+
implementation "androidx.lifecycle:lifecycle-viewmodel:2.11.0"
62+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0"
6363
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
6464
implementation 'com.google.android.material:material:1.14.0'
6565
implementation 'com.google.android.gms:play-services-location:21.3.0'
@@ -69,7 +69,7 @@ dependencies {
6969
implementation 'ca.rmen:lib-sunrise-sunset:1.1.2'
7070
implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
7171
implementation 'io.jenetics:jpx:3.2.1'
72-
implementation 'com.fasterxml.woodstox:woodstox-core:7.2.0'
72+
implementation 'com.fasterxml.woodstox:woodstox-core:7.2.1'
7373
implementation 'stax:stax:1.2.0'
7474
implementation 'com.github.ticofab:android-gpx-parser:2.3.1'
7575
implementation 'com.caverock:androidsvg-aar:1.4'

app/src/main/java/com/blackboxembedded/WunderLINQ/HWSettingsActionActivity.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ public void onClick(View v) {
280280
}
281281
MotorcycleData.wlq.setActionKey(actionID, type, modifiers, key);
282282
}
283+
try {
284+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
285+
outputStream.write(MotorcycleData.wlq.WRITE_CONFIG_CMD());
286+
outputStream.write(MotorcycleData.wlq.getTempConfig());
287+
outputStream.write(MotorcycleData.wlq.CMD_EOM());
288+
byte[] writeConfigCmd = outputStream.toByteArray();
289+
Log.d(TAG, "Set HWConfig Command Sent: " + Utils.ByteArrayToHex(writeConfigCmd));
290+
BluetoothLeService.writeCharacteristic(BluetoothLeService.gattCommandCharacteristic, writeConfigCmd, BluetoothLeService.WriteType.WITH_RESPONSE);
291+
} catch (IOException e) {
292+
Log.d(TAG, e.toString());
293+
}
283294
Intent backIntent = new Intent(HWSettingsActionActivity.this, HWSettingsActivity.class);
284295
startActivity(backIntent);
285296
} else if (v.getId() == R.id.btCancel) {
@@ -450,8 +461,7 @@ private void setHWMode(byte mode){
450461
} catch (IOException e) {
451462
Log.d(TAG, e.toString());
452463
}
453-
finish();
454-
Intent backIntent = new Intent(HWSettingsActionActivity.this, MainActivity.class);
464+
Intent backIntent = new Intent(HWSettingsActionActivity.this, HWSettingsActivity.class);
455465
backIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
456466
startActivity(backIntent);
457467
});

app/src/main/java/com/blackboxembedded/WunderLINQ/HWSettingsActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,15 @@ private void updateDisplay(){
384384
hwConfigBtn.setVisibility(View.VISIBLE);
385385
}
386386
}
387-
387+
388388
} else {
389389
//TODO: Add No Config msg & get Config button
390390
// Read config
391391
if (BluetoothLeService.gattCommandCharacteristic != null) {
392392
BluetoothLeService.writeCharacteristic(BluetoothLeService.gattCommandCharacteristic, WLQ_BASE.GET_CONFIG_CMD, BluetoothLeService.WriteType.WITH_RESPONSE);
393393
}
394394
}
395+
adapter.notifyDataSetChanged();
395396
}
396397

397398
private void resetHWConfig(){

app/src/main/java/com/blackboxembedded/WunderLINQ/hardware/WLQ/WLQ_N.java

Lines changed: 80 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -219,88 +219,86 @@ public WLQ_N(byte[] bytes) {
219219
byte[] flashConfigPart = new byte[configFlashSize];
220220
System.arraycopy(bytes, 26, flashConfigPart, 0, configFlashSize);
221221

222-
if (!Arrays.equals(flashConfig, flashConfigPart)) {
223-
flashConfig = new byte[configFlashSize];
224-
System.arraycopy(flashConfigPart, 0, flashConfig, 0, flashConfigPart.length);
225-
226-
tempConfig = new byte[flashConfig.length];
227-
System.arraycopy(flashConfig, 0, tempConfig, 0, flashConfig.length);
228-
229-
Log.d(TAG, "New flashConfig: " + Utils.ByteArrayToHex(flashConfig));
230-
231-
firmwareVersion = bytes[firmwareVersionMajor_INDEX] + "." + bytes[firmwareVersionMinor_INDEX];
232-
Log.d(TAG, "Firmware Version: " + firmwareVersion);
233-
234-
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(MyApplication.getContext()).edit();
235-
editor.putString("firmwareVersion", firmwareVersion);
236-
editor.apply();
237-
238-
keyMode = bytes[keyMode_INDEX];
239-
USBVinThreshold = ((flashConfig[USBVinThresholdHigh_INDEX] & 0xFF) << 8) | (flashConfig[USBVinThresholdLow_INDEX] & 0xFF);
240-
RTKSensitivity = flashConfig[RTKSensitivity_INDEX];
241-
RTKPagePressKeyType = flashConfig[RTKPagePressKeyType_INDEX];
242-
RTKPagePressKeyModifier = flashConfig[RTKPagePressKeyModifier_INDEX];
243-
RTKPagePressKey = flashConfig[RTKPagePressKey_INDEX];
244-
RTKPageDoublePressKeyType = flashConfig[RTKPageDoublePressKeyType_INDEX];
245-
RTKPageDoublePressKeyModifier = flashConfig[RTKPageDoublePressKeyModifier_INDEX];
246-
RTKPageDoublePressKey = flashConfig[RTKPageDoublePressKey_INDEX];
247-
RTKZoomPPressKeyType = flashConfig[RTKZoomPPressKeyType_INDEX];
248-
RTKZoomPPressKeyModifier = flashConfig[RTKZoomPPressKeyModifier_INDEX];
249-
RTKZoomPPressKey = flashConfig[RTKZoomPPressKey_INDEX];
250-
RTKZoomPDoublePressKeyType = flashConfig[RTKZoomPDoublePressKeyType_INDEX];
251-
RTKZoomPDoublePressKeyModifier = flashConfig[RTKZoomPDoublePressKeyModifier_INDEX];
252-
RTKZoomPDoublePressKey = flashConfig[RTKZoomPDoublePressKey_INDEX];
253-
RTKZoomMPressKeyType = flashConfig[RTKZoomMPressKeyType_INDEX];
254-
RTKZoomMPressKeyModifier = flashConfig[RTKZoomMPressKeyModifier_INDEX];
255-
RTKZoomMPressKey = flashConfig[RTKZoomMPressKey_INDEX];
256-
RTKZoomMDoublePressKeyType = flashConfig[RTKZoomMDoublePressKeyType_INDEX];
257-
RTKZoomMDoublePressKeyModifier = flashConfig[RTKZoomMDoublePressKeyModifier_INDEX];
258-
RTKZoomMDoublePressKey = flashConfig[RTKZoomMDoublePressKey_INDEX];
259-
RTKSpeakPressKeyType = flashConfig[RTKSpeakPressKeyType_INDEX];
260-
RTKSpeakPressKeyModifier = flashConfig[RTKSpeakPressKeyModifier_INDEX];
261-
RTKSpeakPressKey = flashConfig[RTKSpeakPressKey_INDEX];
262-
RTKSpeakDoublePressKeyType = flashConfig[RTKSpeakDoublePressKeyType_INDEX];
263-
RTKSpeakDoublePressKeyModifier = flashConfig[RTKSpeakDoublePressKeyModifier_INDEX];
264-
RTKSpeakDoublePressKey = flashConfig[RTKSpeakDoublePressKey_INDEX];
265-
RTKMutePressKeyType = flashConfig[RTKMutePressKeyType_INDEX];
266-
RTKMutePressKeyModifier = flashConfig[RTKMutePressKeyModifier_INDEX];
267-
RTKMutePressKey = flashConfig[RTKMutePressKey_INDEX];
268-
RTKMuteDoublePressKeyType = flashConfig[RTKMuteDoublePressKeyType_INDEX];
269-
RTKMuteDoublePressKeyModifier = flashConfig[RTKMuteDoublePressKeyModifier_INDEX];
270-
RTKMuteDoublePressKey = flashConfig[RTKMuteDoublePressKey_INDEX];
271-
RTKDisplayPressKeyType = flashConfig[RTKDisplayPressKeyType_INDEX];
272-
RTKDisplayPressKeyModifier = flashConfig[RTKDisplayPressKeyModifier_INDEX];
273-
RTKDisplayPressKey = flashConfig[RTKDisplayPressKey_INDEX];
274-
RTKDisplayDoublePressKeyType = flashConfig[RTKDisplayDoublePressKeyType_INDEX];
275-
RTKDisplayDoublePressKeyModifier = flashConfig[RTKDisplayDoublePressKeyModifier_INDEX];
276-
RTKDisplayDoublePressKey = flashConfig[RTKDisplayDoublePressKey_INDEX];
277-
278-
fullSensitivity = flashConfig[fullSensitivity_INDEX];
279-
fullRightPressKeyType = flashConfig[fullRightPressKeyType_INDEX];
280-
fullRightPressKeyModifier = flashConfig[fullRightPressKeyModifier_INDEX];
281-
fullRightPressKey = flashConfig[fullRightPressKey_INDEX];
282-
fullRightLongPressKeyType = flashConfig[fullRightLongPressKeyType_INDEX];
283-
fullRightLongPressKeyModifier = flashConfig[fullRightLongPressKeyModifier_INDEX];
284-
fullRightLongPressKey = flashConfig[fullRightLongPressKey_INDEX];
285-
fullLeftPressKeyType = flashConfig[fullLeftPressKeyType_INDEX];
286-
fullLeftPressKeyModifier = flashConfig[fullLeftPressKeyModifier_INDEX];
287-
fullLeftPressKey = flashConfig[fullLeftPressKey_INDEX];
288-
fullLeftLongPressKeyType = flashConfig[fullLeftLongPressKeyType_INDEX];
289-
fullLeftLongPressKeyModifier = flashConfig[fullLeftLongPressKeyModifier_INDEX];
290-
fullLeftLongPressKey = flashConfig[fullLeftLongPressKey_INDEX];
291-
fullScrollUpKeyType = flashConfig[fullScrollUpKeyType_INDEX];
292-
fullScrollUpKeyModifier = flashConfig[fullScrollUpKeyModifier_INDEX];
293-
fullScrollUpKey = flashConfig[fullScrollUpKey_INDEX];
294-
fullScrollDownKeyType = flashConfig[fullScrollDownKeyType_INDEX];
295-
fullScrollDownKeyModifier = flashConfig[fullScrollDownKeyModifier_INDEX];
296-
fullScrollDownKey = flashConfig[fullScrollDownKey_INDEX];
297-
fullSignalPressKeyType = flashConfig[fullSignalPressKeyType_INDEX];
298-
fullSignalPressKeyModifier = flashConfig[fullSignalPressKeyModifier_INDEX];
299-
fullSignalPressKey = flashConfig[fullSignalPressKey_INDEX];
300-
fullSignalLongPressKeyType = flashConfig[fullSignalLongPressKeyType_INDEX];
301-
fullSignalLongPressKeyModifier = flashConfig[fullSignalLongPressKeyModifier_INDEX];
302-
fullSignalLongPressKey = flashConfig[fullSignalLongPressKey_INDEX];
303-
}
222+
flashConfig = new byte[configFlashSize];
223+
System.arraycopy(flashConfigPart, 0, flashConfig, 0, flashConfigPart.length);
224+
225+
tempConfig = new byte[flashConfig.length];
226+
System.arraycopy(flashConfig, 0, tempConfig, 0, flashConfig.length);
227+
228+
Log.d(TAG, "New flashConfig: " + Utils.ByteArrayToHex(flashConfig));
229+
230+
firmwareVersion = bytes[firmwareVersionMajor_INDEX] + "." + bytes[firmwareVersionMinor_INDEX];
231+
Log.d(TAG, "Firmware Version: " + firmwareVersion);
232+
233+
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(MyApplication.getContext()).edit();
234+
editor.putString("firmwareVersion", firmwareVersion);
235+
editor.apply();
236+
237+
keyMode = bytes[keyMode_INDEX];
238+
USBVinThreshold = ((flashConfig[USBVinThresholdHigh_INDEX] & 0xFF) << 8) | (flashConfig[USBVinThresholdLow_INDEX] & 0xFF);
239+
RTKSensitivity = flashConfig[RTKSensitivity_INDEX];
240+
RTKPagePressKeyType = flashConfig[RTKPagePressKeyType_INDEX];
241+
RTKPagePressKeyModifier = flashConfig[RTKPagePressKeyModifier_INDEX];
242+
RTKPagePressKey = flashConfig[RTKPagePressKey_INDEX];
243+
RTKPageDoublePressKeyType = flashConfig[RTKPageDoublePressKeyType_INDEX];
244+
RTKPageDoublePressKeyModifier = flashConfig[RTKPageDoublePressKeyModifier_INDEX];
245+
RTKPageDoublePressKey = flashConfig[RTKPageDoublePressKey_INDEX];
246+
RTKZoomPPressKeyType = flashConfig[RTKZoomPPressKeyType_INDEX];
247+
RTKZoomPPressKeyModifier = flashConfig[RTKZoomPPressKeyModifier_INDEX];
248+
RTKZoomPPressKey = flashConfig[RTKZoomPPressKey_INDEX];
249+
RTKZoomPDoublePressKeyType = flashConfig[RTKZoomPDoublePressKeyType_INDEX];
250+
RTKZoomPDoublePressKeyModifier = flashConfig[RTKZoomPDoublePressKeyModifier_INDEX];
251+
RTKZoomPDoublePressKey = flashConfig[RTKZoomPDoublePressKey_INDEX];
252+
RTKZoomMPressKeyType = flashConfig[RTKZoomMPressKeyType_INDEX];
253+
RTKZoomMPressKeyModifier = flashConfig[RTKZoomMPressKeyModifier_INDEX];
254+
RTKZoomMPressKey = flashConfig[RTKZoomMPressKey_INDEX];
255+
RTKZoomMDoublePressKeyType = flashConfig[RTKZoomMDoublePressKeyType_INDEX];
256+
RTKZoomMDoublePressKeyModifier = flashConfig[RTKZoomMDoublePressKeyModifier_INDEX];
257+
RTKZoomMDoublePressKey = flashConfig[RTKZoomMDoublePressKey_INDEX];
258+
RTKSpeakPressKeyType = flashConfig[RTKSpeakPressKeyType_INDEX];
259+
RTKSpeakPressKeyModifier = flashConfig[RTKSpeakPressKeyModifier_INDEX];
260+
RTKSpeakPressKey = flashConfig[RTKSpeakPressKey_INDEX];
261+
RTKSpeakDoublePressKeyType = flashConfig[RTKSpeakDoublePressKeyType_INDEX];
262+
RTKSpeakDoublePressKeyModifier = flashConfig[RTKSpeakDoublePressKeyModifier_INDEX];
263+
RTKSpeakDoublePressKey = flashConfig[RTKSpeakDoublePressKey_INDEX];
264+
RTKMutePressKeyType = flashConfig[RTKMutePressKeyType_INDEX];
265+
RTKMutePressKeyModifier = flashConfig[RTKMutePressKeyModifier_INDEX];
266+
RTKMutePressKey = flashConfig[RTKMutePressKey_INDEX];
267+
RTKMuteDoublePressKeyType = flashConfig[RTKMuteDoublePressKeyType_INDEX];
268+
RTKMuteDoublePressKeyModifier = flashConfig[RTKMuteDoublePressKeyModifier_INDEX];
269+
RTKMuteDoublePressKey = flashConfig[RTKMuteDoublePressKey_INDEX];
270+
RTKDisplayPressKeyType = flashConfig[RTKDisplayPressKeyType_INDEX];
271+
RTKDisplayPressKeyModifier = flashConfig[RTKDisplayPressKeyModifier_INDEX];
272+
RTKDisplayPressKey = flashConfig[RTKDisplayPressKey_INDEX];
273+
RTKDisplayDoublePressKeyType = flashConfig[RTKDisplayDoublePressKeyType_INDEX];
274+
RTKDisplayDoublePressKeyModifier = flashConfig[RTKDisplayDoublePressKeyModifier_INDEX];
275+
RTKDisplayDoublePressKey = flashConfig[RTKDisplayDoublePressKey_INDEX];
276+
277+
fullSensitivity = flashConfig[fullSensitivity_INDEX];
278+
fullRightPressKeyType = flashConfig[fullRightPressKeyType_INDEX];
279+
fullRightPressKeyModifier = flashConfig[fullRightPressKeyModifier_INDEX];
280+
fullRightPressKey = flashConfig[fullRightPressKey_INDEX];
281+
fullRightLongPressKeyType = flashConfig[fullRightLongPressKeyType_INDEX];
282+
fullRightLongPressKeyModifier = flashConfig[fullRightLongPressKeyModifier_INDEX];
283+
fullRightLongPressKey = flashConfig[fullRightLongPressKey_INDEX];
284+
fullLeftPressKeyType = flashConfig[fullLeftPressKeyType_INDEX];
285+
fullLeftPressKeyModifier = flashConfig[fullLeftPressKeyModifier_INDEX];
286+
fullLeftPressKey = flashConfig[fullLeftPressKey_INDEX];
287+
fullLeftLongPressKeyType = flashConfig[fullLeftLongPressKeyType_INDEX];
288+
fullLeftLongPressKeyModifier = flashConfig[fullLeftLongPressKeyModifier_INDEX];
289+
fullLeftLongPressKey = flashConfig[fullLeftLongPressKey_INDEX];
290+
fullScrollUpKeyType = flashConfig[fullScrollUpKeyType_INDEX];
291+
fullScrollUpKeyModifier = flashConfig[fullScrollUpKeyModifier_INDEX];
292+
fullScrollUpKey = flashConfig[fullScrollUpKey_INDEX];
293+
fullScrollDownKeyType = flashConfig[fullScrollDownKeyType_INDEX];
294+
fullScrollDownKeyModifier = flashConfig[fullScrollDownKeyModifier_INDEX];
295+
fullScrollDownKey = flashConfig[fullScrollDownKey_INDEX];
296+
fullSignalPressKeyType = flashConfig[fullSignalPressKeyType_INDEX];
297+
fullSignalPressKeyModifier = flashConfig[fullSignalPressKeyModifier_INDEX];
298+
fullSignalPressKey = flashConfig[fullSignalPressKey_INDEX];
299+
fullSignalLongPressKeyType = flashConfig[fullSignalLongPressKeyType_INDEX];
300+
fullSignalLongPressKeyModifier = flashConfig[fullSignalLongPressKeyModifier_INDEX];
301+
fullSignalLongPressKey = flashConfig[fullSignalLongPressKey_INDEX];
304302
}
305303

306304
@Override

0 commit comments

Comments
 (0)