Skip to content

DHCP timeout and hostname fix, make both user settable #20

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

Merged
merged 3 commits into from
Jun 8, 2020
Merged

DHCP timeout and hostname fix, make both user settable #20

merged 3 commits into from
Jun 8, 2020

Conversation

xorbit
Copy link
Contributor

@xorbit xorbit commented Jun 4, 2020

  • DHCP timeouts were a bit of a mess, the code was cleaned up.
  • The default was made 3 seconds vs 1 second which was too short
    for some DHCP servers.
  • The DHCP timeout is now settable with a new dhcp_timeout
    parameter for the WIZNET5K class.
  • DHCP hostname was set wrong, by trying to add the binary version
    of the MAC, it became corrupt and was rejected by the DHCP server.
    Default is now fixed, "WIZnetXXXXXXXXXXXX" where X'es are MAC.
  • DHCP hostname is now settable on WIZNET5K class using 'hostname'
    keyword argument. If the string contains '{}', the MAC will be
    inserted in this position.

xorbit added 2 commits June 4, 2020 14:08
- DHCP timeouts were a bit of a mess, the code was cleaned up.
- The default was made 3 seconds vs 1 second which was too short
for some DHCP servers.
- The DHCP timeout is now settable with a new dhcp_timeout
parameter for the WIZNET5K class.
- DHCP hostname was set wrong, by trying to add the binary version
of the MAC, it became corrupt and was rejected by the DHCP server.
Default is now fixed, "WIZnetXXXXXXXXXXXX" where X'es are MAC.
- DHCP hostname is now settable on WIZNET5K class using 'hostname'
keyword argument.  If the string contains '{}', the MAC will be
inserted in this position.
@xorbit xorbit changed the title Clean up DHCP timeout, make it settable and longer by default DHCP timeout and hostname fix, make both user settable Jun 4, 2020
This was referenced Jun 4, 2020
@brentru brentru self-requested a review June 5, 2020 13:24
@brentru brentru added bug Something isn't working enhancement New feature or request labels Jun 5, 2020
@brentru
Copy link
Member

brentru commented Jun 5, 2020

@xorbit Ok, this looks great and works well. Thank you for the PR!


Tests OK with simpletest on Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Feather Bluefruit Sense with nRF52840

Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 
IP lookup adafruit.com: 104.20.38.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------

Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'Jun 5, 2020 15:32:00 UTC', 'updatedISO': '2020-06-05T15:32:00+00:00', 'updateduk': 'Jun 5, 2020 at 16:32 BST'}, 'disclaimer': 'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 9666.01, 'rate': '9,666.0112'}}}
----------------------------------------
Done!

I also tested setting a custom hostname:
eth = WIZNET5K(spi_bus, cs, hostname="blinka")

The custom hostname displays in my router's DHCP server client listing:
Archer_A6

@brentru brentru self-requested a review June 5, 2020 15:38
Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

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

This is failing on the CI's formatting check, please check out this page for instructions for using Black formatting: https://learn.adafruit.com/improve-your-code-with-pylint/black?

@brentru brentru merged commit 236a3e9 into adafruit:master Jun 8, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 9, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_AHTx0 to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_AHTx0#1 from kattni/example-i2c-update

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.4.1 from 3.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#99 from Flameeyes/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_ILI9341 to 1.2.1 from 1.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ILI9341#22 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_ILI9341#21 from adafruit/setup-py-disabled
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_LPS2X to 2.0.0 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_LPS2X#4 from adafruit/lps22
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.4.0 from 1.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#20 from xorbit/master
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#14 from adafruit/pylint-update

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 2.2.1 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#16 from jimbobbennett/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.7.0 from 2.6.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#49 from kmatch98/background
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#48 from FoamyGuy/better_group_full_error

Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.3.0 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#39 from rhooper/bugfixes
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#38 from rhooper/sequence-one-shot
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#40 from rhooper/pixelgrid

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 3.1.0 from 3.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#38 from brentru/on-message-enhancements

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_ILI9341
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants