Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Failed to get data, retrying... Failed to send 2 bytes (sen
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Failed to get data, retrying... Failed to send 2 bytes (sen

by slowjim on Mon Feb 24, 2020 4:48 am

Hi

I have been running the Pyportal_pet_plant code. It is fantastic! But after a few minutes when I review the REPL, I note I am getting the following error message every second or so

Failed to get data, retrying...
Failed to send 2 bytes (sent 0)

When I interrupt with Ctrl C I get the following error message:

Traceback (most recent call last):
File "code.py", line 301, in <module>
File "code.py", line 300, in <module>
File "adafruit_esp32spi/adafruit_esp32spi_wifimanager.py", line 92, in reset
File "adafruit_esp32spi/adafruit_esp32spi.py", line 185, in reset
KeyboardInterrupt:

I get the feeling that the internet drops out and can't reconnect, but I'm pretty new so...you know...

I have posted the code below. I have made some changes to add a second bar graph, however I was getting the same message when I was using the original code from the learn guide.

If anyone can help I would greatly appreciate it.

Cheers

SlowJim


Code: Select all | TOGGLE FULL SIZE
import time

import board
import busio
from digitalio import DigitalInOut
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
import adafruit_imageload
import displayio
import neopixel
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
from adafruit_io.adafruit_io import IO_MQTT
from adafruit_minimqtt import MQTT
from adafruit_pyportal import PyPortal
from adafruit_seesaw.seesaw import Seesaw
from simpleio import map_range

#---| User Config |---------------

# How often to poll the soil sensor, in seconds
DELAY_SENSOR = 30

# How often to send data to adafruit.io, in minutes
DELAY_PUBLISH = 5

# Maximum soil moisture measurement
SOIL_LEVEL_MAX = 2000

# Minimum soil moisture measurement
SOIL_LEVEL_MIN= 350.0

TEMP_LEVEL_MAX = 333.0

TEMP_LEVEL_MIN = 0.0

#---| End User Config |---------------

# Background image
BACKGROUND = "/images/roots.bmp"
# Icons for water level and temperature
ICON_LEVEL = "/images/icon-wetness.bmp"
ICON_TEMP = "/images/icon-temp.bmp"
WATER_COLOR = 0xFF0000

# Audio files
wav_water_high = "/sounds/water-high.wav"
wav_water_low = "/sounds/water-low.wav"

# the current working directory (where this file is)
cwd = ("/"+__file__).rsplit('/', 1)[0]

# Get wifi details and more from a secrets.py file
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

# Set up i2c bus
i2c_bus = busio.I2C(board.SCL, board.SDA)

# Initialize soil sensor (s.s)
ss = Seesaw(i2c_bus, addr=0x36)

# PyPortal ESP32 AirLift Pins
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)

spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)

# Initialize PyPortal Display
display = board.DISPLAY

WIDTH = board.DISPLAY.width
HEIGHT = board.DISPLAY.height

# Initialize new PyPortal object
pyportal = PyPortal(esp=esp,
                    external_spi=spi)

# Set backlight level
pyportal.set_backlight(0.5)

# Create a new DisplayIO group
splash = displayio.Group(max_size=15)

# show splash group
display.show(splash)

# Palette for water bitmap
palette = displayio.Palette(2)
palette[0] = 0x000000
palette[1] = WATER_COLOR
palette.make_transparent(0)

# Create water bitmap
water_bmp = displayio.Bitmap(display.width, display.height, len(palette))    #
water = displayio.TileGrid(water_bmp, pixel_shader=palette)
splash.append(water)

print("drawing background..")
# Load background image
try:
    bg_bitmap, bg_palette = adafruit_imageload.load(BACKGROUND,
                                                    bitmap=displayio.Bitmap,
                                                    palette=displayio.Palette)
# Or just use solid color
except (OSError, TypeError):
    BACKGROUND = BACKGROUND if isinstance(BACKGROUND, int) else 0x000000
    bg_bitmap = displayio.Bitmap(display.width, display.height, 1)
    bg_palette = displayio.Palette(1)
    bg_palette[0] = BACKGROUND
