Parcourir la source

Revert LED controller and service file to working state (d2037ee)

Fully revert dw_led_controller.py and dune-weaver.service to match
commit d2037ee where LEDs were working. The .show() test and service
capability changes were causing issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris il y a 4 mois
Parent
commit
33a60903b1
2 fichiers modifiés avec 2 ajouts et 18 suppressions
  1. 1 2
      dune-weaver.service
  2. 1 16
      modules/led/dw_led_controller.py

+ 1 - 2
dune-weaver.service

@@ -11,8 +11,7 @@ Restart=always
 RestartSec=5
 Environment=PYTHONUNBUFFERED=1
 CPUAffinity=0 1 2
-SupplementaryGroups=dialout gpio kmem
-AmbientCapabilities=CAP_SYS_RAWIO
+SupplementaryGroups=dialout gpio
 
 [Install]
 WantedBy=multi-user.target

+ 1 - 16
modules/led/dw_led_controller.py

@@ -107,7 +107,7 @@ class DWLEDController:
             board_pin = pin_map[self.gpio_pin]
 
             # Initialize NeoPixel strip
-            pixels = neopixel_module.NeoPixel(
+            self._pixels = neopixel_module.NeoPixel(
                 board_pin,
                 self.num_leds,
                 brightness=self.brightness,
@@ -115,21 +115,6 @@ class DWLEDController:
                 pixel_order=self.pixel_order
             )
 
-            # Test that .show() actually works — the constructor succeeds without
-            # root, but .show() needs DMA via /dev/mem. If it fails here we get a
-            # clean Python exception; if we let the effect loop hit it first the
-            # underlying C library can SEGV and crash the whole process.
-            try:
-                pixels.show()
-            except Exception as e:
-                pixels.deinit()
-                error_msg = f"NeoPixel hardware test failed (likely needs root): {e}"
-                self._init_error = error_msg
-                logger.warning(error_msg)
-                return False
-
-            self._pixels = pixels
-
             # Create segment for the entire strip
             self._segment = Segment(self._pixels, 0, self.num_leds)
             self._segment.speed = self._speed