Updated version number for test installation

This commit is contained in:
2026-01-22 17:10:15 +11:00
parent 813441645c
commit 8f178d16e9
2 changed files with 38 additions and 37 deletions

View File

@@ -11,7 +11,7 @@ android {
applicationId = "net.mmanningau.speechtokeyboard"
minSdk = 28
targetSdk = 36
versionCode = 4
versionCode = 5
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -54,46 +54,47 @@ class TestModelActivity : AppCompatActivity(), RecognitionListener {
toggleListening()
}
private fun connectToPico() {
val usbManager = getSystemService(Context.USB_SERVICE) as UsbManager
// 1. Find the Device
// (This probes specifically for devices listed in your device_filter.xml)
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(usbManager)
if (availableDrivers.isEmpty()) {
outputText.append("\n> No USB device found.")
return
}
// Assume the first device found is the Pico
val driver = availableDrivers[0]
val connection = usbManager.openDevice(driver.device)
if (connection == null) {
outputText.append("\n> Permission denied. Re-plug device?")
return
}
// 2. Open the Port
// Most Picos use port 0.
usbPort = driver.ports[0]
try {
usbPort?.open(connection)
// 3. Set Parameters (Must match your Pico's C/Python code!)
// 115200 Baud, 8 Data bits, 1 Stop bit, No Parity
usbPort?.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
outputText.append("\n> USB Connected to Pico!")
} catch (e: Exception) {
outputText.append("\n> USB Error: ${e.message}")
}
}
// Initialize the model in background
initModel()
}
private fun connectToPico() {
val usbManager = getSystemService(Context.USB_SERVICE) as UsbManager
// 1. Find the Device
// (This probes specifically for devices listed in your device_filter.xml)
val availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(usbManager)
if (availableDrivers.isEmpty()) {
outputText.append("\n> No USB device found.")
return
}
// Assume the first device found is the Pico
val driver = availableDrivers[0]
val connection = usbManager.openDevice(driver.device)
if (connection == null) {
outputText.append("\n> Permission denied. Re-plug device?")
return
}
// 2. Open the Port
// Most Picos use port 0.
usbPort = driver.ports[0]
try {
usbPort?.open(connection)
// 3. Set Parameters (Must match your Pico's C/Python code!)
// 115200 Baud, 8 Data bits, 1 Stop bit, No Parity
usbPort?.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
outputText.append("\n> USB Connected to Pico!")
} catch (e: Exception) {
outputText.append("\n> USB Error: ${e.message}")
}
}
private fun initModel() {
// We look for the folder inside private storage (same logic as MainActivity)
val modelPath = File(filesDir, "vosk-model")