bg_palette.make_transparent(0)
background = displayio.TileGrid(bg_bitmap, pixel_shader=bg_palette)

# Add background to display
splash.append(background)

print('loading fonts...')
# Fonts within /fonts/ folder
font = cwd+"/fonts/GothamBlack-50.bdf"
font_small = cwd+"/fonts/GothamBlack-25.bdf"

# pylint: disable=syntax-error
data_glyphs = b'0123456789FC-* '
font = bitmap_font.load_font(font)
font.load_glyphs(data_glyphs)

font_small = bitmap_font.load_font(font_small)
full_glyphs = b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-,.: '
font_small.load_glyphs(full_glyphs)

# Label to display Adafruit IO status
label_status = Label(font_small, max_glyphs=20)
label_status.x = 305
label_status.y = 10
splash.append(label_status)

# Create a label to display the temperature
label_temp = Label(font, max_glyphs=4)
label_temp.x = 35
label_temp.y = 300
splash.append(label_temp)

# Create a label to display the water level
label_level = Label(font, max_glyphs=4)
label_level.x = display.width - 130
label_level.y = 300
splash.append(label_level)

print('loading icons...')
# Load temperature icon
icon_tmp_bitmap, icon_palette = adafruit_imageload.load(ICON_TEMP,
                                                        bitmap=displayio.Bitmap,
                                                        palette=displayio.Palette)
icon_palette.make_transparent(0)
icon_tmp_bitmap = displayio.TileGrid(icon_tmp_bitmap,
                                     pixel_shader=icon_palette,
                                     x=0, y=280)
splash.append(icon_tmp_bitmap)

# Load level icon
icon_lvl_bitmap, icon_palette = adafruit_imageload.load(ICON_LEVEL,
                                                        bitmap=displayio.Bitmap,
                                                        palette=displayio.Palette)
icon_palette.make_transparent(0)
icon_lvl_bitmap = displayio.TileGrid(icon_lvl_bitmap,
                                     pixel_shader=icon_palette,
                                     x=315, y=280)
splash.append(icon_lvl_bitmap)

# Connect to WiFi
label_status.text = "Connecting..."
while not esp.is_connected:
    try:
        wifi.connect()
    except RuntimeError as e:
        print("could not connect to AP, retrying: ",e)
        wifi.reset()
        continue
print("Connected to WiFi!")

# Initialize a new MiniMQTT Client object
mqtt_client = MQTT(
    socket=socket,
    broker="io.adafruit.com",
    username=secrets["aio_username"],
    password=secrets["aio_key"],
    network_manager=wifi
)

# Adafruit IO Callback Methods
# pylint: disable=unused-argument
def connected(client):
    # Connected function will be called when the client is connected to Adafruit IO.
    print('Connected to Adafruit IO!')

def subscribe(client, userdata, topic, granted_qos):
    # This method is called when the client subscribes to a new feed.
    print('Subscribed to {0} with QOS level {1}'.format(topic, granted_qos))

# pylint: disable=unused-argument
def disconnected(client):
    # Disconnected function will be called if the client disconnects
    # from the Adafruit IO MQTT broker.
    print("Disconnected from Adafruit IO!")

# Initialize an Adafruit IO MQTT Client
io = IO_MQTT(mqtt_client)

# Connect the callback methods defined above to the Adafruit IO MQTT Client
io.on_connect = connected
io.on_subscribe = subscribe
io.on_disconnect = disconnected

# Connect to Adafruit IO
print("Connecting to Adafruit IO...")
io.connect()
label_status.text = " "
print("Connected!")

fill_val = 0.0
def fill_water(fill_percent):
    """Fills the background water.
    :param float fill_percent: Percentage of the display to fill.

    """
    assert fill_percent <= 1.0, "Water fill value may not be > 100%"
    # pylint: disable=global-statement
    global fill_val

    if fill_val > fill_percent:
        for _y in range(int((board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*fill_val)),
                        int((board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*fill_percent))):
            for _x in range(1, board.DISPLAY.width-1):
                water_bmp[_x, _y] = 0
    else:
        for _y in range(board.DISPLAY.height-1,
                        (board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*fill_percent), -1):
            for _x in range(350, board.DISPLAY.width-20):     #1
                water_bmp[_x, _y] = 1 
    fill_val = fill_percent

