Search found 4914 matches

by pythoncoder
Sun Feb 21, 2021 3:55 pm
Forum: ESP32 boards
Topic: multi-threading question
Replies: 15
Views: 847

Re: multi-threading question

still applies . Given that the ESP32 runs FreeRTOS this is probably the most efficient way to use its two cores. In general threading and Python don't coexist too well because of the GIL: this limits the benefit of running on multiple cores. If there is a single Python runtime, threads can cause ea...
by pythoncoder
Sun Feb 21, 2021 10:00 am
Forum: General Discussion and Questions
Topic: NTP accuracy on ESP8266
Replies: 4
Views: 125

Re: NTP accuracy on ESP8266

I would draw a distinction between absolute and relative accuracy. NTP provides absolute time, but because of transport latency it is hard to get better than 1s accuracy. I believe there are ways, but it's specialist stuff. GPS may be easier. But absolute time to μs level is a laboratory grade requi...
by pythoncoder
Sun Feb 21, 2021 9:28 am
Forum: Programs, Libraries and Tools
Topic: Astral port/alternative
Replies: 7
Views: 5275

Re: Astral port/alternative

The day of the year calculation interests me. It works, but its logic eludes me. This is perhaps easier to follow:

Code: Select all

t = time.mktime((year, month, day, 0, 0, 0, 0, 0))
t0 = time.mktime((year, 1, 1,  0, 0, 0, 0, 0))  # Jan 1st
day_of_year = 1 + (t - t0)//(24*3600)  # Jan 1st is day 1
by pythoncoder
Sun Feb 21, 2021 8:49 am
Forum: Hardware Projects
Topic: Wind Speed?
Replies: 5
Views: 185

Re: Wind Speed?

Aside from the fact that this line is clearly wrong print("Wind Speed = %.2f") %WS1 I can't see how this code is supposed to work. You have declared a pin wind_speed_sensor but nowhere do you actually use it. There are two issues you need to grasp to get this working, namely contact bounce and concu...
by pythoncoder
Sat Feb 20, 2021 10:32 am
Forum: ESP8266 boards
Topic: Frozen modules attempt failed
Replies: 12
Views: 260

Re: Frozen modules attempt failed

I use

Code: Select all

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect -fm dio 0 build-GENERIC/firmware-combined.bin
The dio may take other values depending on the make of board. I have needed dout on some boards. A forum search may throw up other options.
by pythoncoder
Sat Feb 20, 2021 10:23 am
Forum: Raspberry Pi microcontroller boards
Topic: mandelbrot calculation and strange behavior in PICO
Replies: 6
Views: 294

Re: mandelbrot calculation and strange behavior in PICO

shaoziyang wrote:
Sat Feb 20, 2021 1:08 am
...It appears to be caused by the print function, this problem only appear on PICO.
Interesting. There seem to be a number of issues around the Pico USB interface.
by pythoncoder
Fri Feb 19, 2021 6:00 pm
Forum: General Discussion and Questions
Topic: New uasyncio feature: ThreadSafeFlag
Replies: 2
Views: 100

New uasyncio feature: ThreadSafeFlag

I thought it was worth drawing attention to this as it's a significant enhancement. Thanks to @jimmo uasyncio has an official thread safe way to interface with code such as interrupt service routines and code running in another thread. This is documented here . I have also updated my tutorial with s...
by pythoncoder
Fri Feb 19, 2021 5:05 pm
Forum: General Discussion and Questions
Topic: I am looking for a solution for _thread in class object
Replies: 7
Views: 232

Re: I am looking for a solution for _thread in class object

That firmware is very out of date. As far as I know the Loboris port was abandoned long ago.
by pythoncoder
Thu Feb 18, 2021 8:24 am
Forum: Pyboard D-series
Topic: uasyncio lock not working
Replies: 2
Views: 110

Re: uasyncio lock not working

See example code here.