0

Broken Guide
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Broken Guide

by MattPackwood on Fri May 14, 2021 8:12 pm

Hi,

it looks like the latest libraries break the Covid Progress Tracker

https://learn.adafruit.com/adafruit-mag ... on-tracker

Matt

MattPackwood
 
Posts: 58
Joined: Wed Jul 23, 2014 9:13 pm

Re: Broken Guide

by dastels on Fri May 14, 2021 10:54 pm

What, exactly, are you seeing?

Dave

dastels
 
Posts: 6456
Joined: Tue Oct 20, 2015 3:22 pm

Re: Broken Guide

by MattPackwood on Sat May 15, 2021 9:50 am

IMG_2546.jpeg
IMG_2546.jpeg (28.44 KiB) Viewed 244 times


Sorry, I should have included this....

MattPackwood
 
Posts: 58
Joined: Wed Jul 23, 2014 9:13 pm

Re: Broken Guide

by dastels on Sat May 15, 2021 10:23 am

I'm not seeing a problem looking at the code in the guide. Can you post exactly the code.py that's on the MagTag in case something is different that the code in the guide.

Dave

dastels
 
Posts: 6456
Joined: Tue Oct 20, 2015 3:22 pm

Re: Broken Guide

by MattPackwood on Sat May 15, 2021 2:14 pm

Here you go...

Code: Select all | TOGGLE FULL SIZE
from adafruit_magtag.magtag import MagTag
from adafruit_progressbar.progressbar import ProgressBar

# Set up where we'll be fetching data from
DATA_SOURCE = "https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/country_data/United%20States.csv"
# Find data for other countries/states here:
# https://github.com/owid/covid-19-data/tree/master/public/data/vaccinations

magtag = MagTag(url=DATA_SOURCE)
magtag.network.connect()

magtag.add_text(
    text_font="/fonts/ncenR14.pcf",
    text_position=((magtag.graphics.display.width // 2) - 1, 8,),
    text_anchor_point=(0.5, 0.5),
    is_data=False,
)  # Title

magtag.add_text(
    text_font="/fonts/ncenR14.pcf",
    text_position=((magtag.graphics.display.width // 2) - 1, 23,),
    text_anchor_point=(0.5, 0.5),
    is_data=False,
)  # Date

magtag.add_text(
    text_font="/fonts/ncenR14.pcf",
    text_position=((magtag.graphics.display.width // 2) - 1, 40,),
    text_anchor_point=(0.5, 0.5),
    is_data=False,
)  # Vaccinated text

magtag.add_text(
    text_font="/fonts/ncenR14.pcf",
    text_position=((magtag.graphics.display.width // 2) - 1, 85,),
    text_anchor_point=(0.5, 0.5),
    is_data=False,
)  # Fully vaccinated text

BAR_WIDTH = magtag.graphics.display.width - 80
BAR_HEIGHT = 25
BAR_X = magtag.graphics.display.width // 2 - BAR_WIDTH // 2

progress_bar = ProgressBar(
    BAR_X, 50, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000
)

progress_bar_1 = ProgressBar(
    BAR_X, 95, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000
)

magtag.graphics.splash.append(progress_bar)
magtag.graphics.splash.append(progress_bar_1)
magtag.graphics.set_background("/bmps/background.bmp")


try:
    value = magtag.fetch().split("\n")[-2].split(",")
    print("Response is", value)

    vaccinated = int(value[-2]) / 331984513
    fully_vaccinated = int(value[-1]) / 331984513

    magtag.set_text(f"{value[0]} Vaccination Rates", 0, False)
    magtag.set_text(value[1], 1, False)
    magtag.set_text("Vaccinated: {:.2f}%".format(vaccinated * 100), 2, False)
    magtag.set_text(
        "Fully Vaccinated: {:.2f}%".format(fully_vaccinated * 100), 3, False
    )

    progress_bar.progress = vaccinated
    progress_bar_1.progress = fully_vaccinated

    magtag.refresh()

    seconds_to_sleep = 24 * 60 * 60  # Sleep for one day
    print(f"Sleeping for {seconds_to_sleep} seconds")
    magtag.exit_and_deep_sleep(seconds_to_sleep)

except (ValueError, RuntimeError) as e:
    print("Some error occured, retrying! -", e)

MattPackwood
 
Posts: 58
Joined: Wed Jul 23, 2014 9:13 pm

Re: Broken Guide

by MattPackwood on Sat May 15, 2021 2:17 pm

And I did a:

Code: Select all | TOGGLE FULL SIZE
Matt-Packwoods-iMac:~ $ circup update --all
Found device at /Volumes/CIRCUITPY, running CircuitPython 6.2.0.
Downloading latest version information.


  [####################################]  100%         
  [####################################]  100%         

OK

Found 2 module[s] needing update.
Updated neopixel
Updated adafruit_progressbar


And it is working again, so it is a library issue (I guess)

MattPackwood
 
Posts: 58
Joined: Wed Jul 23, 2014 9:13 pm

Re: Broken Guide

by dherrada on Tue Jun 01, 2021 10:49 am

Hi. I'm the author of the guide. Can you try again and see if it's still not working? It could have been fixed in one of the libraries. It also might just need you to copy the libraries over again. Weird stuff like that has happened to me a decent amount, especially on slightly less stable chips like the ESP32-S2

dherrada
 
Posts: 126
Joined: Thu Jan 04, 2018 4:59 pm

Please be positive and constructive with your questions and comments.