def display_temperature(temp_val, is_celsius=False):
    """Displays the temperature from the STEMMA soil sensor
    on the PyPortal Titano.
    :param float temp: Temperature value.
    :param bool is_celsius:

    """
    if not is_celsius:
        temp_val = (temp_val) + 273
        print('Temperature: %0.0fK'%temp_val)
        label_temp.text = '%0.0fK'%temp_val
        return int(temp_val)
    else:
        print('Temperature: %0.0fC'%temp_val)
        label_temp.text = '%0.0fC'%temp_val
        return int(temp_val)


temp_val = 0.0
def fill_temp(temp_percent):
    #
    #Fills the background water.
    #:param float fill_percent: Percentage of the display to fill.
   
    assert temp_percent <= 1.0, "Water fill value may not be > 100%"
    # pylint: disable=global-statement
    global temp_val

    if temp_val > temp_percent:
        for _y in range(int((board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*temp_val)),
                        int((board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*temp_percent))):
            for _x in range(1, board.DISPLAY.width-1):
                water_bmp[_x, _y] = 0
    else:
        for _y in range(board.DISPLAY.height-1,
                        (board.DISPLAY.height-1) - ((board.DISPLAY.height-1)*temp_percent), -1):
            for _x in range(20, board.DISPLAY.width-350):     #1
                water_bmp[_x, _y] = 1 
    temp_val = temp_percent



# initial reference time
initial = time.monotonic()
while True:
    # Explicitly pump the message loop
    # to keep the connection active
    try:
        io.loop()
    except (ValueError, RuntimeError) as e:
        print("Failed to get data, retrying...\n", e)
        wifi.reset()
        continue
    now = time.monotonic()

    print("reading soil sensor...")
    # Read capactive
    moisture = ss.moisture_read()
    label_level.text = str(moisture)

    # Read temperature
    temp = ss.get_temp()
    temp = display_temperature(temp)

    # Convert into percentage for filling the screen
    moisture_percentage = map_range(float(moisture), SOIL_LEVEL_MIN, SOIL_LEVEL_MAX, 0.0, 1.0)
   
    temp_percent = map_range(float(temp), TEMP_LEVEL_MIN, TEMP_LEVEL_MAX, 0.0, 1.0)



    # fill display
    print("filling disp..")
    fill_water(moisture_percentage)
    print("disp filled..")
   
    fill_temp(temp_percent)
   
    print("temp: " + str(temp) + "  moisture: " + str(moisture))

    # Play water level alarms
    if moisture <= SOIL_LEVEL_MIN:
        print("Playing low water level warning...")
        pyportal.play_file(wav_water_low)
    elif moisture >= SOIL_LEVEL_MAX:
        print("Playing high water level warning...")
        pyportal.play_file(wav_water_high)


    if now - initial > (DELAY_PUBLISH * 60):
        try:
            print("Publishing data to Adafruit IO...")
            label_status.text = "Sending to IO..."
            io.publish("moisture", moisture)
            io.publish("temperature", temp)
            print("Published")
            label_status.text = "Data Sent!"

            # reset timer
            initial = now
        except (ValueError, RuntimeError) as e:
            label_status.text = "ERROR!"
            print("Failed to get data, retrying...\n", e)
            wifi.reset()
    time.sleep(DELAY_SENSOR)

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by adafruit_support_carter on Mon Feb 24, 2020 2:11 pm

When you get the error message:
Code: Select all | TOGGLE FULL SIZE
Failed to get data, retrying...
Failed to send 2 bytes (sent 0)

The code will automatically reset your wifi and try again. So you don't need to do anything. The code should still be running. If you wait for a little bit, do you see more output?

adafruit_support_carter
 
Posts: 16973
Joined: Tue Nov 29, 2016 2:45 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Mon Feb 24, 2020 5:34 pm

Hi

Thanks for the reply

