Oristo wrote,
"I do not know why my most recent 'screenV.py' works for me and fails for you;
perhaps because different Python conglomeration..."
--------------------------------------------------------------------------------------
On my NanoVNA with version 0.2.3 firmware, the following changes made your most recent script run to completion with correct screen colors.
1. #x = struct.unpack("<76800H", b[prune:blen])
x = struct.unpack("<76800H", b[:153600])
Prior to your suggested change, the error I received was that a consistent buffer size of 153600 was required. None of my web searches explained how that buffer should be allocated. Hard coding "magic" numbers is not good coding practice, but in this case it works :)
2. #arr = 0xFF000000 + ((arr & 0xF800) << 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 3)
arr = 0xFF000000 + ((arr & 0xF800) >> 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 19)
Your earlier script worked for me with the correct screen colors. It has the line "arr = 0xFF000000 + ((arr & 0xF800) >> 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 19)" and when I made that change in your current script the screen colors are correct.
So both scripts are running to completion on my set-up with the correct screen colors now. I'm not sure why "arr = 0xFF000000 + ((arr & 0xF800) << 8) + ((arr & 0x07E0) << 5) + ((arr & 0x001F) << 3)" works for you and not for me.
3. As previously noted, trying to grab a screen with an on screen keyboard or "Version" screen causes either script to hang somewhere in the ser.read function. Does this happen with when you use QRP's latest firmware?
I know QRP is wondering what the point of all this is when his NanoVNA-Sharp MOD works perfectly well at grabbing a screen capture. For me its just the exercise of learning Python and understanding another tool for using the NanoVNA.
- Herb