diff --git a/weather/display.py b/weather/display.py index ef88cf7..5f98401 100644 --- a/weather/display.py +++ b/weather/display.py @@ -286,7 +286,11 @@ def get_weather_data(self): # Constants MARGIN = 5 -QR_SIZE = 52 # QR code size in pixels +qr_code_address = os.getenv("weather_mode_qr_code_address") +if qr_code_address: + QR_SIZE = 52 # QR code size in pixels +else: + QR_SIZE = 0 ICON_PADDING = 2 # Padding around icons def draw_weather_display(epd, weather_data, last_weather_data=None, set_base_image=False): @@ -581,7 +585,7 @@ def draw_weather_display(epd, weather_data, last_weather_data=None, set_base_ima forecast_text, font=font_medium, fill=BLACK) # Generate and draw QR code (larger size) or Raspberry Pi logo - qr_code_address = os.getenv("weather_mode_qr_code_address") + if qr_code_address: qr = qrcode.QRCode(version=1, box_size=2, border=1) qr.add_data(qr_code_address) @@ -594,25 +598,7 @@ def draw_weather_display(epd, weather_data, last_weather_data=None, set_base_ima qr_x = Himage.width - QR_SIZE - MARGIN qr_y = MARGIN Himage.paste(qr_img, (qr_x, qr_y)) - else: - # Load and display Raspberry Pi logo instead - try: - logo_path = Path(__file__).parent / "icons" / "Brand raspberrypi.png" - logo_img = Image.open(logo_path) - - # Calculate position to center the 46x46 logo in the QR code space - logo_x = Himage.width - QR_SIZE - MARGIN + (QR_SIZE - 46) // 2 - logo_y = MARGIN + (QR_SIZE - 46) // 2 - - # Convert logo to match display mode if needed - if epd.is_bw_display: - logo_img = logo_img.convert('1') - else: - logo_img = logo_img.convert('RGB') - - Himage.paste(logo_img, (logo_x, logo_y)) - except Exception as e: - logger.error(f"Error loading Raspberry Pi logo: {e}") + # Draw time under QR code current_time = datetime.now().strftime("%H:%M") diff --git a/weather/icons/Brand raspberrypi.png b/weather/icons/Brand raspberrypi.png deleted file mode 100644 index 85facdb..0000000 Binary files a/weather/icons/Brand raspberrypi.png and /dev/null differ