Dreh-Speed Dropdown im Admin, Kalibrierungsversuch rückgängig gemacht
- Auto-Rotate Speed wählbar: 20-50% in 5er-Schritten (Standard 20%) - BNO085 Magnetometer-Kalibrierung: calibration_status liefert immer 0, da der Sensor 3D-Bewegung benötigt die am Boden nicht möglich ist. Kalibrierungs-Feature vollständig entfernt. - Empfehlung: Nord-Offset nach jedem Neustart neu setzen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2319,10 +2319,12 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
self.write_json(status_code, response)
|
||||
return
|
||||
|
||||
|
||||
if self.path == '/api/imu/rotate-to':
|
||||
try:
|
||||
payload = json.loads(raw_body.decode('utf-8'))
|
||||
target_deg = float(payload.get('target_deg', 0))
|
||||
speed_pct = max(20, min(50, int(payload.get('speed_pct', 20))))
|
||||
except (UnicodeDecodeError, json.JSONDecodeError, TypeError, ValueError):
|
||||
self.write_json(400, {'status': 'Ungültige Anfrage'})
|
||||
return
|
||||
@@ -2333,10 +2335,12 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
return
|
||||
import imu_rotate
|
||||
heading_offset = read_imu_heading_calibration()['offset_deg']
|
||||
vel = max(1, int(100.0 * (speed_pct / 100.0) ** 2.0))
|
||||
status = imu_rotate.start_rotate(
|
||||
target_deg=target_deg,
|
||||
heading_offset=heading_offset,
|
||||
restore_mode=LAST_LOCOMOTION_MODE,
|
||||
vel=vel,
|
||||
)
|
||||
self.write_json(200, {'status': 'Drehung gestartet', 'rotate': status})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user