I have just run the code for the last 20 minutes without interruption. It goes into the error state after a couple of minutes and stays that way, printing the "Failed to get data, retrying...
Failed to send 2 bytes (sent 0)" message every second. It does not reconnect to the wifi.

Cheers

Slowjim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by adafruit_support_carter on Tue Feb 25, 2020 11:58 am

Does it also do that with the original code from the guide?

adafruit_support_carter
 
Posts: 16973
Joined: Tue Nov 29, 2016 2:45 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Tue Feb 25, 2020 5:22 pm

Hi

Yes, I first saw the message when I loaded the original code without change.

Slowjim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by brubell on Wed Feb 26, 2020 9:32 am

Code: Select all | TOGGLE FULL SIZE
Failed to get data, retrying...
Failed to send 2 bytes (sent 0)

When I interrupt with Ctrl C I get the following error message:

Traceback (most recent call last):
File "code.py", line 301, in <module>
File "code.py", line 300, in <module>
File "adafruit_esp32spi/adafruit_esp32spi_wifimanager.py", line 92, in reset
File "adafruit_esp32spi/adafruit_esp32spi.py", line 185, in reset
KeyboardInterrupt:


Hi Jim, I'm the author of this code. Lines 300-301 of the code.py from the guide don't reference something which would cause a WiFi crash.

Could you upload the original code to the PyPortal Planter? Then, let it run and crash. Please copy and paste that output to this forum so I can help debug further.

brubell
 
Posts: 1047
Joined: Fri Jul 17, 2015 10:33 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Wed Feb 26, 2020 5:15 pm

Hi brubell

Thanks so much for your reply. I have just ran the original code and received the following. After receiving the error continuously I entered the keyboard interrupt :

Code: Select all | TOGGLE FULL SIZE
loading fonts...
loading icons...
Connected to WiFi!
Connecting to Adafruit IO...
Connected to Adafruit IO!
Connected!
reading soil sensor...
Temperature: 293K
filling disp..
disp filled..
temp: 293  moisture: 1001
reading soil sensor...
Temperature: 293K
filling disp..
disp filled..
temp: 293  moisture: 1004
reading soil sensor...
Temperature: 293K
filling disp..
disp filled..
temp: 293  moisture: 1006
reading soil sensor...
Temperature: 293K
filling disp..
disp filled..
temp: 293  moisture: 1007

Code done running. Waiting for reload.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
ESP firmware: bytearray(b'1.2.2\x00')
Set background to  0
No SD card found: no SD card
drawing background..
loading fonts...
loading icons...
Connected to WiFi!
Connecting to Adafruit IO...
Connected to Adafruit IO!
Connected!
reading soil sensor...
Temperature: 53F
filling disp..
disp filled..
temp: 53  moisture: 993
Playing high water level warning...
reading soil sensor...
Temperature: 54F
filling disp..
disp filled..
temp: 53  moisture: 983
Playing high water level warning...
reading soil sensor...
Temperature: 54F
filling disp..
disp filled..
temp: 53  moisture: 995
Playing high water level warning...
reading soil sensor...
Temperature: 54F
filling disp..
disp filled..
temp: 54  moisture: 993
Playing high water level warning...
reading soil sensor...
Temperature: 54F
filling disp..
disp filled..
temp: 53  moisture: 984
Playing high water level warning...
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Failed to get data, retrying...
 Failed to send 2 bytes (sent 0)
Traceback (most recent call last):
  File "code.py", line 272, in <module>
  File "code.py", line 271, in <module>
  File "adafruit_esp32spi/adafruit_esp32spi_wifimanager.py", line 92, in reset
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 185, in reset
KeyboardInterrupt:


Thanks so much for your help.

Cheers

Jim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Wed Mar 04, 2020 7:03 pm

Hi

I am not sure if anyone from Adafruit is following this thread, but I was just wondering if you had any updates or any more advice?

Cheers

Jim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Fri Mar 06, 2020 6:24 pm

Hi again

Given the issues I have had with this Titano trying to get other code to work, for example https://forums.adafruit.com/viewtopic.php?f=60&t=162203, is it possible that the hardware is defective?

Cheers

