Skip to content

Commit

Permalink
Bug fix for UHF implementation, where app restart would sometimes fai…
Browse files Browse the repository at this point in the history
…l to apply the saved UHF/VHF setting properly, and it would think the firmware is not responding.
  • Loading branch information
VanceVagell committed Jan 21, 2025
1 parent 6de872b commit 902e264
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,12 @@ public void setRadioType(String radioType) {
setMaxRadioFreq(UHF_MAX_FREQ);
}

// Re-init connection to ESP32 so it knows what kind of module it has.
setMode(MODE_STARTUP);
checkedFirmwareVersion = false;
checkFirmwareVersion();
if (mode != MODE_STARTUP) {
// Re-init connection to ESP32 so it knows what kind of module it has.
setMode(MODE_STARTUP);
checkedFirmwareVersion = false;
checkFirmwareVersion();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,23 @@ public void forceTunedToFreq(String newFreqStr) {

radioAudioService.setCallbacks(callbacks);
radioAudioService.setChannelMemories(viewModel.getChannelMemories());
radioAudioService.start();

// 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");

runOnUiThread(new Runnable() {
@Override
public void run() {
radioAudioService.setRadioType(moduleTypeSetting.value.equals("UHF") ?
RadioAudioService.RADIO_MODULE_UHF : RadioAudioService.RADIO_MODULE_VHF);
radioAudioService.start();
}
});
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ void loop() {

Serial.write(VERSION_PREFIX, sizeof(VERSION_PREFIX)); // "VERSION"
Serial.write(FIRMWARE_VER, sizeof(FIRMWARE_VER)); // "00000007" (or whatever)

// Append radio module info to end, "f" (found) or "x" (can't contact module).
uint8_t radioModuleStatusArray[1] = { radioModuleStatus };
Serial.write(radioModuleStatusArray, 1); // "f" (or "x" if there's a problem with radio module)

Expand Down

0 comments on commit 902e264

Please sign in to comment.