Add optional cyd_35r (ESP32-3248S035) with 480x320 UI; default remains 2.8.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
# Rebuild (optional) and refresh firmware/cyd from PlatformIO build output.
|
||||
# Usage:
|
||||
# .\firmware\export_from_build.ps1
|
||||
# .\firmware\export_from_build.ps1 -SkipBuild
|
||||
# Export firmware bins from PlatformIO build.
|
||||
# Default: 2.8" (cyd -> firmware/cyd)
|
||||
# 3.5": .\firmware\export_from_build.ps1 -Env cyd_35r
|
||||
# (only after: pio run -e cyd_35r)
|
||||
|
||||
param([switch]$SkipBuild)
|
||||
param(
|
||||
[switch]$SkipBuild,
|
||||
[ValidateSet("cyd", "cyd_35r")]
|
||||
[string]$Env = "cyd"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
@@ -12,17 +16,26 @@ Set-Location $root
|
||||
$env:Path = "C:\Users\dsx2016\AppData\Local\Programs\Python\Python312\Scripts;" + $env:Path
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
pio run -e cyd
|
||||
pio run -e $Env
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
$src = Join-Path $root ".pio\build\cyd"
|
||||
$dst = Join-Path $root "firmware\cyd"
|
||||
$src = Join-Path $root (".pio\build\" + $Env)
|
||||
if ($Env -eq "cyd_35r") {
|
||||
$dstName = "cyd_35r"
|
||||
$boardLine = "board: ESP32-3248S035 (ST7796)"
|
||||
$boardIdHint = "esp32-3248s035"
|
||||
} else {
|
||||
$dstName = "cyd"
|
||||
$boardLine = "board: ESP32-2432S028R (ILI9341)"
|
||||
$boardIdHint = "esp32-2432s028"
|
||||
}
|
||||
$dst = Join-Path $root ("firmware\" + $dstName)
|
||||
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
||||
|
||||
foreach ($f in @("bootloader.bin", "partitions.bin", "firmware.bin")) {
|
||||
$p = Join-Path $src $f
|
||||
if (-not (Test-Path $p)) { Write-Error "Missing build artifact: $p" }
|
||||
if (-not (Test-Path $p)) { Write-Error "Missing build artifact: $p — build with: pio run -e $Env" }
|
||||
Copy-Item $p $dst -Force
|
||||
}
|
||||
|
||||
@@ -37,11 +50,10 @@ try { $git = (git -C $root rev-parse --short HEAD).Trim() } catch { $git = "unkn
|
||||
$date = Get-Date -Format "yyyy-MM-dd"
|
||||
$hashes = Get-ChildItem (Join-Path $dst "*.bin") | Get-FileHash -Algorithm SHA256
|
||||
$lines = @(
|
||||
"name: CYD BLE (cyd)",
|
||||
"name: CYD bletest ($dstName)",
|
||||
"git: $git",
|
||||
"date: $date",
|
||||
"board: ESP32-2432S028R (ILI9341)",
|
||||
"features: NimBLE Nordic UART, LVGL status UI, SoftSPI touch",
|
||||
$boardLine,
|
||||
"flash_size: 4MB",
|
||||
"offsets:",
|
||||
" 0x1000 bootloader.bin",
|
||||
@@ -54,4 +66,22 @@ foreach ($h in $hashes) {
|
||||
$lines += (" {0,-15} {1}" -f (Split-Path $h.Path -Leaf), $h.Hash)
|
||||
}
|
||||
$lines | Set-Content -Encoding utf8 (Join-Path $dst "VERSION.txt")
|
||||
Write-Host "Exported -> $dst (git $git)"
|
||||
|
||||
# Keep / refresh meta.json boardId for catalog filtering
|
||||
$metaPath = Join-Path $dst "meta.json"
|
||||
if (Test-Path $metaPath) {
|
||||
try {
|
||||
$meta = Get-Content $metaPath -Raw | ConvertFrom-Json
|
||||
$meta.boardId = $boardIdHint
|
||||
if ($Env -eq "cyd_35r" -and $meta.name -notmatch "3\.5") {
|
||||
$meta.name = ($meta.name -replace "\s*$","") + " (3.5\")"
|
||||
}
|
||||
$meta | ConvertTo-Json -Depth 8 | Set-Content -Encoding utf8 $metaPath
|
||||
} catch {
|
||||
Write-Host "meta.json update skipped: $_"
|
||||
}
|
||||
} elseif ($Env -eq "cyd_35r") {
|
||||
Write-Host "Note: add firmware/cyd_35r/meta.json with boardId=$boardIdHint for the web catalog"
|
||||
}
|
||||
|
||||
Write-Host "Exported -> $dst (env=$Env git=$git)"
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
// CYD ESP32-2432S028R
|
||||
// Board pins — 2.8" default; 3.5" when CYD_BOARD_3248S035 is set (env:cyd_35r)
|
||||
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define TFT_BL_PIN 27
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define UI_HOR_RES 480
|
||||
#define UI_VER_RES 320
|
||||
#else
|
||||
#define TFT_BL_PIN 21
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
#define UI_HOR_RES 320
|
||||
#define UI_VER_RES 240
|
||||
#endif
|
||||
|
||||
#define CYD_TOUCH_IRQ 36
|
||||
#define CYD_TOUCH_MOSI 32
|
||||
@@ -10,7 +22,11 @@
|
||||
#define CYD_TOUCH_CLK 25
|
||||
#define CYD_TOUCH_CS 33
|
||||
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
#define UI_HOR_RES 320
|
||||
#define UI_VER_RES 240
|
||||
/* Map 320x240 design coordinates onto the active UI resolution (identity on 2.8"). */
|
||||
#define UX(x) ((int)(((long)(x) * (UI_HOR_RES)) / 320))
|
||||
#define UY(y) ((int)(((long)(y) * (UI_VER_RES)) / 240))
|
||||
#define UW(w) UX(w)
|
||||
#define UH(h) UY(h)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -55,3 +55,20 @@ build_flags =
|
||||
-DCONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED
|
||||
|
||||
extra_scripts = pre:copy_lv_conf.py
|
||||
|
||||
; Optional 3.5" CYD ESP32-3248S035 (ST7796 resistive). Default remains [env:cyd].
|
||||
; Build: pio run -e cyd_35r
|
||||
[env:cyd_35r]
|
||||
extends = env:cyd
|
||||
build_flags =
|
||||
${env:cyd.build_flags}
|
||||
-UILI9341_2_DRIVER
|
||||
-DST7796_DRIVER=1
|
||||
-UTFT_WIDTH
|
||||
-UTFT_HEIGHT
|
||||
-DTFT_WIDTH=320
|
||||
-DTFT_HEIGHT=480
|
||||
-UTFT_BL
|
||||
-DTFT_BL=27
|
||||
-DCYD_BOARD_3248S035=1
|
||||
|
||||
|
||||
@@ -199,36 +199,36 @@ void ble_ui_create() {
|
||||
lv_label_set_text(lbl_title, "CYD BLE");
|
||||
lv_obj_set_style_text_color(lbl_title, lv_color_hex(COL_ACCENT), 0);
|
||||
lv_obj_set_style_text_font(lbl_title, &lv_font_montserrat_20, 0);
|
||||
lv_obj_set_pos(lbl_title, 10, 6);
|
||||
lv_obj_set_pos(lbl_title, UX(10), UY(6));
|
||||
|
||||
lbl_state = lv_label_create(scr);
|
||||
lv_obj_set_style_text_font(lbl_state, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_state, 10, 34);
|
||||
lv_obj_set_pos(lbl_state, UX(10), UY(34));
|
||||
|
||||
lbl_name = lv_label_create(scr);
|
||||
lv_obj_set_style_text_color(lbl_name, lv_color_hex(COL_INK), 0);
|
||||
lv_obj_set_style_text_font(lbl_name, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_name, 10, 54);
|
||||
lv_obj_set_pos(lbl_name, UX(10), UY(54));
|
||||
|
||||
lbl_addr = lv_label_create(scr);
|
||||
lv_obj_set_style_text_color(lbl_addr, lv_color_hex(COL_MUTED), 0);
|
||||
lv_obj_set_style_text_font(lbl_addr, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_addr, 10, 74);
|
||||
lv_obj_set_pos(lbl_addr, UX(10), UY(74));
|
||||
|
||||
lbl_peer = lv_label_create(scr);
|
||||
lv_obj_set_style_text_color(lbl_peer, lv_color_hex(COL_MUTED), 0);
|
||||
lv_obj_set_style_text_font(lbl_peer, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_peer, 10, 94);
|
||||
lv_obj_set_pos(lbl_peer, UX(10), UY(94));
|
||||
|
||||
lbl_echo = lv_label_create(scr);
|
||||
lv_obj_set_style_text_font(lbl_echo, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(lbl_echo, 10, 114);
|
||||
lv_obj_set_pos(lbl_echo, UX(10), UY(114));
|
||||
|
||||
lv_obj_t *hint = lv_label_create(scr);
|
||||
lv_label_set_text(hint, "App: nRF Connect / Serial BT");
|
||||
lv_obj_set_style_text_color(hint, lv_color_hex(COL_MUTED), 0);
|
||||
lv_obj_set_style_text_font(hint, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_pos(hint, 10, 134);
|
||||
lv_obj_set_pos(hint, UX(10), UY(134));
|
||||
|
||||
const int bw = 72;
|
||||
const int bh = 36;
|
||||
|
||||
Reference in New Issue
Block a user