Search found 158 matches

by KJM
Wed Jun 29, 2022 11:49 pm
Forum: ESP32 boards
Topic: Convert Time Epoch in Date ,OpenWeather
Replies: 2
Views: 1793

Re: Convert Time Epoch in Date ,OpenWeather

upython uses a different start time to the usual unix epoch used by python, subtract 946684800 before converting to human readable.
by KJM
Tue Jun 28, 2022 11:23 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 23800

Re: bits to bytes

I sympathise. Some days it just feels like there are too many layers of abstraction between me & the ESP32. In my salad days I'd stick a CRO probe on the modulation pin of a radio transmitter to check the data, now days I'm reduced to checking the duration of a raw lora burst in effort to verify how...
by KJM
Tue Jun 28, 2022 6:26 am
Forum: General Discussion and Questions
Topic: How to check if file exists?
Replies: 5
Views: 12284

Re: How to check if file exists?

If you're a simple soul like me & chuck most everything in the root directory.....
import os
if 'my_file' in os.listdir(): print('found it')
by KJM
Tue Jun 28, 2022 6:00 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 23800

Re: bits to bytes

thnx. When I google 'escape' I got a lot of stuff about 'escape characters' but I don't think that's what you're referring too? Can you explain 'escape' in this context?
by KJM
Mon Jun 27, 2022 3:10 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 23800

Re: bits to bytes

My head says you're right jimmo & it will be fine over lora but heart is saying 'you can't trust it, use chr/ord (where wysiwyg) instead'
by KJM
Mon Jun 27, 2022 1:12 am
Forum: General Discussion and Questions
Topic: config wifi channel in STA mode
Replies: 13
Views: 3571

Re: config wifi channel in STA mode

Possible thread drift here Dave, but the LTE modem in the pycom gpy was a bugger for waking up thinking it was connected (when it wasn't because there was no attachment). Interested to read your post about esp32 wifi doing likewise. Is there some timeout in a router we could adjust to keep a wifi co...
by KJM
Sun Jun 26, 2022 11:22 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 23800

Re: bits to bytes

So no easy way to get b'40 80' ? Seems to me python is being as slippery with octal/hex here as it sometimes is with types?
by KJM
Sun Jun 26, 2022 2:17 am
Forum: General Discussion and Questions
Topic: config wifi channel in STA mode
Replies: 13
Views: 3571

Re: config wifi channel in STA mode

I assume you're running something like.... if not sta.isconnected(): print('connecting to '+AP, end=' '); sta.connect(AP, pwd) for i in range(10): if sta.isconnected(): ESP32 generally get a connect within a couple of seconds from wakeup (with RSSIs around -80dbm, I haven't locked the router to a pa...
by KJM
Sun Jun 26, 2022 1:27 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 23800

Re: bits to bytes

Your 1 liner looked super elegant Christian so I ran it forwards & backwards to see if performed as well as as it looks >>> bits=[0,0,0,1,0,0,0,0,1,0,0,0] >>> struct.pack('<H', sum(b*(1<<(i^7)) for i, b in enumerate(bits))) b'\x10\x80' >>> struct.pack('<H', sum(b*(1<<(i)) for i, b in enumerate(bits)...
by KJM
Fri Jun 24, 2022 9:51 pm
Forum: Raspberry Pi microcontroller boards
Topic: Change the main program runtime
Replies: 7
Views: 2790

Re: Change the main program runtime

you could put something like

Code: Select all

import 'my_other_prog'

into main.py?