Skip to main content

Command Palette

Search for a command to run...

MeshTalk, Curses and Packets

Updated
2 min read
MeshTalk, Curses and Packets
D

I started programming when I was 11. Microsoft Basic on a TRS-80 computer.

Moved on to learn Pacal, C, C++, Cobol, SQL, PHP, Powershell, Python.

Been coding for 40 years and loving it.

MeshTalk

It has been a wild week for me. I decided to improve the curses code in my MeshTalk program. If you recall, curses is a python library (derived from ancient 80's code) used to display text in windows on a terminal.

Curses

I created 5 windows that have different types of scrolling. Each window is easily resizable and colored. Getting this to work properly took a lot of tweaking. Windows can be refreshed, updated, cleared, scrolled etc.

I created a sort of word-wrap function as well. It looks and works great.

One useful window I have is the Keys. As the program decodes packets it writes out the key name to a Keys window. This lets me see pertinent keys that I want to display in other windows.

Meshtalk keys window.jpg

Decoding Packets

Data packets sent and received by the radio are stored as python dictionaries. A dictionary is a list of key/value pairs.

Meshtastic packets can contain other packets. To decode these I created a recursive function. You send it a packet, and it decodes it. If it finds a packet inside, then it calls itself, passing THAT packet. And so on.

By printing the keys out to a scrolling window, I can see which keys are interesting and focus on those.

Right now I am trying to determine the name of the device that is connected to the Raspberry Pi.

meshtastic status window.jpg

As you can see, I have not yet gotten it right. A little more debugging and it will be all good.

More from this blog

T

This Old Coder

15 posts

I am a life long programmer. I work with SQL Server professionally, and I code Python on Raspberry Pi computers for fun. I am also a professional photographer, an arcade and pinball enthusiast.