Compare commits

...

5 Commits

3 changed files with 15 additions and 9 deletions

View File

@@ -21,7 +21,7 @@ android {
minSdk 21
targetSdk 34
versionCode 130
versionName "2.1.130"
versionName "2.1.130 -usb"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -30,6 +30,7 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
compileOptions {

View File

@@ -42,6 +42,9 @@ class UsbTerminalFragment : Fragment() {
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
): View {
binding = FragmentUsbTerminalBinding.inflate(inflater, container, false)
binding.clearQueueButton.setOnClickListener {
clearQueue()
}
sharedPreferences = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
return binding.root
}
@@ -75,9 +78,7 @@ class UsbTerminalFragment : Fragment() {
binding.etCommands.text.clear()
}
}
binding.button.setOnClickListener{
}
listenToHemoCube()
callCommand("I")
@@ -94,9 +95,7 @@ class UsbTerminalFragment : Fragment() {
}
private fun addToQueue(commands: List<String>) {
commandQueue.clear()
currentCommand = null
// Append new commands to the queue instead of replacing it
commandQueue.addAll(commands)
// Track commands in the activity
@@ -106,8 +105,14 @@ class UsbTerminalFragment : Fragment() {
}
}
appendFormattedMessage("\nNew priority commands: ${commands.joinToString(" ")}")
processNextCommand()
appendFormattedMessage("\nAdded commands to queue: ${commands.joinToString(" ")}")
processNextCommand() // Start processing if not already in progress
}
fun clearQueue() {
commandQueue.clear()
currentCommand = null
appendFormattedMessage("\nCommand queue cleared")
}

View File

@@ -18,7 +18,7 @@
android:padding="16dp">
<Button
android:id="@+id/button"
android:id="@+id/clearQueueButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Clar All Commands" />