Compare commits
5 Commits
usb_releas
...
dev-server
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92feb5d353 | ||
|
|
f4387871fb | ||
|
|
0e2d1daaf6 | ||
|
|
83354e37d9 | ||
|
|
bd8df47262 |
@@ -21,7 +21,7 @@ android {
|
|||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 130
|
versionCode 130
|
||||||
versionName "2.1.130"
|
versionName "2.1.130 -usb"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ android {
|
|||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ class UsbTerminalFragment : Fragment() {
|
|||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
|
||||||
): View {
|
): View {
|
||||||
binding = FragmentUsbTerminalBinding.inflate(inflater, container, false)
|
binding = FragmentUsbTerminalBinding.inflate(inflater, container, false)
|
||||||
|
binding.clearQueueButton.setOnClickListener {
|
||||||
|
clearQueue()
|
||||||
|
}
|
||||||
sharedPreferences = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
sharedPreferences = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
@@ -75,9 +78,7 @@ class UsbTerminalFragment : Fragment() {
|
|||||||
binding.etCommands.text.clear()
|
binding.etCommands.text.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.button.setOnClickListener{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
listenToHemoCube()
|
listenToHemoCube()
|
||||||
callCommand("I")
|
callCommand("I")
|
||||||
@@ -94,9 +95,7 @@ class UsbTerminalFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addToQueue(commands: List<String>) {
|
private fun addToQueue(commands: List<String>) {
|
||||||
commandQueue.clear()
|
// Append new commands to the queue instead of replacing it
|
||||||
currentCommand = null
|
|
||||||
|
|
||||||
commandQueue.addAll(commands)
|
commandQueue.addAll(commands)
|
||||||
|
|
||||||
// Track commands in the activity
|
// Track commands in the activity
|
||||||
@@ -106,8 +105,14 @@ class UsbTerminalFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendFormattedMessage("\nNew priority commands: ${commands.joinToString(" ")}")
|
appendFormattedMessage("\nAdded commands to queue: ${commands.joinToString(" ")}")
|
||||||
processNextCommand()
|
processNextCommand() // Start processing if not already in progress
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clearQueue() {
|
||||||
|
commandQueue.clear()
|
||||||
|
currentCommand = null
|
||||||
|
appendFormattedMessage("\nCommand queue cleared")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button"
|
android:id="@+id/clearQueueButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Clar All Commands" />
|
android:text="Clar All Commands" />
|
||||||
|
|||||||
Reference in New Issue
Block a user