Search found 96 matches

by martincho
Fri Jul 08, 2022 4:11 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25645

Re: bits to bytes

>>> bis='11110' >>> struct.pack('<H', sum(int(bis)*(1<<(i^7)) for i, b in enumerate(bis))) b'\xd0\n' Don't do that. You are just confusing yourself. Do not mash a bunch of code into one line. It might look cool, but it is hard to understand and debug. You can do that if you want after fully validat...
by martincho
Fri Jul 08, 2022 2:52 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25645

Re: bits to bytes

But when I send this character the lora the receiver reports 3 bytes. Am I right in thinking that those 3 bytes were probably \u f7 fa ? What's bugging me is I can't get anything other than the lora receiver to report 3 bytes for r. I figure if I really had a handle on the different classes and the...
by martincho
Thu Jul 07, 2022 4:18 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25645

Re: bits to bytes

Something is troubling me Rob. It should take 2 bytes to represent 16 bits. But if I convert my 16 bit string of 1s & 0s to a character with d=int(bis, 2); bys=hex(d); r=chr(int(bys)) & send that over raw lora (without encryption) the receiver says it's received 1 byte. How is it possible to cram 6...
by martincho
Thu Jul 07, 2022 3:10 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25645

Re: bits to bytes

def _Tx(r): s.send(M); m=lora.stats(); print('P(dBm)',m[6], ' sf',m.sftx, ' Tx(ms)',m[7]); print() bis='1111011111111010' d=int(bis, 2); h=hex(d); r=chr(int(h)); print('bys', r, type(r), len(r), 'bytes'); _Tx(r) d=int(bis, 2); h=hex(d); r=(h)[2:7]; print('bys', r, type(r), len(r), 'bytes'); _Tx(r) ...
by martincho
Thu Jul 07, 2022 4:44 am
Forum: General Discussion and Questions
Topic: Do I need to recompile MicroPython for 16MB flash chip?
Replies: 5
Views: 1286

Re: Do I need to recompile MicroPython for 16MB flash chip?

davef wrote:
Thu Jul 07, 2022 3:34 am
Seen this?
viewtopic.php?f=18&t=9768&p=54711&hilit ... 8mb#p54711
Maybe, it gives a clue to the process.
That looks useful. Thanks.
by martincho
Thu Jul 07, 2022 4:43 am
Forum: General Discussion and Questions
Topic: Do I need to recompile MicroPython for 16MB flash chip?
Replies: 5
Views: 1286

Re: Do I need to recompile MicroPython for 16MB flash chip?

jimmo wrote:
Thu Jul 07, 2022 2:52 am
Fairly sure no recompile necessary if you don't plan to use anything past the first 2MiB.

You'd need to recompile to set a new filesystem size limit if you did want to grow the filesystem.
Yeah, not for this application. I guess I'll find out in a few days. I'll report back with my findings.
by martincho
Thu Jul 07, 2022 2:49 am
Forum: General Discussion and Questions
Topic: Do I need to recompile MicroPython for 16MB flash chip?
Replies: 5
Views: 1286

Do I need to recompile MicroPython for 16MB flash chip?

RP2040. We have a bunch of custom boards arriving next week. I think I remember reading somewhere that you have to recompile MicroPython if you change from the stock 2 MB flash chip. I put a 16 MB chip (W25Q128JVS) on these boards. Don't need the storage for MicroPython at all, 2MB is fine. This is ...
by martincho
Wed Jul 06, 2022 3:50 pm
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25645

Re: bits to bytes

After reading the learned comments I thought I had a handle on bytes & the different ways python displays them. But I still managed to fall at the first hurdle. When talking to the outside world, the only data types you want to use are bytes and bytearrays. I know it sounds simple. Once you make th...
by martincho
Tue Jul 05, 2022 6:21 am
Forum: General Discussion and Questions
Topic: How to brick your Pico in one easy step?
Replies: 7
Views: 3780

Re: How to brick your Pico in one easy step?

See https://github.com/micropython/micropython/issues/8861 and https://github.com/micropython/micropython/issues/8862 Thanks for opening these issues. While nobody like losing pins, this might be necessary. There might be a potential to get clever with existing pins. GPIO 23 and 24 come to mind.
by martincho
Tue Jul 05, 2022 5:59 am
Forum: General Discussion and Questions
Topic: How to brick your Pico in one easy step?
Replies: 7
Views: 3780

Re: How to brick your Pico in one easy step?

scruss wrote:
Tue Jul 05, 2022 3:00 am
Looks like a bug, perhaps.

Rather than using the full-on flash_nuke.uf2, there's one which renames main.py here: Bricked MicroPython rescue firmware - Raspberry Pi Forums. At least that way you can recover the contents of the board
That can be very useful too. Thanks for posting the info.