Skip to content

Commit

Permalink
Speculative fix for crash bug #229 because I can't repro it, and adde…
Browse files Browse the repository at this point in the history
…d support for another serial chip used on some ESP32 dev modules.
  • Loading branch information
VanceVagell committed Feb 10, 2025
1 parent 1b8b5c0 commit 99939fc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions android-src/KV4PHT/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.vagell.kv4pht"
minSdk 26
targetSdk 34
versionCode 36
versionName "1.7.2"
versionCode 37
versionName "1.7.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public class RadioAudioService extends Service {

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

// Version related constants (also see FirmwareUtils for others)
private static final String VERSION_PREFIX = "VERSION";
Expand Down Expand Up @@ -977,6 +977,8 @@ public void run() {
* @param radioType should be RADIO_TYPE_UHF or RADIO_TYPE_VHF
*/
public void setRadioType(String radioType) {
Log.d("DEBUG", "setRadioType: " + radioType);

if (!this.radioType.equals(radioType)) {
this.radioType = radioType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,24 +508,26 @@ public void forcedPttEnd() { // When user releases physical PTT.
radioAudioService.setChannelMemories(viewModel.getChannelMemories());

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

runOnUiThread(new Runnable() {
@Override
public void run() {
radioAudioService.setRadioType(
"UHF".equals(Optional.ofNullable(moduleTypeSetting).map(setting -> setting.value).orElse("VHF"))
? RadioAudioService.RADIO_MODULE_UHF
: RadioAudioService.RADIO_MODULE_VHF
);
radioAudioService.start();
}
});
}
});
runOnUiThread(new Runnable() {
@Override
public void run() {
radioAudioService.setRadioType(
"UHF".equals(Optional.ofNullable(moduleTypeSetting).map(setting -> setting.value).orElse("VHF"))
? RadioAudioService.RADIO_MODULE_UHF
: RadioAudioService.RADIO_MODULE_VHF
);
radioAudioService.start();
}
});
}
});
}
}

@Override
Expand Down

0 comments on commit 99939fc

Please sign in to comment.