Jim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Tue Mar 10, 2020 5:24 am

Hi to all playing along at home

I seemed to have irradiated the issue by eliminating the code that talks to io. In the future I hope I can use this function to collect data, so if anyone has any thoughts then it would be awesome to hear about it. However, my current project is more about whimsy than it is about data collection, so to move things along the io issue will have to be a problem for another day.

I hope you are all having a great time learning and hacking etc.

Cheers

Slowjim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by jhaskins on Sat Mar 14, 2020 8:26 pm

Hi Slowjim,

Just to let you know you weren't alone with this issue. I also found the same circumstances, getting the "Failed to get data, retrying" loop shortly after successfully connecting to the WiFi and Adafruit IO.

I'll follow to see if there are any additional responses.

Thanks - JH

jhaskins
 
Posts: 2
Joined: Wed Jun 28, 2017 1:52 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by brubell on Tue Mar 17, 2020 5:14 pm

jhaskins wrote:Hi Slowjim,

Just to let you know you weren't alone with this issue. I also found the same circumstances, getting the "Failed to get data, retrying" loop shortly after successfully connecting to the WiFi and Adafruit IO.

I'll follow to see if there are any additional responses.

Thanks - JH


Hi jhaskins, I just rewrote a lot of the MQTT library that this code uses. Please download the latest CircuitPython library bundle and the latest version of the pet planter.

If it gives you an error, please paste the exact output from the REPL along with the of the code you are running in a new reply below.

brubell
 
Posts: 1047
Joined: Fri Jul 17, 2015 10:33 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by jhaskins on Wed Mar 18, 2020 11:02 am

Thank you brubell - I'll follow your direction and post the results shortly.

Cheers - JH

jhaskins
 
Posts: 2
Joined: Wed Jun 28, 2017 1:52 pm

Re: Failed to get data, retrying... Failed to send 2 bytes

by robomiller on Sat Aug 15, 2020 3:53 am

slowjim wrote:Hi to all playing along at home

I seemed to have irradiated the issue by eliminating the code that talks to io. In the future I hope I can use this function to collect data, so if anyone has any thoughts then it would be awesome to hear about it. However, my current project is more about whimsy than it is about data collection, so to move things along the io issue will have to be a problem for another day.

I hope you are all having a great time learning and hacking etc.

Cheers

Slowjim


Hi Slowjim

I was wondering if by chance I could get that code you used to eliminate talking to IO. I 'm trying to do this project and am having an issue with it connecting to IO. I'm such a newb I don't know what the heck i'm looking at with code. I feel like i did the guide to completion but all I get is failed to connect to IO. I was also wondering if by chance if eliminating the need to talk to IO will allow this project to be a great gift idea without the need for the gift receiver the need to enter in their wifi info and not have to create an IO account? Thanks.

robomiller
 
Posts: 9
Joined: Wed Jun 24, 2020 3:37 am

Re: Failed to get data, retrying... Failed to send 2 bytes

by slowjim on Thu Sep 10, 2020 4:24 am

Hi robomiller

Sorry for the slow reply, I missed that you had asked a question.

Off the top I am still very new to this also. The SlowJim handle is more fact than humor! I have looked for the original code I was using and to be honest it has changed so significantly since then it bares almost no resemblance to the code I was asking the question about. (I agree 1. I have very poor revision control and 2. I am prone to serious scope creep, this project veered off in a very different direction.

My goal was to learn enough CircuitPython that I could make some silly projects at home for my family. I understand that your goals may be different, however it was working on this code that allowed me climb the learning curve to get the ability to make some simple hacked style changes to the great examples from the Adafruit team.

As a starting point I would look to remove the code between 184 and 220 in the example. There may be some other dependencies that will might trip and error, but you might be able to eliminate them systematically with some print statements and the like. I have found that adding a print statement to identify where the code hangs is super useful for someone new. I have even noticed that the experts do the same from time to time.

Sorry again for the delay. I hope this helps

Cheers

SlowJim

slowjim
 
Posts: 37
Joined: Fri Sep 27, 2019 3:49 am

Please be positive and constructive with your questions and comments.