4b7f82c38f
- Re-apply input-gain-percent (100 = no digital boost) + 42dB HW max mapping lost in the upstream merge (was 340953b1/7788415e) - es3c35p: lvgl.fontSize=16 (text 12/16/22, launcher icons 42) - Add flash-es3c.sh build+flash helper for 28p/35p
78 lines
2.2 KiB
Bash
Executable File
78 lines
2.2 KiB
Bash
Executable File
#!/bin/zsh
|
|
# Build and flash LCDWIKI ES3C28P / ES3C35P firmware.
|
|
#
|
|
# Usage:
|
|
# ./flash-es3c.sh 35p [port] [--build-only]
|
|
# ./flash-es3c.sh 28p [port] [--build-only]
|
|
#
|
|
# If port is omitted, the single /dev/cu.usbmodem* device is used.
|
|
# Each board keeps its own build dir (build-es3c28p / build-es3c35p),
|
|
# so switching boards only rewrites sdkconfig via device.py.
|
|
set -eu -o pipefail
|
|
|
|
FIRMWARE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$FIRMWARE_DIR"
|
|
SCRIPT_NAME="$(basename "$0")"
|
|
|
|
usage() {
|
|
echo "Usage: ${SCRIPT_NAME} <28p|35p> [port] [--build-only]"
|
|
echo " port defaults to the single /dev/cu.usbmodem* device"
|
|
}
|
|
|
|
if (( $# == 0 )); then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
28p|es3c28p) DEVICE_ID="es3c28p" ;;
|
|
35p|es3c35p) DEVICE_ID="es3c35p" ;;
|
|
-h|--help|help) usage; exit 0 ;;
|
|
*) echo "Unknown device '$1' (expected 28p or 35p)"; usage; exit 1 ;;
|
|
esac
|
|
shift
|
|
|
|
PORT=""
|
|
BUILD_ONLY=0
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--build-only) BUILD_ONLY=1 ;;
|
|
*) PORT="$arg" ;;
|
|
esac
|
|
done
|
|
|
|
if (( ! BUILD_ONLY )) && [[ -z "$PORT" ]]; then
|
|
candidates=(/dev/cu.usbmodem*(N))
|
|
if (( ${#candidates} == 0 )); then
|
|
echo "No /dev/cu.usbmodem* device found. Connect the board or pass the port explicitly."
|
|
exit 1
|
|
fi
|
|
if (( ${#candidates} > 1 )); then
|
|
echo "Multiple USB modem devices found:"
|
|
printf ' %s\n' "${candidates[@]}"
|
|
echo "Unplug one board or pass the port explicitly."
|
|
exit 1
|
|
fi
|
|
PORT="${candidates[1]}"
|
|
fi
|
|
|
|
# IDF 5.5 environment (host venvs corrupt IDF tooling, so pin the IDF python env)
|
|
unset VIRTUAL_ENV PYTHONPATH PYTHONHOME
|
|
export IDF_PYTHON_ENV_PATH=/Users/adolforeyna/.espressif/python_env/idf5.5_py3.9_env
|
|
source /Users/adolforeyna/esp/esp-idf/export.sh
|
|
|
|
BUILD_DIR="build-${DEVICE_ID}"
|
|
"$IDF_PYTHON_ENV_PATH/bin/python" device.py "$DEVICE_ID"
|
|
idf.py -B "$BUILD_DIR" reconfigure build
|
|
|
|
if (( BUILD_ONLY )); then
|
|
echo "Build done (${BUILD_DIR}/Tactility.bin). Skipping flash (--build-only)."
|
|
exit 0
|
|
fi
|
|
|
|
echo "=== Confirming board on ${PORT} ==="
|
|
"$IDF_PYTHON_ENV_PATH/bin/python" -m esptool --chip esp32s3 -p "$PORT" chip_id | grep -E "Chip is|MAC:"
|
|
|
|
idf.py -B "$BUILD_DIR" -p "$PORT" -b 460800 flash
|
|
echo "Flashed ${DEVICE_ID} on ${PORT}."
|