Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands or parameters "missed" on macOS with UsbPCMonitor 3.5" #512

Open
jeffsf opened this issue May 7, 2024 · 5 comments
Open

Commands or parameters "missed" on macOS with UsbPCMonitor 3.5" #512

jeffsf opened this issue May 7, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@jeffsf
Copy link

jeffsf commented May 7, 2024

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

  • Plug in display to hub on Mac.
  • Run main.py
05/07/2024 10:26:39 [INFO] Loading theme 3.5inchTheme2 from res/themes/3.5inchTheme2/theme.yaml
05/07/2024 10:26:39 [DEBUG] HW revision: A
05/07/2024 10:26:39 [DEBUG] Auto detected COM port: /dev/cu.usbmodemUSB35INCHIPSV21
  • Note that areas are "random" dots rather than text or clean graphical elements
  • Note that some of these areas resolve with apparent refreshes and others become garbled

Using custom code

  • Run the attached code, scrolling-text.py from the root level of this project's local directory
  • Observe that the screen does not go black consistently
  • Observe that the text is garbled and may be in the wrong "row"
  • Note that on subsequent runs, the resulting display is dfifferent

Neither setting update_queue=None nor adding time.sleep() between calls seemed to resolve the rendering issues.

Expected behavior

The screen would be refreshed without significant rendering defects

Environment:

  • Apparent UsbPCMonitor 3.5"
    • "Choice SKU 759133297043"
    • AliExpress 3256806256906629.html
    • "New 3.5 Inch IPS TYPE-C Secondary Screen Computer CPU GPU RAM HDD MonitorUSB Display For Freely AIDA64"
  • Commit 2355937 on main
  • macOS Sonoma 14.4.1 on Mac Mini 2018 (3.2 GHz 6-Core Intel Core i7)
  • Python 3.12.3

Desired Outcome:

Mitigation approach or reasonable confidence in an assessment that this display is a PoS
Low priority for me as display seems functional. Can assist on diagnosing and resolving macOS-related differences.

IMG_4956
IMG_4957
IMG_4958

@jeffsf jeffsf added the bug Something isn't working label May 7, 2024
@jeffsf
Copy link
Author

jeffsf commented May 7, 2024

#!/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

@jeffsf
Copy link
Author

jeffsf commented May 7, 2024

Image of box label and insert

IMG_4959

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)

@jeffsf
Copy link
Author

jeffsf commented May 7, 2024

Both scripts work on Debian Bookworm.

Updating title to indicate that this appears to be a macOS issue

@jeffsf jeffsf changed the title Commands or parameters "missed" with Apparent UsbPCMonitor 3.5" Commands or parameters "missed" on macOS with UsbPCMonitor 3.5" May 7, 2024
@c0ldJS
Copy link

c0ldJS commented May 8, 2024

Have you taken a look at issues #7 and #499 ?

@Numbski
Copy link

Numbski commented Jun 12, 2024

I am getting this exact same behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants