Git Product home page Git Product logo

micropython's People

Contributors

andrewleech avatar aykevl avatar blmorris avatar chipaca avatar danicampora avatar deshipu avatar dhylands avatar dlech avatar dpgeorge avatar dvdgiessen avatar flowergrass avatar glennrub avatar iabdalkader avatar jepler avatar jimmo avatar jonathanhogg avatar jongy avatar lurch avatar maureenhelm avatar mcauser avatar peterhinch avatar pfalcon avatar pi-anl avatar projectgus avatar robert-hh avatar rolandvs avatar stinos avatar takeotakahashi2020 avatar tve avatar yn386 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

micropython's Issues

Enable `ESPNow.peers_table` for esp8266

According to docs :

This feature is not available on ESP8266 devices.

I would be glad to know the reason. I can guess two of the reasons :

  1. Saving RAM
  2. Reducing code size

In one of my projects, I need a mechanism to detect the incoming messages' RSSI on esp8266. Is there anyway that I might achieve this goal?

Receiving messages from esp8266 with ESP32 connected to STA

According to your documentation :

Receiving messages from an ESP8266 device: Strangely, an ESP32 device connected to a wifi network using method 1 or 2 above, will receive ESP-Now messages sent to the STA_IF MAC address from another ESP32 device, but will reject messages from an ESP8266 device!!!. To receive messages from an ESP8266 device, the AP_IF interface must be set to active(True) and messages must be sent to the AP_IF MAC address.

I've tested it with an esp01 device (which integrates ESP8266EX SoC) as sender and ESP32 as receiver and successfully received messages which are sent from esp01 to esp32 device. I should also mention that I've sent them to broadcast mac address.

esp8266 unable to send to broadcast address

According to the
documentation
,
esp8266 should be able to send to (but not receive on) the broadcast
address:

All ESP-Now devices (including ESP8266 devices) can also send messages to the broadcast MAC address or any multicast MAC address.

To send() a broadcast message, the broadcast (or multicast) MAC address must first be registered using add_peer(). send() will always return True for broadcasts, regardless of whether any devices receive the message. It is not permitted to encrypt messages sent to the broadcast address or any multicast address.

However, in practice this seems to fail with an OSError:

MicroPython v1.19.1-espnow-6-g44f65965b on 2022-07-09; ESP module with ESP8266
Type "help()" for more information.
>>> import espnow
>>> e = espnow.ESPNow()
>>> e.active(True)
>>> bcast = b'\xff' * 6
>>> e.add_peer(bcast)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: -3

This is running Micropython installed from https://github.com/glenn20/micropython-espnow-images/blob/6b9e8d5dd08ee445a9fb3d145e64fa2473239c9a/20220709_espnow-g20-v1.19.1-espnow-6-g44f65965b/firmware-esp8266-GENERIC.bin.

No module names `_espnow`

I've opened a PR from this branch to master branch of my own fork of micropython and then I've merged it. I've built it esp8266 successfully but I cannot import espnow because of this error:

Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "espnow.py", line 4, in <module>
ImportError: no module named '_espnow'

ESP Now LR mode

When you enable Long range mode w0.config(protocol=network.MODE_LR) - I am no longer able to see the WiFi beacon of AP from my computer's network scan. Can you please confirm whether you can connect to AP with LR mode enabled?

Mostly unusable timestamp in `peers_table`

According to docs :

time_ms is the time the message was received (in milliseconds since system boot - wraps every 12 days).

In my project I update esp32 time with server using a mechanism similar to ntptime.settime(). But it seems timestamps of peers_table will use the old time (which is time since boot). MicroPython doesn't provide any APIs to access mp_hal_ticks_ms() so these timestamp would be useless when we have no other time to compare. I have two questions:

  1. Why saving time in ms? as long as it is a uint32_t so it can keep time in seconds.
  2. Why timestamps should be measured since boot? What about make it identical and comparable with time.time() ?

Sorted `ESPNOW.peers_table`

My feature request comes with two questions:

  1. Are ESPNOW.peers_table records sorted by any parameter like latest message timestamp or rssi?
  2. Which parameter is better to sort the table by? rssi or latest message timestamp?

docs:

You have mentioned about broadcast messages between ESP8266 and ESP32 not appearing unless they are on AP_IF.

I have noticed this today
Sender ESP32 broadcast address
broadcastpeer = b'\xff' * 6
e0.add_peer(broadcastpeer,ifidx=network.AP_IF)

