Skip to content

Commit

Permalink
Merge pull request #328 from mathoudebine/feature/315-support-for-35-…
Browse files Browse the repository at this point in the history
…screen-from-kipye
  • Loading branch information
mathoudebine authored Sep 21, 2023
2 parents a681cc9 + 85cad86 commit 49d777c
Show file tree
Hide file tree
Showing 15 changed files with 272 additions and 71 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Supported operating systems : macOS, Windows, Linux (incl. Raspberry Pi), basica
| <img src="res/docs/turing.webp"/> | <img src="res/docs/xuanfang.webp"/> | <img src="res/docs/turing5inch.png"/> |
| also improperly called "revision A" by the resellers | revision B & flagship (with backplate & RGB LEDs) | basic support (no video or storage for now) |

|[UsbPCMonitor 3.5" / 5"](https://aliexpress.com/item/1005003931363455.html) |
|-----------------------------------------------------------------------------------------------------|
| <img src="res/docs/UsbPCMonitor_5inch.webp" width="30%" height="30%"/> |
| Unknown manufacturer, visually similar to Turing 3.5" / 5". Original software is `UsbPCMonitor.exe` |
|[UsbPCMonitor 3.5" / 5"](https://aliexpress.com/item/1005003931363455.html) |[Kipye Qiye Smart Display 3.5"](https://www.aliexpress.us/item/3256803899049957.html) |
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| <img src="res/docs/UsbPCMonitor_5inch.webp" width="60%" height="60%"/> | <img src="res/docs/kipye-qiye-35.webp" width="60%" height="60%"/> |
| Unknown manufacturer, visually similar to Turing 3.5" / 5". Original software is `UsbPCMonitor.exe` | Front panel has an engraved inscription "奇叶智显" Qiye Zhixian (Qiye Smart Display) |

### [> What is my smart screen model?](https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions)

Expand All @@ -42,10 +42,10 @@ If you haven't received your screen yet but want to start developing your theme
| <img src="res/docs/turing8inch.jpg"/> | <img src="res/docs/turing2inch.webp"/> | <img src="res/docs/fuldho_3.5.jpg"/> |
| Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Managed with [proprietary Windows software `SmartMonitor.exe`](https://smartdisplay.lanzouo.com/b04jvavkb). Cannot be supported by this project: [see here](https://github.com/mathoudebine/turing-smart-screen-python/discussions/298). Use alternative library https://github.com/braewoods/hidss |

|_[SmartCool Lcd](https://aliexpress.com/item/1005005443609423.html) / [GeekTeches AD35](https://aliexpress.com/item/1005004858688084.html) / AIDA64 / AX206_ |_[Kipye Qiye Smart Display 3.5"](https://www.aliexpress.us/item/3256803899049957.html)_ |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <img src="res/docs/ax206.jpg" width="30%" height="30%" /> <img src="res/docs/geekteches_ad35.jpg" width="30%" height="30%" /> <img src="res/docs/smartcool_lcd.webp" width="30%" height="30%" /> | <img src="res/docs/kipye-35.webp"/> |
| Not supported. Produced by multiple manufacturers, all use the same [Appotech AX206 hacked photo frame firmware](https://github.com/dreamlayers/dpf-ax). Supported by AIDA64 and lcd4linux | Front panel has an engraved inscription "奇叶智显" Qiye Zhixian (Qiye Smart Display). Display should be compatible with this project. [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/315) |
|_[SmartCool Lcd](https://aliexpress.com/item/1005005443609423.html) / [GeekTeches AD35](https://aliexpress.com/item/1005004858688084.html) / AIDA64 / AX206_ |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <img src="res/docs/ax206.jpg" width="30%" height="30%" /> <img src="res/docs/geekteches_ad35.jpg" width="30%" height="30%" /> <img src="res/docs/smartcool_lcd.webp" width="30%" height="30%" /> |
| Not supported. Produced by multiple manufacturers, all use the same [Appotech AX206 hacked photo frame firmware](https://github.com/dreamlayers/dpf-ax). Supported by AIDA64 and lcd4linux |

## How to start

Expand Down
11 changes: 8 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ config:
WLO: "" # Wi-Fi Card

display:
# Display revision: A for Turing 3.5" and UsbPCMonitor 3.5"/5", B for Xuanfang 3.5" (inc. flagship), C for Turing 5"
# Use SIMU for 3.5" simulated LCD (image written in screencap.png) or SIMU5 for 5" simulated LCD
# To identify your revision: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
# Display revision:
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
# - B for Xuanfang 3.5" (inc. flagship)
# - C for Turing 5"
# - D for Kipye Qiye Smart Display 3.5"
# - SIMU for 3.5" simulated LCD (image written in screencap.png)
# - SIMU5 for 5" simulated LCD
# To identify your smart screen: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
REVISION: A

# Display Brightness
Expand Down
7 changes: 4 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
TURING_MODEL = "Turing Smart Screen"
USBPCMONITOR_MODEL = "UsbPCMonitor"
XUANFANG_MODEL = "XuanFang rev. B & flagship"
KIPYE_MODEL = "Kipye Qiye Smart Display"
SIMULATED_MODEL = "Simulated screen"

SIZE_3_5_INCH = "3.5\""
Expand All @@ -70,22 +71,22 @@
size_list = (SIZE_3_5_INCH, SIZE_5_INCH)

# Maps between config.yaml values and GUI description
# revision_to_model_map = {'A': TURING_MODEL, 'B': XUANFANG_MODEL, 'C': TURING_MODEL, 'SIMU': SIMULATED_MODEL,
# 'SIMU5': SIMULATED_MODEL}
revision_and_size_to_model_map = {
('A', SIZE_3_5_INCH): TURING_MODEL, # Can also be UsbPCMonitor 3.5, does not matter since protocol is the same
('A', SIZE_5_INCH): USBPCMONITOR_MODEL,
('B', SIZE_3_5_INCH): XUANFANG_MODEL,
('C', SIZE_5_INCH): TURING_MODEL,
('D', SIZE_3_5_INCH): KIPYE_MODEL,
('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL,
('SIMU5', SIZE_5_INCH): SIMULATED_MODEL,
}
model_and_size_to_revision_map = {
(TURING_MODEL, SIZE_3_5_INCH): 'A',
(TURING_MODEL, SIZE_5_INCH): 'C',
(USBPCMONITOR_MODEL, SIZE_3_5_INCH): 'A',
(USBPCMONITOR_MODEL, SIZE_5_INCH): 'A',
(XUANFANG_MODEL, SIZE_3_5_INCH): 'B',
(TURING_MODEL, SIZE_5_INCH): 'C',
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
(SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU',
(SIMULATED_MODEL, SIZE_5_INCH): 'SIMU5',
}
Expand Down
12 changes: 4 additions & 8 deletions library/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from library.lcd.lcd_comm_rev_a import LcdCommRevA
from library.lcd.lcd_comm_rev_b import LcdCommRevB
from library.lcd.lcd_comm_rev_c import LcdCommRevC
from library.lcd.lcd_comm_rev_d import LcdCommRevD
from library.lcd.lcd_simulated import LcdSimulated
from library.log import logger

Expand All @@ -45,14 +46,6 @@ def _get_theme_orientation() -> Orientation:
return Orientation.REVERSE_LANDSCAPE
else:
return Orientation.LANDSCAPE
elif config.THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'reverse_portrait':
logger.warn("'reverse_portrait' is deprecated as DISPLAY_ORIENTATION value in the theme."
"Use 'portrait' instead, and use DISPLAY_REVERSE in config.yaml to reverse orientation.")
return Orientation.REVERSE_PORTRAIT
elif config.THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'reverse_landscape':
logger.warn("'reverse_landscape' is deprecated as DISPLAY_ORIENTATION value in the theme."
"Use 'landscape' instead, and use DISPLAY_REVERSE in config.yaml to reverse orientation.")
return Orientation.REVERSE_LANDSCAPE
else:
logger.warning("Orientation '", config.THEME_DATA["display"]["DISPLAY_ORIENTATION"],
"' unknown, using portrait")
Expand All @@ -71,6 +64,9 @@ def __init__(self):
elif config.CONFIG_DATA["display"]["REVISION"] == "C":
self.lcd = LcdCommRevC(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
elif config.CONFIG_DATA["display"]["REVISION"] == "D":
self.lcd = LcdCommRevD(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
elif config.CONFIG_DATA["display"]["REVISION"] == "SIMU":
self.lcd = LcdSimulated(display_width=320,
display_height=480)
Expand Down
1 change: 0 additions & 1 deletion library/lcd/lcd_comm_rev_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def SetBrightness(self, level: int = 25):
self.SendCommand(Command.SET_BRIGHTNESS, level_absolute, 0, 0, 0)

def SetOrientation(self, orientation: Orientation = Orientation.PORTRAIT):
self.orientation = orientation
width = self.get_width()
height = self.get_height()
x = 0
Expand Down
9 changes: 5 additions & 4 deletions library/lcd/lcd_comm_rev_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def InitializeComm(self):
self._hello()

def Reset(self):
# HW revision B does not implement a command to reset it
pass
# HW revision B does not implement a command to reset it: clear display instead
self.Clear()

def Clear(self):
# This hardware does not implement a Clear command: display a blank image on the whole screen
# HW revision B does not implement a Clear command: display a blank image on the whole screen
# Force an orientation in case the screen is currently configured with one different from the theme
backup_orientation = self.orientation
self.SetOrientation(orientation=Orientation.PORTRAIT)
Expand Down Expand Up @@ -186,7 +186,7 @@ def SetBackplateLedColor(self, led_color: Tuple[int, int, int] = (255, 255, 255)
else:
logger.info("Only HW revision 'flagship' supports backplate LED color setting")

def SetOrientation(self, orientation: Orientation = Orientation.PORTRAIT, new_width: int = 320, new_height: int = 480):
def SetOrientation(self, orientation: Orientation = Orientation.PORTRAIT):
# In revision B, basic orientations (portrait / landscape) are managed by the display
# The reverse orientations (reverse portrait / reverse landscape) are software-managed
self.orientation = orientation
Expand Down Expand Up @@ -223,6 +223,7 @@ def DisplayPILImage(
(x0, y0) = (x, y)
(x1, y1) = (x + image_width - 1, y + image_height - 1)
else:
# Reverse landscape/portrait orientations are software-managed: get new coordinates
(x0, y0) = (self.get_width() - x - image_width, self.get_height() - y - image_height)
(x1, y1) = (self.get_width() - x - 1, self.get_height() - y - 1)

Expand Down
3 changes: 2 additions & 1 deletion library/lcd/lcd_comm_rev_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _send_command(self, cmd: Command, payload: bytearray = None, padding: Paddin
message = bytearray()

if cmd != Command.SEND_PAYLOAD:
message = cmd.value
message = bytearray(cmd.value)

# logger.debug("Command: {}".format(cmd.name))

Expand Down Expand Up @@ -213,6 +213,7 @@ def InitializeComm(self):

def Reset(self):
logger.info("Display reset (COM port may change)...")
# Reset command bypasses queue because it is run when queue threads are not yet started
self._send_command(Command.RESTART, bypass_queue=True)
self.closeSerial()
# Wait for display reset then reconnect
Expand Down
Loading

0 comments on commit 49d777c

Please sign in to comment.