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:
+18
-1
@@ -189,6 +189,21 @@
|
||||
<span style="font-size:11px;color:#888;">° (0=N, 90=O, 180=S, 270=W)</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="sr">
|
||||
<span class="sr-led led-off"></span>
|
||||
<span class="sr-key">Dreh-Speed</span>
|
||||
<span class="sr-val">
|
||||
<select id="rotate_speed" class="ctrl-select" style="font-size:11px;padding:2px 4px;">
|
||||
<option value="20" selected>20 % (Standard)</option>
|
||||
<option value="25">25 %</option>
|
||||
<option value="30">30 %</option>
|
||||
<option value="35">35 %</option>
|
||||
<option value="40">40 %</option>
|
||||
<option value="45">45 %</option>
|
||||
<option value="50">50 %</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="act-grid">
|
||||
<button class="act-btn subtle full" id="rotate_start_btn" onclick="startRotate()">Zu Heading drehen</button>
|
||||
<button class="act-btn subtle full" id="rotate_stop_btn" onclick="stopRotate()" style="display:none;">Drehung abbrechen</button>
|
||||
@@ -2946,14 +2961,16 @@
|
||||
|
||||
async function startRotate() {
|
||||
var input = document.getElementById('rotate_target');
|
||||
var speedEl = document.getElementById('rotate_speed');
|
||||
var target = parseFloat(input ? input.value : 0);
|
||||
var speedPct = speedEl ? parseInt(speedEl.value) : 20;
|
||||
if (isNaN(target)) { alert('Ungültiger Winkel'); return; }
|
||||
setAdminStatus('Starte Drehung zu ' + target + '°…');
|
||||
try {
|
||||
var response = await fetch(adminApiBase + '/api/imu/rotate-to', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({target_deg: target})
|
||||
body: JSON.stringify({target_deg: target, speed_pct: speedPct})
|
||||
});
|
||||
var data = await response.json();
|
||||
if (!response.ok) throw new Error(data.status || ('status ' + response.status));
|
||||
|
||||
@@ -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