Any broadcast sent from ESP32 on both the interfaces are not received by ESP8266, please confirm whether you are able to reproduce this and update the document accordingly.

Developing ESP-NOW for circuitpython

Hi Glenn, I wasn't sure how else to get a hold of you so sorry for the "issue".

I am interested in integrating ESP-NOW with CircuitPython but I have no idea where to start.

Would you be interested in helping me get started/maybe coach me a little so I can attempt this?

Library not found in local micropython-lib: aioespnow

When trying to compile the espnow-g20-v1.20.0 branch following error pops out:

freeze error executing "boards/GENERIC_1M/manifest.py": Error in manifest file: 
/micropython/ports/esp8266/boards/GENERIC_1M/manifest.py: Error in manifest file: 
/micropython/ports/esp8266/boards/manifest.py: Library not found in local micropython-lib: aioespnow

I checked the lib/micropython-lib/micropython folder and aioespnow is not there. I created the folder "aioespnow" and added "aioespnow.py" from v1.19.1 and everything compiles successfully.

I checked the
473eb99
and then the
micropython/micropython-lib#641

So, will be waiting for aioespnow to appear on micropython-lib.

aioespnow.zip

Memory issue with AIOESPNow

I started having memory allocation errors once I tried porting my code to use the new uasyncio module AIOESPNow.
MemoryError: memory allocation failed, allocating 4224 bytes

This happens even if I have no espnow code and I just import the module in the context of my application like so:
import aioespnow as espnow

If I comment the import line and run micropython.mem_info() I get this:
GC: total: 64000, used: 42480, free: 21520,

21520 bytes should be plenty no?

Without any code loaded, the REPL gives me this when running micropython.mem_info():
GC: total: 64000, used: 6256, free: 57744

If I then import aioespnow I get:
GC: total: 64000, used: 12016, free: 51984

Roughly 6kb doesn't seem like a lot, but if the import happens in the context of the application, it crashes and I have no idea why yet.

Any clues on what might be happening? I know that it's not much to start with but I appreciate any insights.

Thank you.

add_peer() has no effect on ESP8285

Hey!

I am developing ESP-NOW event system around uasyncio and finally got my hands to report this issue (or more like convenient feature).

On ESP8285 add_peer() has no effect. I can send messages to a peer STA/AP MAC address without using add_peer(). I used the example according the https://github.com/glenn20/micropython/blob/espnow-g20/docs/library/espnow.rst

I am using custom build of espnow-g20-v1.20.0 branch. Maybe there are some differences in ESP8285 SDK or something?

import network
import espnow

# A WLAN interface must be active to send()/recv()
sta = network.WLAN(network.STA_IF)  # Or network.AP_IF
sta.active(True)
sta.disconnect()      # For ESP8266 (and also for ESP8285)

e = espnow.ESPNow()
e.active(True)
peer = b'\xbb\xbb\xbb\xbb\xbb\xbb'   # MAC address of peer's wifi interface
e.add_peer(peer)      # Must add_peer() before send() <- This line has no effect

e.send(peer, "Starting...")
for i in range(100):
    e.send(peer, str(i)*20, True)
e.send(peer, b'end')

OTA over ESPNOW

Hello @glenn20

As exposed here I would like to request if is a good idea to implement the OTA over ESPNOW, or if is better just to change the protocol, from ESPNOW to regular WiFi, execute normal OTA over WiFi and when OTA is finished, back to works in the ESPNOW protocol. My fear is just about in applications that use just battery, where using the WiFi can to be use so much energy at the OTA over WiFi process.

Thank you!

ESPNow module has been merged into MicroPython

PR6515 has now been merged into the Micropython main branch. You should consider submitting Issues with ESPNow support in MicroPython there. I will keep this branch (espnow-g20) open to preserve the Issues reported here. I will continue to monitor Issues reported here as well.

Thanks to the users who have provided encouragement, reported bugs and other issues and contributed to the discussions on github and in the Micropython Forum over the last few years, especially @davefes, @AmirHmZz, @krishnak. Most of all, thanks to the micropython community that Damien kicked off 10 years ago.

Can't import name TouchPad on Lolin S2 image

Hi.
I'm using latest image to test the ESP Now functionality (great work btw!), but I found I get an error when trying to use the TouchPad functionality.
I get "ImportError: Can't import name TouchPad" when using
from machine import TouchPad

Image is firmware-esp32-LOLIN_S2_MINI.bin from 13 Apr [20220413_espnow-g20-v1.18-10-ge68d28c8b]

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.