Merge remote-tracking branch 'origin/dev-server-2.1.130-review-retryUsb' into dev-server-2.1.130-review-retryUsb
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user