Open jeffsf opened 5 months ago
#!/usr/bin/env python
# Program to see how fast the "New 3.5 Inch IPS TYPE-C Secondary Screen ..."
# `USB35INCHIPSV21` can scroll text.
#
# Appears to be a 480x320 device.
# 8x16 characters would be 20 rows of 60 characters
import logging
import time
from library.lcd.lcd_comm import Orientation
from library.lcd.lcd_comm_rev_a import LcdCommRevA, Command
from library.log import logger
# Modify the logging format
new_formatter = logging.Formatter(
fmt='%(asctime)s,%(msecs)03d %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
for handler in logger.parent.handlers:
handler.setFormatter(new_formatter)
# dimensions are when in portrait
# Setting update_queue=None from lcd_comm.py:
# If you want serial requests to be done in sequence, set it to None
lcd_comm = LcdCommRevA(com_port="AUTO",
display_width=320,
display_height=480,
update_queue=None)
lcd_comm.Reset()
lcd_comm.InitializeComm()
lcd_comm.SetBrightness(25)
lcd_comm.SetOrientation(orientation=Orientation.LANDSCAPE)
from library.log import logger
# lcd_comm.SendCommand(Command.TO_BLACK, 0, 0, 320, 320) # No impact
lcd_comm.DisplayBitmap("./480x320_black.png")
logger.info("Black written, sleeping 2")
time.sleep(2)
logger.info("Writing text")
for row in range(0,9):
offset = row * 16
text = (f"{row+1:02x}-4567891"
"1234567892"
"1234567893"
"1234567894"
)
lcd_comm.DisplayText(
text=text,
x=0, y=offset,
font="roboto-mono/RobotoMono-Regular.ttf",
font_size=16,
font_color=(255, 255, 255),
background_color=(10, 10, 10))
time.sleep(1)
logger.info("Writing text done")
time.sleep(2)
_Image can be generated with magick -size 480x320 canvas:black 480x320_black.png
_
Image of box label and insert
05072024_3.5 Inch IPS TYPE-C Secondary Screen Instructions 1. Do.pdf
Output of lsusb -v
on Debian Bookworm
Bus 001 Device 002: ID 1a86:5722 QinHeng Electronics UsbMonitor
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1a86 QinHeng Electronics
idProduct 0x5722
bcdDevice 1.00
iManufacturer 1 2017-2-25
iProduct 2 UsbMonitor
iSerial 3 USB35INCHIPSV2
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0043
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 0
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 255
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
Both scripts work on Debian Bookworm.
Updating title to indicate that this appears to be a macOS issue
Have you taken a look at issues #7 and #499 ?
I am getting this exact same behavior.
A 3.5" screen was purchased on AliExpress that was indicated in the comments to work with this software. Running
main.py
results in some areas "garbled" after refreshes. Running a relatively simple program to write a black image and then lines of text sometimes does not write the black image and results in misplaced or garbled text (upper part of the text shifted relative to the lower part).To Reproduce
Using
main.py
main.py
Using custom code
scrolling-text.py
from the root level of this project's local directoryNeither setting
update_queue=None
nor addingtime.sleep()
between calls seemed to resolve the rendering issues.Expected behavior
The screen would be refreshed without significant rendering defects
Environment:
main
Desired Outcome:
Mitigation approach or reasonable confidence in an assessment that this display is a PoSLow priority for me as display seems functional. Can assist on diagnosing and resolving macOS-related differences.