ScottSturdivant / rpi_metar

METAR LED Display for a Raspberry Pi
MIT License
26 stars 17 forks source link

Legend - Wind or Lighting not working if set as 0 #23

Closed thommo17 closed 3 years ago

thommo17 commented 3 years ago

Hi Scott,

I just made a new map and had the legend as the first LEDs in the string and found that if Lightning or Wind is set to 0 they won't work.

VFR, MVFR, IFR, LIFR will work as zero and so will everything else but if I set those 2 as 0 they won't flash. If I set them as 1 or any other number they will though.

Here's the journalctl of it

May 04 22:08:30 raspberrypi systemd[1]: rpi_metar_au.service: Succeeded.
May 04 22:08:30 raspberrypi systemd[1]: Stopped METAR Display.
May 04 22:08:30 raspberrypi systemd[1]: Started METAR Display.
May 04 22:08:30 raspberrypi sudo[1879]: pam_unix(sudo:session): session closed for user root
May 04 22:08:36 raspberrypi crontab[1908]: (root) LIST (root)
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,734 - rpi_metar.core - INFO - 0.4 - MainThread - Legend: set 5 to VFR.
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,743 - rpi_metar.core - INFO - 0.4 - MainThread - Legend: set 3 to IFR.
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,747 - rpi_metar.core - INFO - 0.4 - MainThread - Legend: set 4 to MVFR.
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,751 - rpi_metar.core - INFO - 0.4 - MainThread - Legend: set 2 to LIFR.
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,787 - rpi_metar.core - INFO - 0.4 - render_leds - waiting for queue.
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,809 - rpi_metar.core - DEBUG - 0.4 - lightning - LIGHTNING @: [<LEGEND @ 1: LIGHTNING>]
May 04 22:08:36 raspberrypi rpi_metar[1898]: 2021-05-04 22:08:36,826 - rpi_metar.core - DEBUG - 0.4 - wind - WINDY @: []

What do you think it could be?

ScottSturdivant commented 3 years ago

Whoops! It's almost certainly this line here: https://github.com/ScottSturdivant/rpi_metar/blob/develop/rpi_metar/core.py#L190 as it doesn't check to make sure that legend is not None.

I'll get that squared up a bit later today, along with merging in #22!

thommo17 commented 3 years ago

Awesome work!

You're a LEGEND hahaha