Skip to content

Codex/our car - #2

Merged
tian11111 merged 3 commits into
mainfrom
codex/our-car
Jul 22, 2026
Merged

Codex/our car#2
tian11111 merged 3 commits into
mainfrom
codex/our-car

Conversation

@tian11111

Copy link
Copy Markdown
Owner

No description provided.

tian11111 and others added 3 commits July 21, 2026 09:40
移动摇杆 |y| <= |x| 时 (与水平夹角 <= 45°) 取反 moveX。
仅纯横向和平缓斜向受影响,竖直方向不变。
Copilot AI review requested due to automatic review settings July 22, 2026 16:09
@tian11111
tian11111 merged commit 6485a6b into main Jul 22, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the car control UI’s widget system by adding edit/delete affordances, supporting long-press editing of custom widgets, and improving command normalization plus widget visibility management in the ViewModel.

Changes:

  • Added per-widget edit/delete controls and the ability to long-press custom widgets to edit their metadata.
  • Introduced “hide built-in widgets” behavior (instead of removing) and a “restore hidden widgets” action in edit mode.
  • Improved sendCustomCommand framing/normalization and adjusted some control sizing/layout.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
app/src/main/java/com/fangzhou/carcontrol/ui/ControlPanel.kt Adds edit/delete UI affordances, custom-widget long-press editing, and restore-hidden-built-ins UI.
app/src/main/java/com/fangzhou/carcontrol/ui/AddCustomButtonDialog.kt Extends the dialog to support edit use-cases (initial values, title/confirm text) and improves color picker layout.
app/src/main/java/com/fangzhou/carcontrol/MainViewModel.kt Updates command framing, joystick axis adjustments, and adds widget metadata/visibility APIs plus “hide built-ins” semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to +58
var label by remember { mutableStateOf(initialLabel) }
var command by remember { mutableStateOf(initialCommand) }
var selectedColor by remember { mutableStateOf(initialColorHex) }
Comment on lines 132 to 136
onClick = {
if (label.isNotBlank() && command.isNotBlank()) {
onAdd(label.trim(), command.trim(), selectedColor)
onDismiss()
}
Comment on lines +144 to +148
initialLabel = widget.label.orEmpty().ifBlank { widget.id },
initialCommand = widget.command.orEmpty(),
initialColorHex = widget.colorHex,
title = if (widget.isCustom) "编辑自定义按钮" else "覆盖控件命令",
confirmText = "保存"
Comment on lines +363 to +371
val trimmed = command.trim()
if (trimmed.isEmpty()) return
val framed = when {
trimmed.endsWith("\r\n") -> trimmed
trimmed.startsWith("[") -> if (trimmed.endsWith("\n")) trimmed else "$trimmed\r\n"
else -> "[$trimmed]\r\n"
}
connectionManager.send(framed)
addLog("TX: ${framed.trim()}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants