图标升级

This commit is contained in:
2026-05-16 00:44:37 +08:00
parent 837996c436
commit d80e8dd05d
2113 changed files with 14850 additions and 244328 deletions

View File

@@ -9,7 +9,7 @@ from utils.floating_keyboard import FloatingKeyboard
MOVE_STEP = 10 # 每次点击移动 mm (保留备用)
MOVE_DETECT_MS = 100
MOVE_DETECT_MS = 300
class JoystickWidget(QWidget):
@@ -32,7 +32,7 @@ class JoystickWidget(QWidget):
# 定时发送 GCode
self._move_timer = QTimer(self)
self._move_timer.setInterval(120) # ~8次/秒
self._move_timer.setInterval(MOVE_DETECT_MS)
self._move_timer.timeout.connect(self._emit_move)
# 回调(上层设置)
@@ -45,7 +45,9 @@ class JoystickWidget(QWidget):
return
ratio = min(dist / (self._radius_outer - self._radius_inner), 1.0)
# 速度映射30% ~ 100% * max_speed
speed = int((0.3 + ratio * 0.7) * self._max_speed)
# speed = int((0.3 + ratio * 0.7) * self._max_speed)
# ratio = min(dist / max_dist, 1.0)
speed = ratio * self._max_speed / (1000/MOVE_DETECT_MS)
if dist > 0:
nx = self._dx / dist
ny = self._dy / dist
@@ -350,12 +352,13 @@ class ControlPage(QWidget):
def _on_joystick_move(self, nx, ny, speed):
if not self._is_control_enabled():
return
step = 5.0
step = speed * MOVE_DETECT_MS / 1000
dx = nx * step
dy = ny * step
tx = max(self.x_min, min(self.x_max, self.pos_x + dx))
ty = max(self.y_min, min(self.y_max, self.pos_y + dy))
gcode = f"G1 X{tx:.1f} Y{ty:.1f} F{speed}"
print(f"Moving: X{tx:.1f} Y{ty:.1f} F{speed}")
self.api_client.send_gcode(gcode)
self.pos_x, self.pos_y = tx, ty
self._sync_inputs()
@@ -363,11 +366,11 @@ class ControlPage(QWidget):
def _on_fader_move(self, direction, speed):
if not self._is_control_enabled():
return
print(f"d:{direction} s:{speed}")
step = speed * MOVE_DETECT_MS / 1000
tz = self.pos_z + direction * step
tz = max(self.z_min, min(self.z_max, tz))
gcode = f"G1 Z{tz:.3f} F{speed}"
print(f"Moving: Z{tz:.3f} F{speed}")
self.api_client.send_gcode(gcode)
self.pos_z = tz
self._sync_inputs()