Search found 158 matches

by KJM
Sat Sep 03, 2022 3:43 am
Forum: General Discussion and Questions
Topic: new sockets for old?
Replies: 3
Views: 21584

Re: new sockets for old?

def _request(method, url, data=None): proto, dummy, host, path=url.split("/", 3); s=0 for i in range(2): try: ai=(ipa, 443) s=socket.socket(); s.connect(ai); s=ssl.wrap_socket(s, server_hostname=host) s.write(b"%s /%s HTTP/1.0\r\nHost: %s\r\n" % (method, path, host)) if data: s.write(b"Content-Leng...
by KJM
Fri Sep 02, 2022 12:25 am
Forum: General Discussion and Questions
Topic: new sockets for old?
Replies: 3
Views: 21584

new sockets for old?

I've got s=socket.socket(); s.connect(ai); s=ssl.wrap_socket(s, server_hostname=host) as part of a loop that does DNS lookup etc. If I get an [Errno 128] ENOTCONN (socket not connected) the exception code closes the socket & returns to the loop for another try. However on the next pass through the l...
by KJM
Sun Aug 14, 2022 3:23 am
Forum: Programs, Libraries and Tools
Topic: ciphertext question
Replies: 2
Views: 19228

ciphertext question

The crypto lib in pycom's flavour of micropython allows creating a cipher for less than 16 bytes import crypto from crypto import AES msg='shortxt' iv=b'sixteen chatr iv' cipher=AES(key, AES.MODE_CFB, iv) The ucrytolib in regular micropython however seems to only work with 16 bytes, so that shorter ...
by KJM
Thu Aug 11, 2022 7:58 am
Forum: Programs, Libraries and Tools
Topic: __init__confusion
Replies: 1
Views: 2288

__init__confusion

Since https://docs.micropython.org/en/latest/library/cryptolib.html has no usage example I went looking for some. They all look something like class AES: def __init__(self, key, mode, IV): There is no mention of 'def' or 'self' on the micropython.org page so I'm wondering if there is a usage example...
by KJM
Fri Aug 05, 2022 7:40 am
Forum: General Discussion and Questions
Topic: Frustrations with missing libraries?
Replies: 18
Views: 22403

Re: Frustrations with missing libraries?

I'd like to try lora in upython on an esp32 but I need (u)crypto & upip can't seem to quite pull it off >>> upip.install('crypto') Installing to: /lib/ Error installing 'crypto': , packages may be partially installed I'm wondering if I need a different flavour of upython? All the online examples of ...
by KJM
Tue Aug 02, 2022 6:25 am
Forum: ESP32 boards
Topic: Detecting and counting pulses while in deep sleep
Replies: 4
Views: 3034

Re: Detecting and counting pulses while in deep sleep

https://gist.github.com/wnienhaus/56c534079823ed036a8f13a43ab7ddf8 Took me a while to figure out the ins & outs of running ulp code inside a .py but the gent behind the idea was very supportive, not a hint of the bruising side serve of opinion that you sometimes get when seeking guidance on some for...
by KJM
Mon Jul 25, 2022 9:01 am
Forum: Programs, Libraries and Tools
Topic: Little FS file recovery
Replies: 1
Views: 1673

Little FS file recovery

Is there a way to recover an accidentally os.removed file from flash in little FS on the esp32 or is it gone for good?
by KJM
Mon Jul 18, 2022 5:13 am
Forum: Programs, Libraries and Tools
Topic: python picture tweaking
Replies: 2
Views: 2656

Re: python picture tweaking

For stills, exposure (especially outdoors) improves if you take 10 frames & use only the last one.
by KJM
Wed Jul 13, 2022 6:16 am
Forum: ESP32 boards
Topic: It is possible to the esp32 to wake up from deep sleep without reading boot?
Replies: 4
Views: 2230

Re: It is possible to the esp32 to wake up from deep sleep without reading boot?

You could put your trigger code in boot.py & your deepsleep code in main.py I think after wakeup the esp32 should run boot.py first.
by KJM
Sat Jul 09, 2022 8:58 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 21636

Re: bits to bytes

If you're referring to data = bytes((0b11110111, 0b11111010,)) Rob, I didn't use that because it throws an error >>> data = bytes((0b11110111, 0b11111010,)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'bytes' object is not callable I'm back where I started with ...