Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sd_check function to pyportal #34

Merged
merged 1 commit into from
Jan 22, 2020
Merged

Add sd_check function to pyportal #34

merged 1 commit into from
Jan 22, 2020

Conversation

colonwq
Copy link

@colonwq colonwq commented May 12, 2019

Both init and fetch access the in self._sdcard parameter to determine
if a SD card is installed. init handles the mounting of the card.
fetch() alters the filename path as needed prior to calling wget(). This
new function will allow the calling of pyportal.sd_check() to determine
if a card is present and alter operations as needed.
Simple example:
if pyportal.sdcheck():
print("SD card is installed")
else:
print("SD card is NOT installed")

Both __init__ and fetch access the in self._sdcard parameter to determine
if a SD card is installed. __init__ handles the mounting of the card.
fetch() alters the filename path as needed prior to calling wget(). This
new function will allow the calling of pyportal.sd_check() to determine
if a card is present and alter operations as needed.
Simple example:
if pyportal.sdcheck():
    print("SD card is installed")
else:
    print("SD card is NOT installed")
@kattni kattni requested a review from a team January 8, 2020 18:23
@FoamyGuy FoamyGuy mentioned this pull request Jan 22, 2020
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit for this change is on a branch created a while ago and it is behind the current adafruit/master.

In order to get the library working properly I had to merge the add_sdcheck branch into current master and then use the resulting adaruit_pyportal.py file. Before doing that there were import errors due to changed library names I think.

I tested this library change using this code:

from adafruit_pyportal import PyPortal
pyportal = PyPortal()
if pyportal.sd_check():
    print("SD card is installed")
else:
    print("SD card is NOT installed")

It does work as expected, correctly printing the SD state depending on whether the physical SD card is plugged in or not.

@kattni kattni merged commit 7cbb3e8 into adafruit:master Jan 22, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 28, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_BME680 to 3.1.3 from 3.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_BME680#18 from markpatterson27/upstream-issue-12

Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO055 to 4.1.0 from 4.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#30 from sjirwin/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 3.2.0 from 3.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#56 from makermelissa/set_digit_raw
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#55 from makermelissa/set_digit_raw
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#53 from hybotics/port_number_change_from_micropython

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3MDL to 1.0.1 from 1.0.0:
  > Update README.rst

Updating https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI to 0.3.3 from 0.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_NeoPixel_SPI#10 from caternuson/pypix

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.1.7 from 3.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#34 from colonwq/add_sdcheck

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 5.0.3 from 5.0.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#65 from dhalbert/update-dis

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center to 0.8.2 from 0.8.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center#4 from tannewt/remove_ble_mock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants