Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 24 additions & 29 deletions Buildscripts/CDN/generate-firmware-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
from datetime import datetime, UTC
import os
import sys
import configparser
from dataclasses import dataclass, asdict
import json
import shutil
from configparser import RawConfigParser

VERBOSE = False
DEVICES_FOLDER = "Devices"
Expand Down Expand Up @@ -68,32 +66,29 @@ def exit_with_error(message):
sys.exit(1)

def read_properties_file(path):
config = configparser.RawConfigParser()
# Don't convert keys to lowercase
config.optionxform = str
config.read(path)
return config

def get_property_or_none(properties: RawConfigParser, group: str, key: str):
if group not in properties.sections():
return None
if key not in properties[group].keys():
return None
return properties[group][key]

def get_boolean_property_or_false(properties: RawConfigParser, group: str, key: str):
if group not in properties.sections():
return False
if key not in properties[group].keys():
return False
return properties[group][key] == "true"

def get_property_or_exit(properties: RawConfigParser, group: str, key: str):
if group not in properties.sections():
exit_with_error(f"Device properties does not contain group: {group}")
if key not in properties[group].keys():
exit_with_error(f"Device properties does not contain key: {key}")
return properties[group][key]
properties = {}
with open(path, "r") as file:
for line in file:
stripped = line.strip()
if not stripped or stripped.startswith("#"):
continue
key, sep, value = line.partition("=")
if not sep:
continue
properties[key.strip()] = value.strip()
return properties

def get_property_or_none(properties: dict, group: str, key: str):
return properties.get(f"{group}.{key}")

def get_boolean_property_or_false(properties: dict, group: str, key: str):
return properties.get(f"{group}.{key}") == "true"

def get_property_or_exit(properties: dict, group: str, key: str):
full_key = f"{group}.{key}"
if full_key not in properties:
exit_with_error(f"Device properties does not contain key: {full_key}")
return properties[full_key]

def read_device_properties(device_id):
mapping_file_path = os.path.join(DEVICES_FOLDER, device_id, "device.properties")
Expand Down Expand Up @@ -129,7 +124,7 @@ def to_manifest_chip_name(name):
return ""


def process_device(in_path: str, out_path: str, device_directory: str, device_id: str, device_properties: RawConfigParser, version: str):
def process_device(in_path: str, out_path: str, device_directory: str, device_id: str, device_properties: dict, version: str):
in_device_path = os.path.join(in_path, device_directory)
in_device_binaries_path = os.path.join(in_device_path, "Binaries")
if not os.path.isdir(in_device_binaries_path):
Expand Down
7 changes: 2 additions & 5 deletions Buildscripts/properties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function(READ_PROPERTIES_TO_MAP PROPERTY_FILE RESULT_VAR)
endif ()

file(STRINGS ${PROPERTY_FILE_ABS} lines)
set(current_section "")
set(map_content "")

foreach(line IN LISTS lines)
Expand All @@ -37,9 +36,7 @@ function(READ_PROPERTIES_TO_MAP PROPERTY_FILE RESULT_VAR)
continue()
endif ()

if (line MATCHES "^\\[.*\\]$")
set(current_section "${line}")
elseif (line MATCHES "^([^=]+)=(.*)$")
if (line MATCHES "^([^=]+)=(.*)$")
set(key "${CMAKE_MATCH_1}")
set(value "${CMAKE_MATCH_2}")
string(STRIP "${key}" key)
Expand All @@ -49,7 +46,7 @@ function(READ_PROPERTIES_TO_MAP PROPERTY_FILE RESULT_VAR)
set(value "${CMAKE_MATCH_1}")
endif ()

list(APPEND map_content "${current_section}${key}" "${value}")
list(APPEND map_content "${key}" "${value}")
endif ()
endforeach()

Expand Down
37 changes: 16 additions & 21 deletions Devices/btt-panda-touch/device.properties
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
[general]
vendor=BigTreeTech
name=Panda Touch,K Touch
general.vendor=BigTreeTech
general.name=Panda Touch,K Touch

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32S3
flashSize=16MB
spiRam=true
spiRamMode=OCT
spiRamSpeed=120M
esptoolFlashFreq=120M
bluetooth=true
usbHostEnabled=true
hardware.target=ESP32S3
hardware.flashSize=16MB
hardware.spiRam=true
hardware.spiRamMode=OCT
hardware.spiRamSpeed=120M
hardware.esptoolFlashFreq=120M
hardware.bluetooth=true
hardware.usbHostEnabled=true

[display]
size=5"
shape=rectangle
dpi=187
display.size=5"
display.shape=rectangle
display.dpi=187

[lvgl]
colorDepth=16
fontSize=18
lvgl.colorDepth=16
lvgl.fontSize=18
25 changes: 10 additions & 15 deletions Devices/cyd-2432s024c/device.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[general]
vendor=CYD
name=2432S024C
general.vendor=CYD
general.name=2432S024C

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false
hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

[display]
size=2.4"
shape=rectangle
dpi=167
display.size=2.4"
display.shape=rectangle
display.dpi=167

[lvgl]
colorDepth=16
lvgl.colorDepth=16
25 changes: 10 additions & 15 deletions Devices/cyd-2432s024r/device.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[general]
vendor=CYD
name=2432S024R
general.vendor=CYD
general.name=2432S024R

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false
hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

[display]
size=2.4"
shape=rectangle
dpi=167
display.size=2.4"
display.shape=rectangle
display.dpi=167

[lvgl]
colorDepth=16
lvgl.colorDepth=16
28 changes: 11 additions & 17 deletions Devices/cyd-2432s028r/device.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
[general]
vendor=CYD
name=2432S028R
general.vendor=CYD
general.name=2432S028R

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false
hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

[display]
size=2.8"
shape=rectangle
dpi=143
display.size=2.8"
display.shape=rectangle
display.dpi=143

[cdn]
warningMessage=There are 3 hardware variants of this board. This build works on the original variant only ("v1").
cdn.warningMessage=There are 3 hardware variants of this board. This build works on the original variant only ("v1").

[lvgl]
colorDepth=16
lvgl.colorDepth=16
28 changes: 11 additions & 17 deletions Devices/cyd-2432s028rv3/device.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
[general]
vendor=CYD
name=2432S028R v3
general.vendor=CYD
general.name=2432S028R v3

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false
hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

[display]
size=2.8"
shape=rectangle
dpi=143
display.size=2.8"
display.shape=rectangle
display.dpi=143
[cdn]
warningMessage=There are 3 hardware variants of this board. This build only supports board version 3.
cdn.warningMessage=There are 3 hardware variants of this board. This build only supports board version 3.
[lvgl]
colorDepth=16
lvgl.colorDepth=16
25 changes: 10 additions & 15 deletions Devices/cyd-2432s032c/device.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[general]
vendor=CYD
name=2432S032C
general.vendor=CYD
general.name=2432S032C

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false
hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

[display]
size=3.2"
shape=rectangle
dpi=125
display.size=3.2"
display.shape=rectangle
display.dpi=125

[lvgl]
colorDepth=16
lvgl.colorDepth=16
33 changes: 14 additions & 19 deletions Devices/cyd-3248s035c/device.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[general]
vendor=CYD
name=3248S035C

[apps]
launcherAppId=Launcher

[hardware]
target=ESP32
flashSize=4MB
spiRam=false

[display]
size=3.5"
shape=rectangle
dpi=165

[lvgl]
colorDepth=16
general.vendor=CYD
general.name=3248S035C

apps.launcherAppId=Launcher

hardware.target=ESP32
hardware.flashSize=4MB
hardware.spiRam=false

display.size=3.5"
display.shape=rectangle
display.dpi=165

lvgl.colorDepth=16
31 changes: 13 additions & 18 deletions Devices/cyd-4848s040c/device.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
[general]
vendor=CYD
name=4848S040C
general.vendor=CYD
general.name=4848S040C

[apps]
launcherAppId=Launcher
apps.launcherAppId=Launcher

[hardware]
target=ESP32S3
flashSize=16MB
spiRam=true
spiRamMode=OCT
spiRamSpeed=80M
bluetooth=true
hardware.target=ESP32S3
hardware.flashSize=16MB
hardware.spiRam=true
hardware.spiRamMode=OCT
hardware.spiRamSpeed=80M
hardware.bluetooth=true

[display]
size=4"
shape=rectangle
dpi=170
display.size=4"
display.shape=rectangle
display.dpi=170

[lvgl]
colorDepth=16
lvgl.colorDepth=16
Loading
Loading