Selaa lähdekoodia

change branding

tuanchris 3 kuukautta sitten
vanhempi
sitoutus
6ce527612a
4 muutettua tiedostoa jossa 51 lisäystä ja 51 poistoa
  1. 6 6
      main.py
  2. 15 15
      modules/connection/connection_manager.py
  3. 11 11
      static/js/settings.js
  4. 19 19
      templates/settings.html

+ 6 - 6
main.py

@@ -382,7 +382,7 @@ async def set_scheduled_pause(request: ScheduledPauseRequest):
 
 @app.get("/api/angular-homing")
 async def get_angular_homing():
-    """Get current angular homing settings."""
+    """Get current Desert Compass settings."""
     return {
         "angular_homing_enabled": state.angular_homing_enabled,
         "angular_homing_gpio_pin": state.angular_homing_gpio_pin,
@@ -398,7 +398,7 @@ class AngularHomingRequest(BaseModel):
 
 @app.post("/api/angular-homing")
 async def set_angular_homing(request: AngularHomingRequest):
-    """Update angular homing settings."""
+    """Update Desert Compass settings."""
     try:
         # Validate GPIO pin
         if request.angular_homing_gpio_pin < 2 or request.angular_homing_gpio_pin > 27:
@@ -410,13 +410,13 @@ async def set_angular_homing(request: AngularHomingRequest):
         state.angular_homing_offset_degrees = request.angular_homing_offset_degrees
         state.save()
 
-        logger.info(f"Angular homing {'enabled' if request.angular_homing_enabled else 'disabled'}, GPIO pin: {request.angular_homing_gpio_pin}, invert: {request.angular_homing_invert_state}, offset: {request.angular_homing_offset_degrees}°")
-        return {"success": True, "message": "Angular homing settings updated"}
+        logger.info(f"Desert Compass {'enabled' if request.angular_homing_enabled else 'disabled'}, GPIO pin: {request.angular_homing_gpio_pin}, invert: {request.angular_homing_invert_state}, offset: {request.angular_homing_offset_degrees}°")
+        return {"success": True, "message": "Desert Compass settings updated"}
     except HTTPException:
         raise
     except Exception as e:
-        logger.error(f"Error updating angular homing settings: {str(e)}")
-        raise HTTPException(status_code=500, detail=f"Failed to update angular homing settings: {str(e)}")
+        logger.error(f"Error updating Desert Compass settings: {str(e)}")
+        raise HTTPException(status_code=500, detail=f"Failed to update Desert Compass settings: {str(e)}")
 
 @app.get("/list_serial_ports")
 async def list_ports():

+ 15 - 15
modules/connection/connection_manager.py

@@ -459,38 +459,38 @@ def home(timeout=90):
             else:
                 state.current_theta = state.current_rho = 0
 
-            # Perform angular homing if enabled (Raspberry Pi only)
+            # Perform Desert Compass calibration if enabled (Raspberry Pi only)
             if state.angular_homing_enabled:
-                logger.info("Starting angular homing sequence")
+                logger.info("Starting Desert Compass calibration sequence")
                 try:
                     # Initialize reed switch monitor with configured GPIO pin and invert state
                     gpio_pin = state.angular_homing_gpio_pin
                     invert_state = state.angular_homing_invert_state
-                    logger.info(f"Using GPIO pin {gpio_pin} for reed switch (invert_state={invert_state})")
+                    logger.info(f"Desert Compass: Using GPIO pin {gpio_pin} for reed switch (invert_state={invert_state})")
                     reed_switch = ReedSwitchMonitor(gpio_pin=gpio_pin, invert_state=invert_state)
 
                     try:
                         # Reset theta first
-                        logger.info("Resetting theta before angular homing")
+                        logger.info("Desert Compass: Resetting theta before calibration")
                         asyncio.run(pattern_manager.reset_theta())
 
                         # Move radial arm to perimeter (theta=0, rho=1.0)
-                        logger.info("Moving radial arm to perimeter (theta=0, rho=1.0)")
+                        logger.info("Desert Compass: Moving radial arm to perimeter (theta=0, rho=1.0)")
                         asyncio.run(pattern_manager.move_polar(0, 1.0, homing_speed))
-                        
+
                         idle_reached = check_idle()
 
                         if not idle_reached:
-                            logger.error("Device did not reach idle state after moving to perimeter")
+                            logger.error("Desert Compass: Device did not reach idle state after moving to perimeter")
                             homing_complete.set()
                             return
 
                         # Wait 1 second for stabilization
-                        logger.info("Waiting for stabilization...")
+                        logger.info("Desert Compass: Waiting for stabilization...")
                         time.sleep(1)
 
                         # Perform angular rotation until reed switch is triggered
-                        logger.info("Rotating around perimeter to find home position")
+                        logger.info("Desert Compass: Rotating around perimeter to find reference point")
                         increment = 0.1  # Small angular increment in radians
                         current_theta = 0
                         max_theta = 6.28  # One full rotation (2*pi)
@@ -506,29 +506,29 @@ def home(timeout=90):
 
                             # Check reed switch AFTER movement completes
                             if reed_switch.is_triggered():
-                                logger.info(f"Reed switch triggered at theta={current_theta}")
+                                logger.info(f"Desert Compass: Reed switch triggered at theta={current_theta}")
                                 reed_switch_triggered = True
                                 break
 
                         if not reed_switch_triggered:
-                            logger.warning("Completed full rotation without reed switch trigger")
+                            logger.warning("Desert Compass: Completed full rotation without reed switch trigger")
 
                         # Set theta to the offset value (accounting for sensor placement)
-                        # If offset is 0, this is the true home position
+                        # If offset is 0, this is the true reference position
                         # If offset is non-zero, the sensor is physically placed at that angle
                         # Convert degrees to radians for internal use
                         import math
                         offset_radians = math.radians(state.angular_homing_offset_degrees)
                         state.current_theta = offset_radians
                         state.current_rho = 1
-                        logger.info(f"Angular homing completed - theta set to {state.angular_homing_offset_degrees}° ({offset_radians:.3f} radians)")
+                        logger.info(f"Desert Compass: Calibration completed - theta set to {state.angular_homing_offset_degrees}° ({offset_radians:.3f} radians)")
 
                     finally:
                         reed_switch.cleanup()
 
                 except Exception as e:
-                    logger.error(f"Error during angular homing: {e}")
-                    # Continue with normal homing completion even if angular homing fails
+                    logger.error(f"Error during Desert Compass calibration: {e}")
+                    # Continue with normal homing completion even if Desert Compass calibration fails
 
             homing_success = True
             logger.info("Homing completed and device is idle")

+ 11 - 11
static/js/settings.js

@@ -1367,9 +1367,9 @@ async function initializeStillSandsMode() {
     }
 }
 
