unable to access webrepl when main script is running

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: unable to access webrepl when main script is running

Post by davef » Sat Nov 07, 2020 1:32 am

Just following the recommended delay on several Micropython document pages for 1-wire.

MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Re: unable to access webrepl when main script is running

Post by MrRobot » Sat Nov 07, 2020 2:15 am

Hi, sorry the time estimates were just an example.

I tried all combinations of timing intervals. Different sleep times , but no success.

My Data logger essentially works like this:

Samples the sensors (takes 2 minutes)

Send the data (takes about 3 minutes)

Deep sleep for 5/10 minutes

Repeat


Like I said above the only way I can access webrepl is using an input() that hangs the device.

I can't kill or stop the main thread and gain control at all

MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Re: unable to access webrepl when main script is running

Post by MrRobot » Sat Nov 07, 2020 2:11 pm

MostlyHarmless wrote:
Sat Nov 07, 2020 12:40 am
750ms to read sensors sounds like a lot. Can you give more details on that?


Jan
So my Pyboard D is being used as a data logger for various sensors e.g. GPS, Temperature etc.

The main loop functions like so:
  • Sample Devices (2-3 minutes)
  • Send Data (2 minutes)
  • deep sleep for 10 minutes

The deep sleep effectively hard resets the Pyboard.

I've experimented with all different kinds of sleep e.g. sleep, sleep_ms and sleep_us

But until the main thread is killed or stops I can't access webrepl.


The only minor success I had was putting in a input() statement which hangs the main code and allowed me to log in, however I couldn't enter a Control + C or Control + D to gain control.



If anyone can think of a way for me to gain control of the repl using WiFi I would be really grateful.

This Data logger is being placed in a lake and opening the case up to access the Repl just isn't ideal and risks water damage.

Thanks in advance :D

MrRobot
Posts: 31
Joined: Mon May 11, 2020 11:30 am

Re: unable to access webrepl when main script is running

Post by MrRobot » Sat Nov 07, 2020 2:13 pm

davef wrote:
Sat Nov 07, 2020 1:32 am
Just following the recommended delay on several Micropython document pages for 1-wire.
Can you elaborate a little?

What sort of delay are you talking about?

Do you have a link?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: unable to access webrepl when main script is running

Post by davef » Sat Nov 07, 2020 5:31 pm

1-wire delay from https://docs.micropython.org/en/latest/ ... ckref.html
and https://docs.micropython.org/en/latest/ ... kref.html

Code: Select all

import time, ds18x20
ds = ds18x20.DS18X20(ow)
roms = ds.scan()
ds.convert_temp()
time.sleep_ms(750)
for rom in roms:
    print(ds.read_temp(rom))
I don't see 1-wire in the pyboard section.

Post Reply