Commit 9e63ea30 authored by vertighel's avatar vertighel
Browse files

Fix CoordinatesRadec Slew: send string payload, add tab-aware altaz



- actions.js: skip parseFloat for non-numeric inputs (type != number/range)
  so RaDec text value is sent as string instead of a truncated float
- control.js: listen to shown.bs.tab on pointing-tabs to switch Slew
  button data-url and data-inputs between radec and altaz endpoints

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 072a935e
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
                "buttons": [{"label": "Set", "endpoint": "/telescope/focuser", "method": "PUT"}],
            "info_list": [
            {"label": "moving", "status": "telescope-focuser-movement"},
            {"label": "pos", "status": "telescope-focuser-position"},
            {"label": "pos", "status": "telescope-focuser-position", "transform": "round_1"},


            ]
+3 −3
Original line number Diff line number Diff line
@@ -22,9 +22,9 @@
            <!-- RaDec Tab -->
            <div class="tab-pane fade show active" id="tab-radec">
                <div class="input-group input-group-sm mb-2">
                    <span class="input-group-text bg-dark border-secondary text-muted" style="width: 60px;"> α,δ / ID </span>
                    <input type="text" class="form-control bg-black text-info border-secondary"
                           id="in-radec" placeholder="Object or HH MM SS ±DD MM SS"
                    <label class="col-form-label bg-dark border-secondary text-muted" style="width: 60px;"> α,δ / ID </label>
                    <input type="text" class="form-control bg-black border-secondary"
                           id="in-radec" placeholder="'Object name' or 'HH MM SS ±DD MM SS'"
                           autocomplete="off">
                    <span class="input-group-text bg-dark border-secondary text-muted">hms ±dms / id</span>
                </div>
+1 −1
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ document.addEventListener('DOMContentLoaded', () => {
                const values = inputIds.map(id => {
                    const input = document.getElementById(id.trim());
                    if (!input) return null;
                    if (input.type !== 'number' && input.type !== 'range') return input.value;
                    const parsedNum = parseFloat(input.value);
                    // Safely check if value is a valid float, otherwise fallback to raw string
                    return isNaN(parsedNum) ? input.value : parsedNum;
                });
                payload = values.length === 1 ? values[0] : values;
+12 −0
Original line number Diff line number Diff line
@@ -170,6 +170,18 @@ document.addEventListener('DOMContentLoaded', () => {
    // Reset border when the user starts typing again
    inputRadec?.addEventListener('input', () => setInputState(inputRadec, 'reset'));

    // -----------------------------------------------------------------------
    // Tab-aware Slew button: switch URL and inputs when pointing tab changes
    // -----------------------------------------------------------------------
    const btnSlew = document.getElementById('btn-mount-slew');
    document.getElementById('pointing-tabs')?.addEventListener('shown.bs.tab', (e) => {
        if (!btnSlew) return;
        const isAltAz = e.target.dataset.bsTarget === '#tab-altaz';
        btnSlew.dataset.url    = isAltAz ? '/telescope/coordinates/movement/altaz'
                                         : '/telescope/coordinates/movement/radec';
        btnSlew.dataset.inputs = isAltAz ? 'in-alt,in-az' : 'in-radec';
    });

    // -----------------------------------------------------------------------
    // Stage relative movement
    // -----------------------------------------------------------------------