From 2dace1229312fb2fce3c5ec28a2e89428688d706 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Fri, 14 Jun 2019 17:06:19 +0300 Subject: [PATCH] Add led_pin option, add logger --- Drone/FlightLib/LedLib.py | 8 ++++++-- Drone/client_config.ini | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Drone/FlightLib/LedLib.py b/Drone/FlightLib/LedLib.py index 00234d6..21e6cbc 100644 --- a/Drone/FlightLib/LedLib.py +++ b/Drone/FlightLib/LedLib.py @@ -3,6 +3,8 @@ import threading import time from rpi_ws281x import * from tasking_lib import wait as wait_until +import logging +logger = logging.getLogger(__name__) # LED strip configuration: LED_COUNT = 60 # Number of LED pixels. LED_PIN = 21 # GPIO pin connected to the pixels (18 uses PWM!) (10 uses SPI /dev/spidev0.0). @@ -203,7 +205,7 @@ def strip_off(): def led_thread(): global mode - print("Starting LedLib thread") + logger.info("Starting LedLib thread") iteration = 0 while True: if mode == "rainbow": @@ -240,7 +242,9 @@ def led_thread(): # init -def init_led(): +def init_led(led_pin = LED_PIN): + global strip + strip = Adafruit_NeoPixel(LED_COUNT, led_pin, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) strip.begin() t_l = threading.Thread(target=led_thread) t_l.daemon = True diff --git a/Drone/client_config.ini b/Drone/client_config.ini index ecd816a..e8ae1df 100644 --- a/Drone/client_config.ini +++ b/Drone/client_config.ini @@ -15,7 +15,7 @@ port = 123 [COPTERS] frame_id = aruco_map -takeoff_height = 1.5 +takeoff_height = 2.5 takeoff_time = 8.0 safe_takeoff = False reach_first_point_time = 8.0 @@ -26,6 +26,7 @@ y0_common = 0 [PRIVATE] id = /hostname use_leds = True +led_pin = 18 x0 = 0 y0 = 0