Skip to content

Commit 99939fc

Browse files
committed
Speculative fix for crash bug #229 because I can't repro it, and added support for another serial chip used on some ESP32 dev modules.
1 parent 1b8b5c0 commit 99939fc

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

android-src/KV4PHT/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.vagell.kv4pht"
1111
minSdk 26
1212
targetSdk 34
13-
versionCode 36
14-
versionName "1.7.2"
13+
versionCode 37
14+
versionName "1.7.3"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717

android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/radio/RadioAudioService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public class RadioAudioService extends Service {
105105

106106
// Must match the ESP32 device we support.
107107
// Idx 0 matches https://www.amazon.com/gp/product/B08D5ZD528
108-
private static final int[] ESP32_VENDOR_IDS = {4292};
109-
private static final int[] ESP32_PRODUCT_IDS = {60000};
108+
private static final int[] ESP32_VENDOR_IDS = {4292, 6790};
109+
private static final int[] ESP32_PRODUCT_IDS = {60000, 29987};
110110

111111
// Version related constants (also see FirmwareUtils for others)
112112
private static final String VERSION_PREFIX = "VERSION";
@@ -977,6 +977,8 @@ public void run() {
977977
* @param radioType should be RADIO_TYPE_UHF or RADIO_TYPE_VHF
978978
*/
979979
public void setRadioType(String radioType) {
980+
Log.d("DEBUG", "setRadioType: " + radioType);
981+
980982
if (!this.radioType.equals(radioType)) {
981983
this.radioType = radioType;
982984

android-src/KV4PHT/app/src/main/java/com/vagell/kv4pht/ui/MainActivity.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -508,24 +508,26 @@ public void forcedPttEnd() { // When user releases physical PTT.
508508
radioAudioService.setChannelMemories(viewModel.getChannelMemories());
509509

510510
// Can only retrieve moduleType from DB async, so we do that and tell radioAudioService.
511-
threadPoolExecutor.execute(new Runnable() {
512-
@Override
513-
public void run() {
514-
final AppSetting moduleTypeSetting = viewModel.appDb.appSettingDao().getByName("moduleType");
511+
if (null != threadPoolExecutor) {
512+
threadPoolExecutor.execute(new Runnable() {
513+
@Override
514+
public void run() {
515+
final AppSetting moduleTypeSetting = viewModel.appDb.appSettingDao().getByName("moduleType");
515516

516-
runOnUiThread(new Runnable() {
517-
@Override
518-
public void run() {
519-
radioAudioService.setRadioType(
520-
"UHF".equals(Optional.ofNullable(moduleTypeSetting).map(setting -> setting.value).orElse("VHF"))
521-
? RadioAudioService.RADIO_MODULE_UHF
522-
: RadioAudioService.RADIO_MODULE_VHF
523-
);
524-
radioAudioService.start();
525-
}
526-
});
527-
}
528-
});
517+
runOnUiThread(new Runnable() {
518+
@Override
519+
public void run() {
520+
radioAudioService.setRadioType(
521+
"UHF".equals(Optional.ofNullable(moduleTypeSetting).map(setting -> setting.value).orElse("VHF"))
522+
? RadioAudioService.RADIO_MODULE_UHF
523+
: RadioAudioService.RADIO_MODULE_VHF
524+
);
525+
radioAudioService.start();
526+
}
527+
});
528+
}
529+
});
530+
}
529531
}
530532

531533
@Override

0 commit comments

Comments
 (0)