-// Angular Homing Configuration Functions
+// Desert Compass Configuration Functions
 async function initializeAngularHomingConfig() {
-    logMessage('Initializing Angular Homing configuration', LOG_TYPE.INFO);
+    logMessage('Initializing Desert Compass configuration', LOG_TYPE.INFO);
 
     const angularHomingToggle = document.getElementById('angularHomingToggle');
     const angularHomingInfo = document.getElementById('angularHomingInfo');
@@ -1385,13 +1385,13 @@ async function initializeAngularHomingConfig() {
     if (!angularHomingToggle || !angularHomingInfo || !saveHomingConfigButton ||
         !gpioSelectionContainer || !gpioInput || !invertStateContainer ||
         !invertStateToggle || !angularOffsetContainer || !angularOffsetInput) {
-        logMessage('Angular Homing elements not found, skipping initialization', LOG_TYPE.WARNING);
+        logMessage('Desert Compass elements not found, skipping initialization', LOG_TYPE.WARNING);
         return;
     }
 
-    logMessage('All Angular Homing elements found successfully', LOG_TYPE.INFO);
+    logMessage('All Desert Compass elements found successfully', LOG_TYPE.INFO);
 
-    // Load current angular homing settings
+    // Load current Desert Compass settings
     try {
         const response = await fetch('/api/angular-homing');
         const data = await response.json();
@@ -1408,7 +1408,7 @@ async function initializeAngularHomingConfig() {
             angularOffsetContainer.style.display = 'block';
         }
     } catch (error) {
-        logMessage(`Error loading angular homing settings: ${error.message}`, LOG_TYPE.ERROR);
+        logMessage(`Error loading Desert Compass settings: ${error.message}`, LOG_TYPE.ERROR);
         // Initialize with defaults if load fails
         angularHomingToggle.checked = false;
         gpioInput.value = 18;
@@ -1420,7 +1420,7 @@ async function initializeAngularHomingConfig() {
         angularOffsetContainer.style.display = 'none';
     }
 
-    // Function to save settings
+    // Function to save Desert Compass settings
     async function saveAngularHomingSettings() {
         // Validate GPIO pin
         const gpioPin = parseInt(gpioInput.value);
@@ -1448,12 +1448,12 @@ async function initializeAngularHomingConfig() {
 
             if (!response.ok) {
                 const errorData = await response.json();
-                throw new Error(errorData.detail || 'Failed to save angular homing settings');
+                throw new Error(errorData.detail || 'Failed to save Desert Compass settings');
             }
 
             // Show success state temporarily
             saveHomingConfigButton.innerHTML = '<span class="material-icons text-lg">check</span><span class="truncate">Saved!</span>';
-            showStatusMessage('Angular homing configuration saved successfully', 'success');
+            showStatusMessage('Desert Compass configuration saved successfully', 'success');
 
             // Restore button after 2 seconds
             setTimeout(() => {
@@ -1461,7 +1461,7 @@ async function initializeAngularHomingConfig() {
                 saveHomingConfigButton.disabled = false;
             }, 2000);
         } catch (error) {
-            logMessage(`Error saving angular homing settings: ${error.message}`, LOG_TYPE.ERROR);
+            logMessage(`Error saving Desert Compass settings: ${error.message}`, LOG_TYPE.ERROR);
             showStatusMessage(`Failed to save settings: ${error.message}`, 'error');
 
             // Restore button immediately on error
@@ -1472,7 +1472,7 @@ async function initializeAngularHomingConfig() {
 
     // Event listeners
     angularHomingToggle.addEventListener('change', () => {
-        logMessage(`Angular homing toggle changed: ${angularHomingToggle.checked}`, LOG_TYPE.INFO);
+        logMessage(`Desert Compass toggle changed: ${angularHomingToggle.checked}`, LOG_TYPE.INFO);
         const isEnabled = angularHomingToggle.checked;
         angularHomingInfo.style.display = isEnabled ? 'block' : 'none';
         gpioSelectionContainer.style.display = isEnabled ? 'block' : 'none';

+ 19 - 19
templates/settings.html

@@ -312,17 +312,17 @@ input:checked + .slider:before {
     <h2
       class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
     >
-      Homing Configuration
+      Desert Compass
     </h2>
     <div class="px-6 py-5 space-y-6">
       <div class="flex items-center justify-between">
         <div class="flex-1">
           <h3 class="text-slate-700 text-base font-medium leading-normal flex items-center gap-2">
             <span class="material-icons text-slate-600">explore</span>
-            Angular Homing (Raspberry Pi Only)
+            Enable Desert Compass (Raspberry Pi Only)
           </h3>
           <p class="text-xs text-slate-500 mt-1">
-            Enable angular homing using a reed switch connected to a GPIO pin to establish a home position for rotation.
+            Use a reed switch and magnet to establish a precise angular reference point for the table's rotation.
           </p>
         </div>
         <label class="switch">
@@ -331,11 +331,11 @@ input:checked + .slider:before {
         </label>
       </div>
 
-      <!-- GPIO Pin Selection (shown when angular homing is enabled) -->
+      <!-- GPIO Pin Selection (shown when Desert Compass is enabled) -->
       <div id="gpioSelectionContainer" class="space-y-2" style="display: none;">
         <label for="gpioInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
           <span class="material-icons text-slate-600 text-base">settings_input_component</span>
-          GPIO Pin Number
+          Reed Switch GPIO Pin
         </label>
         <input
           type="number"
@@ -352,13 +352,13 @@ input:checked + .slider:before {
         </p>
       </div>
 
-      <!-- Invert State Toggle (shown when angular homing is enabled) -->
+      <!-- Invert State Toggle (shown when Desert Compass is enabled) -->
       <div id="invertStateContainer" class="space-y-2" style="display: none;">
         <div class="flex items-center justify-between p-3 bg-slate-50 rounded-lg">
           <div class="flex-1">
             <label for="invertStateToggle" class="text-sm font-medium text-slate-700 flex items-center gap-2 cursor-pointer">
               <span class="material-icons text-slate-600 text-base">swap_vert</span>
-              Invert Reed Switch State
+              Invert Sensor Logic
             </label>
             <p class="text-xs text-slate-500 mt-1">
               Enable if your reed switch is triggered when LOW instead of HIGH (normally closed configuration).
@@ -371,11 +371,11 @@ input:checked + .slider:before {
         </div>
       </div>
 
-      <!-- Angular Offset Input (shown when angular homing is enabled) -->
+      <!-- Compass Calibration (shown when Desert Compass is enabled) -->
       <div id="angularOffsetContainer" class="space-y-2" style="display: none;">
         <label for="angularOffsetInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
           <span class="material-icons text-slate-600 text-base">straighten</span>
-          Sensor Offset (degrees)
+          Compass Reference Point (degrees)
         </label>
         <input
           type="number"
@@ -388,7 +388,7 @@ input:checked + .slider:before {
           placeholder="0.0"
         />
         <p class="text-xs text-slate-500">
-          Set the angle (in degrees) where your reed switch is physically mounted. 0° = East, increases clockwise (90° = South, 180° = West, 270° = North).
+          Set the angle (in degrees) where your magnet/sensor is physically mounted. 0° = East, increases clockwise (90° = South, 180° = West, 270° = North).
         </p>
       </div>
 
@@ -396,15 +396,15 @@ input:checked + .slider:before {
         <div class="flex items-start gap-2">
           <span class="material-icons text-blue-600 text-base">info</span>
           <div>
-            <p class="font-medium text-blue-800">Angular Homing Details:</p>
+            <p class="font-medium text-blue-800">How Desert Compass Works:</p>
             <ul class="mt-1 space-y-1 text-blue-700">
-              <li>• After radial homing, the arm moves to the perimeter (y20)</li>
-              <li>• The table rotates around the perimeter until the reed switch is triggered</li>
-              <li>• This position is set as the angular home based on your sensor offset</li>
-              <li>• Only works on Raspberry Pi with a reed switch connected to your selected GPIO pin</li>
-              <li>• Standard wiring: Reed switch connects GPIO pin to 3.3V (triggered = HIGH)</li>
-              <li>• Inverted wiring: Reed switch connects GPIO pin to ground (triggered = LOW)</li>
-              <li>• Use BCM GPIO numbering (not physical pin numbers)</li>
+              <li>• After radial calibration, the arm moves to the table's edge</li>
+              <li>• The table rotates until the magnet triggers the reed switch</li>
+              <li>• This position becomes the angular reference point based on your compass setting</li>
+              <li>• Requires Raspberry Pi with reed switch connected to selected GPIO pin</li>
+              <li>• Standard wiring: Reed switch to 3.3V (triggered = HIGH)</li>
+              <li>• Inverted wiring: Reed switch to ground (triggered = LOW)</li>
+              <li>• Uses BCM GPIO numbering (not physical pin numbers)</li>
             </ul>
           </div>
         </div>
@@ -416,7 +416,7 @@ input:checked + .slider:before {
           class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
         >
           <span class="material-icons text-lg">save</span>
-          <span class="truncate">Save Homing Config</span>
+          <span class="truncate">Save Compass Config</span>
         </button>
       </div>
     </div>