Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
961f5748c6
|
|||
|
a66843a455
|
|||
|
379808e659
|
|||
|
e2b2734301
|
|||
|
43a0c3c274
|
|||
|
2b83d99820
|
|||
|
4cc70f96de
|
|||
|
c90174be27
|
|||
|
b569fa4b04
|
|||
|
f71ca7ec6d
|
|||
|
28f7ae20ef
|
|||
|
52049c456e
|
|||
|
e3b7648a3f
|
|||
|
08ee9018cf
|
|||
|
c2929a65ae
|
|||
|
0b386b0ca3
|
|||
|
0ab1ea3635
|
|||
|
ae73f12d1c
|
|||
|
cfe1c2c6d8
|
|||
|
578379c0d9
|
|||
|
2ff219a1cb
|
|||
|
96023c8dc3
|
|||
|
7497a8c05d
|
|||
|
d3d8d829be
|
|||
|
6889ba4561
|
|||
|
18095349f3
|
|||
|
3d8fd893f5
|
|||
|
1bea7ef2f4
|
|||
|
f5b9674840
|
|||
|
6f22881007
|
|||
|
1d8af1b6c4
|
|||
|
2c532359fc
|
|||
|
53819484fb
|
|||
|
1151d099cf
|
|||
|
3feaacd460
|
|||
|
e15e78cc26
|
|||
|
d9aa96a3cb
|
|||
|
ecf989b859
|
|||
|
db401aac55
|
|||
| ecb7707357 | |||
|
4cf7a1c94f
|
|||
|
9155676e06
|
|||
|
e05f3d768f
|
@@ -8,6 +8,15 @@ target
|
|||||||
Cargo.lock
|
Cargo.lock
|
||||||
node_modules/
|
node_modules/
|
||||||
rust/src/webserver/bundle.js
|
rust/src/webserver/bundle.js
|
||||||
|
rust/src/webserver/bundle.js.gz
|
||||||
rust/src/webserver/index.html
|
rust/src/webserver/index.html
|
||||||
|
rust/src/webserver/index.html.gz
|
||||||
|
rust/src_webpack/bundle.js
|
||||||
|
rust/src_webpack/bundle.js.gz
|
||||||
|
rust/src_webpack/index.html
|
||||||
|
rust/src_webpack/index.html.gz
|
||||||
rust/build/
|
rust/build/
|
||||||
rust/image.bin
|
rust/image.bin
|
||||||
|
rust/target/
|
||||||
|
rust/Cargo.lock
|
||||||
|
rust/src_webpack/node_modules/
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
CONTAINER_NAME="localhost/wch-dev-tools:latest"
|
CONTAINER_NAME="localhost/esp-plant-dev-tools:latest"
|
||||||
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
pushd "$CONTAINER_TOOLS_BASEDIR"
|
pushd "$CONTAINER_TOOLS_BASEDIR"
|
||||||
podman build -t "$CONTAINER_NAME" -f "../wch-tools.Containerfile" .
|
podman build -t "$CONTAINER_NAME" -f "esp-plant-dev-tools.Containerfile" .
|
||||||
popd
|
popd
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
FROM debian:latest
|
||||||
|
|
||||||
|
RUN apt update -y && apt upgrade -y && apt install unzip curl xz-utils nodejs -y
|
||||||
|
|
||||||
|
RUN cd /root && \
|
||||||
|
curl -L -o xpack-riscv-toolchain.tar.gz "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64.tar.gz" && \
|
||||||
|
mkdir xpack-toolchain && \
|
||||||
|
tar -xvf xpack-riscv-toolchain.tar.gz -C xpack-toolchain --strip-components=1 && \
|
||||||
|
mv xpack-toolchain/bin/* /usr/local/bin && \
|
||||||
|
mv xpack-toolchain/lib/ /usr/local && \
|
||||||
|
mv xpack-toolchain/lib64/ /usr/local && \
|
||||||
|
mv xpack-toolchain/libexec /usr/local && \
|
||||||
|
mv xpack-toolchain/riscv-none-elf /usr/local && \
|
||||||
|
rm -rf xpack-toolchain xpack-riscv-toolchain.tar.gz
|
||||||
|
|
||||||
|
RUN apt install npm -y
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
CONTAINER_IMAGE="localhost/wch-dev-tools:latest"
|
CONTAINER_IMAGE="localhost/esp-plant-dev-tools:latest"
|
||||||
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
PLANTCTL_PROJECT_DIR="$(readlink -f "$CONTAINER_TOOLS_BASEDIR/..")"
|
||||||
|
|
||||||
function _fatal {
|
function _fatal {
|
||||||
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
|
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
|
||||||
@@ -12,8 +13,7 @@ function _fatal {
|
|||||||
|
|
||||||
declare -a PODMAN_ARGS=(
|
declare -a PODMAN_ARGS=(
|
||||||
"--rm" "-i" "--log-driver=none"
|
"--rm" "-i" "--log-driver=none"
|
||||||
"--network=host"
|
"-v" "$PLANTCTL_PROJECT_DIR:$PLANTCTL_PROJECT_DIR:rw"
|
||||||
"--pid=host"
|
|
||||||
"-v" "$PWD:$PWD:rw"
|
"-v" "$PWD:$PWD:rw"
|
||||||
"-w" "$PWD"
|
"-w" "$PWD"
|
||||||
)
|
)
|
||||||
@@ -22,8 +22,8 @@ declare -a PODMAN_ARGS=(
|
|||||||
|
|
||||||
if ! podman image exists "$CONTAINER_IMAGE"; then
|
if ! podman image exists "$CONTAINER_IMAGE"; then
|
||||||
#attempt to build container
|
#attempt to build container
|
||||||
"$CONTAINER_TOOLS_BASEDIR/build-wch-tools-container.sh" 1>&2 ||
|
"$CONTAINER_TOOLS_BASEDIR/build-esp-plant-dev-tools.sh" 1>&2 ||
|
||||||
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
|
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
podman run "${PODMAN_ARGS[@]}" --entrypoint riscv-none-elf-gdb-py3 "$CONTAINER_IMAGE" "$@"
|
podman run "${PODMAN_ARGS[@]}" --entrypoint npm "$CONTAINER_IMAGE" "$@"
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
CONTAINER_IMAGE="localhost/esp-plant-dev-tools:latest"
|
||||||
|
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
PLANTCTL_PROJECT_DIR="$(readlink -f "$CONTAINER_TOOLS_BASEDIR/..")"
|
||||||
|
|
||||||
|
function _fatal {
|
||||||
|
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
declare -a PODMAN_ARGS=(
|
||||||
|
"--rm" "-i" "--log-driver=none"
|
||||||
|
"-v" "$PLANTCTL_PROJECT_DIR:$PLANTCTL_PROJECT_DIR:rw"
|
||||||
|
"-v" "$PWD:$PWD:rw"
|
||||||
|
"-w" "$PWD"
|
||||||
|
)
|
||||||
|
|
||||||
|
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
|
||||||
|
|
||||||
|
if ! podman image exists "$CONTAINER_IMAGE"; then
|
||||||
|
#attempt to build container
|
||||||
|
"$CONTAINER_TOOLS_BASEDIR/build-esp-plant-dev-tools.sh" 1>&2 ||
|
||||||
|
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman run "${PODMAN_ARGS[@]}" --entrypoint npx "$CONTAINER_IMAGE" "$@"
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
CONTAINER_IMAGE="localhost/esp-plant-dev-tools:latest"
|
||||||
|
CONTAINER_TOOLS_BASEDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
PLANTCTL_PROJECT_DIR="$(readlink -f "$CONTAINER_TOOLS_BASEDIR/..")"
|
||||||
|
|
||||||
|
function _fatal {
|
||||||
|
echo -e "\e[31mERROR\e[0m $(</dev/stdin)$*" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
declare -a PODMAN_ARGS=(
|
||||||
|
"--rm" "-i" "--log-driver=none"
|
||||||
|
"-v" "$PLANTCTL_PROJECT_DIR:$PLANTCTL_PROJECT_DIR:rw"
|
||||||
|
"-v" "$PWD:$PWD:rw"
|
||||||
|
"-w" "$PWD"
|
||||||
|
)
|
||||||
|
|
||||||
|
[[ -t 1 ]] && PODMAN_ARGS+=("-t")
|
||||||
|
|
||||||
|
if ! podman image exists "$CONTAINER_IMAGE"; then
|
||||||
|
#attempt to build container
|
||||||
|
"$CONTAINER_TOOLS_BASEDIR/build-esp-plant-dev-tools.sh" 1>&2 ||
|
||||||
|
_fatal "faild to build local image, cannot continue! … please ensure you have an internet connection"
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman run "${PODMAN_ARGS[@]}" --entrypoint riscv-none-elf-gcc "$CONTAINER_IMAGE" "$@"
|
||||||
@@ -34,5 +34,3 @@ _autosave-*
|
|||||||
|
|
||||||
# Autorouter files (exported from Pcbnew)
|
# Autorouter files (exported from Pcbnew)
|
||||||
fp-info-cache
|
fp-info-cache
|
||||||
*.zip
|
|
||||||
netlist.ipc
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"EXTRA_LAYERS": "", "ALL_ACTIVE_LAYERS": false, "EXTEND_EDGE_CUT": false, "ALTERNATIVE_EDGE_CUT": false, "AUTO TRANSLATE": true, "AUTO FILL": true, "EXCLUDE DNP": false}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
(fp_lib_table
|
|
||||||
(version 7)
|
|
||||||
(lib (name "Sensor")(type "KiCad")(uri "/home/empire/workspace/PlantCtrl/board/modules/Sensors/Sensors/Sensor.pretty")(options "")(descr ""))
|
|
||||||
)
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
P CODE 00
|
|
||||||
P UNITS CUST 0
|
|
||||||
P arrayDim N
|
|
||||||
317GND VIA MD0118PA00X+040551Y-024902X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+054232Y-022933X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+053346Y-021949X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+040846Y-019980X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+041043Y-025787X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+040059Y-019980X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+044291Y-025787X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+046654Y-025000X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+041240Y-021949X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+043307Y-020768X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+039961Y-022539X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+049606Y-021260X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+043898Y-024803X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+044587Y-023917X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+041142Y-024016X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+052461Y-022835X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+053642Y-024016X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+047835Y-026378X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+042618Y-020669X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+049409Y-022047X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+042520Y-022441X0236Y0000R000S3
|
|
||||||
317GND VIA MD0118PA00X+048622Y-022835X0236Y0000R000S3
|
|
||||||
327GND R_slop-1 A01X+053967Y-020177X0315Y0374R180S2
|
|
||||||
327NET-(U1-RS) R_slop-2 A01X+053317Y-020177X0315Y0374R180S2
|
|
||||||
3173_3V U6 -1 D0394PA00X+039016Y-019370X0669Y0669R000S0
|
|
||||||
317(U6-VBAT-PAD2) U6 -2 D0394PA00X+039016Y-020370X0669Y0000R000S0
|
|
||||||
317-(U6-SDA-PAD3) U6 -3 D0394PA00X+039016Y-021370X0669Y0000R000S0
|
|
||||||
317-(U6-SCL-PAD4) U6 -4 D0394PA00X+039016Y-022370X0669Y0000R000S0
|
|
||||||
317ENABLE_CAN U6 -5 D0394PA00X+039016Y-023370X0669Y0000R000S0
|
|
||||||
317CAN+ U6 -6 D0394PA00X+039016Y-024370X0669Y0000R000S0
|
|
||||||
317CAN- U6 -7 D0394PA00X+039016Y-025370X0669Y0000R000S0
|
|
||||||
317GND U6 -8 D0394PA00X+039016Y-026370X0669Y0000R000S0
|
|
||||||
317GND U6 -9 D0394PA00X+071260Y-034252X0669Y0669R000S0
|
|
||||||
317GND U6 -10 D0394PA00X+055512Y-031299X0669Y0669R000S0
|
|
||||||
317GND U6 -11 D0394PA00X+038780Y-034252X0669Y0669R000S0
|
|
||||||
317GND U6 -12 D0394PA00X+055512Y-020669X0669Y0669R000S0
|
|
||||||
317GND U6 -13 D0394PA00X+071260Y-019094X0669Y0669R000S0
|
|
||||||
327NET-(QP_1-G) QP_1 -1 A01X+047835Y-021280X0354Y0315R000S2
|
|
||||||
3273_3V QP_1 -2 A01X+047835Y-022028X0354Y0315R000S2
|
|
||||||
327CAN_POWER QP_1 -3 A01X+048622Y-021654X0354Y0315R000S2
|
|
||||||
327CAN_POWER R5 -1 A01X+047835Y-022904X0315Y0374R090S2
|
|
||||||
327NET-(I1-A) R5 -2 A01X+047835Y-023553X0315Y0374R090S2
|
|
||||||
327NET-(QP_1-G) R6 -1 A01X+046654Y-021329X0315Y0374R090S2
|
|
||||||
3273_3V R6 -2 A01X+046654Y-021978X0315Y0374R090S2
|
|
||||||
327NET-(QP_1-G) R7 -1 A01X+045669Y-021329X0315Y0374R090S2
|
|
||||||
327NET-(Q1-D) R7 -2 A01X+045669Y-021978X0315Y0374R090S2
|
|
||||||
317CAN_POWER J1 -1 D0374PA00X+055197Y-025394X0669Y0768R270S0
|
|
||||||
317NET-(J1-PIN_2) J1 -2 D0374PA00X+055197Y-024409X0669Y0768R270S0
|
|
||||||
317NET-(J1-PIN_3) J1 -3 D0374PA00X+055197Y-023425X0669Y0768R270S0
|
|
||||||
317GND J1 -4 D0374PA00X+055197Y-022441X0669Y0768R270S0
|
|
||||||
327NET-(Q1-G) Q1 -1 A01X+043819Y-021280X0354Y0315R000S2
|
|
||||||
327GND Q1 -2 A01X+043819Y-022028X0354Y0315R000S2
|
|
||||||
327NET-(Q1-D) Q1 -3 A01X+044606Y-021654X0354Y0315R000S2
|
|
||||||
327CAN+ U1 -1 A01X+050295Y-020707X0768Y0236R000S2
|
|
||||||
327GND U1 -2 A01X+050295Y-021207X0768Y0236R000S2
|
|
||||||
327CAN_POWER U1 -3 A01X+050295Y-021707X0768Y0236R000S2
|
|
||||||
327CAN- U1 -4 A01X+050295Y-022207X0768Y0236R000S2
|
|
||||||
327(U1-VREF-PAD5) U1 -5 A01X+052244Y-022207X0768Y0236R000S2
|
|
||||||
327NET-(J1-PIN_2) U1 -6 A01X+052244Y-021707X0768Y0236R000S2
|
|
||||||
327NET-(J1-PIN_3) U1 -7 A01X+052244Y-021207X0768Y0236R000S2
|
|
||||||
327NET-(U1-RS) U1 -8 A01X+052244Y-020707X0768Y0236R000S2
|
|
||||||
327NET-(Q1-G) R8 -1 A01X+042520Y-021329X0315Y0374R090S2
|
|
||||||
327GND R8 -2 A01X+042520Y-021978X0315Y0374R090S2
|
|
||||||
327GND I1 -1 A01X+047835Y-025541X0384Y0551R270S2
|
|
||||||
327NET-(I1-A) I1 -2 A01X+047835Y-024803X0384Y0551R270S2
|
|
||||||
327NET-(Q1-G) R4 -1 A01X+040846Y-023346X0315Y0374R180S2
|
|
||||||
327ENABLE_CAN R4 -2 A01X+040197Y-023346X0315Y0374R180S2
|
|
||||||
999
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
;;; .doomrc --- doom runtime config -*- mode: emacs-lisp; lexical-binding: t; -*-
|
|
||||||
;;; Commentary:
|
|
||||||
;;; Code:
|
|
||||||
(require 'doom) ; be silent, byte-compiler
|
|
||||||
|
|
||||||
(after! dape
|
|
||||||
(add-to-list
|
|
||||||
'dape-configs
|
|
||||||
`(gdb-dap-openocd
|
|
||||||
ensure (lambda (config)
|
|
||||||
(dape-ensure-command config)
|
|
||||||
(let* ((default-directory
|
|
||||||
(or (dape-config-get config 'command-cwd)
|
|
||||||
default-directory))
|
|
||||||
(command (dape-config-get config 'command))
|
|
||||||
(output (shell-command-to-string (format "%s --version" command)))
|
|
||||||
(version (save-match-data
|
|
||||||
(when (string-match "GNU gdb \\(?:(.*) \\)?\\([0-9.]+\\)" output)
|
|
||||||
(string-to-number (match-string 1 output))))))
|
|
||||||
(unless (>= version 14.1)
|
|
||||||
(user-error "Requires gdb version >= 14.1"))))
|
|
||||||
modes ()
|
|
||||||
command-cwd dape-command-cwd
|
|
||||||
command "gdb"
|
|
||||||
command-args ("--interpreter=dap")
|
|
||||||
:request nil
|
|
||||||
:program nil
|
|
||||||
:args []
|
|
||||||
:stopAtBeginningOfMainSubprogram nil))
|
|
||||||
)
|
|
||||||
|
|
||||||
;;; .doomrc ends here
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="EMPTY_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# ESP-IDF build artifacts
|
|
||||||
build/
|
|
||||||
.sdkconfig*
|
|
||||||
CMakeFiles/
|
|
||||||
CMakeCache.txt
|
|
||||||
cmake-build-*/
|
|
||||||
*.log
|
|
||||||
*.bin
|
|
||||||
*.elf
|
|
||||||
*.map
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="EMPTY_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/bootloader.iml" filepath="$PROJECT_DIR$/.idea/bootloader.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-7
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
<mapping directory="$PROJECT_DIR$/../website/themes/blowfish" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
# Minimal ESP-IDF project to build only the bootloader
|
|
||||||
# You must have ESP-IDF installed and IDF_PATH exported.
|
|
||||||
|
|
||||||
# Pin the target to ESP32-C6 to ensure correct bootloader build
|
|
||||||
# (must be set before including project.cmake)
|
|
||||||
set(IDF_TARGET "esp32c6")
|
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
||||||
project(custom_bootloader)
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
Custom ESP-IDF Bootloader (Rollback Enabled)
|
|
||||||
|
|
||||||
This minimal project builds a custom ESP-IDF bootloader with rollback support enabled.
|
|
||||||
You can flash it later alongside a Rust firmware using `espflash`.
|
|
||||||
|
|
||||||
What this provides
|
|
||||||
- A minimal ESP-IDF project (CMake) that can build just the bootloader.
|
|
||||||
- Rollback support enabled via sdkconfig.defaults (CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y).
|
|
||||||
- A sample OTA partition table (partitions.csv) suitable for OTA and rollback (otadata + two OTA slots).
|
|
||||||
- A convenience script to build the bootloader for the desired target.
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
- ESP-IDF installed and set up (IDF_PATH exported, Python env activated).
|
|
||||||
- A selected target (esp32, esp32s3, esp32c3, etc.).
|
|
||||||
|
|
||||||
Build
|
|
||||||
1) Ensure ESP-IDF is set up:
|
|
||||||
source "$IDF_PATH/export.sh"
|
|
||||||
|
|
||||||
2) Pick a target (examples):
|
|
||||||
idf.py set-target esp32
|
|
||||||
# or use the script:
|
|
||||||
./build_bootloader.sh esp32
|
|
||||||
|
|
||||||
3) Build only the bootloader:
|
|
||||||
idf.py bootloader
|
|
||||||
# or using the script (which also supports setting target):
|
|
||||||
./build_bootloader.sh esp32
|
|
||||||
|
|
||||||
Artifacts
|
|
||||||
- build/bootloader/bootloader.bin
|
|
||||||
|
|
||||||
Using with espflash (Rust)
|
|
||||||
- For a no_std Rust firmware, you can pass this custom bootloader to espflash:
|
|
||||||
espflash flash --bootloader build/bootloader/bootloader.bin \
|
|
||||||
--partition-table partitions.csv \
|
|
||||||
<your-app-binary-or-elf>
|
|
||||||
|
|
||||||
Notes
|
|
||||||
- Rollback logic requires an OTA layout (otadata + at least two OTA app partitions). The provided partitions.csv is a starting point; adjust sizes/offsets to match your needs.
|
|
||||||
- This project doesn’t build an application; it exists solely to produce a bootloader with the right configuration.
|
|
||||||
- If you need different log verbosity or features, run `idf.py menuconfig` and then diff/port the changes back into sdkconfig.defaults.
|
|
||||||
- Targets supported depend on your ESP-IDF version. Use `idf.py set-target <chip>` or `./build_bootloader.sh <chip>`.
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Build script for custom ESP-IDF bootloader with rollback enabled.
|
|
||||||
# Requirements:
|
|
||||||
# - ESP-IDF installed
|
|
||||||
# - IDF_PATH exported
|
|
||||||
# - Python env prepared (the usual ESP-IDF setup)
|
|
||||||
# Usage:
|
|
||||||
# ./build_bootloader.sh [esp32|esp32s3|esp32c3|esp32s2|esp32c2|esp32c6|esp32h2]
|
|
||||||
# If target is omitted, the last configured target will be used.
|
|
||||||
|
|
||||||
TARGET=${1:-}
|
|
||||||
|
|
||||||
if [[ -z "${IDF_PATH:-}" ]]; then
|
|
||||||
echo "ERROR: IDF_PATH is not set. Please install ESP-IDF and export the environment (source export.sh)." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$IDF_PATH/export.sh"
|
|
||||||
|
|
||||||
if [[ -n "$TARGET" ]]; then
|
|
||||||
idf.py set-target "$TARGET"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure sdkconfig.defaults is considered (ESP-IDF does this automatically).
|
|
||||||
# Build only the bootloader.
|
|
||||||
idf.py bootloader
|
|
||||||
|
|
||||||
echo
|
|
||||||
BOOTLOADER_BIN="build/bootloader/bootloader.bin"
|
|
||||||
if [[ -f "$BOOTLOADER_BIN" ]]; then
|
|
||||||
echo "Bootloader built: $BOOTLOADER_BIN"
|
|
||||||
echo "You can use this with espflash via:"
|
|
||||||
echo " espflash flash --bootloader $BOOTLOADER_BIN [--partition-table partitions.csv] <your-app-binary>"
|
|
||||||
else
|
|
||||||
echo "ERROR: Bootloader binary not found. Check build logs above." >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
cp build/bootloader/bootloader.bin ../rust/bootloader.bin
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
idf_component_register(SRCS "dummy.c" INCLUDE_DIRS ".")
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// This file intentionally left almost empty.
|
|
||||||
// ESP-IDF expects at least one component; the bootloader build does not use this.
|
|
||||||
|
|
||||||
void __unused_dummy_symbol(void) {}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
nvs, data, nvs, , 16k,
|
|
||||||
otadata, data, ota, , 8k,
|
|
||||||
phy_init, data, phy, , 4k,
|
|
||||||
ota_0, app, ota_0, , 3968k,
|
|
||||||
ota_1, app, ota_1, , 3968k,
|
|
||||||
storage, data, littlefs,, 8M,
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
|||||||
# Target can be set with: idf.py set-target esp32|esp32s3|esp32c3|...
|
|
||||||
# If not set via idf.py, ESP-IDF may default to a target; it's recommended to set it explicitly.
|
|
||||||
|
|
||||||
# Explicitly pin target to ESP32-C6
|
|
||||||
CONFIG_IDF_TARGET="esp32c6"
|
|
||||||
CONFIG_IDF_TARGET_ESP32C6=y
|
|
||||||
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
|
||||||
|
|
||||||
# Bootloader configuration
|
|
||||||
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
|
||||||
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
|
|
||||||
# Slightly faster boot by skipping GPIO checks unless you need that feature
|
|
||||||
CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=y
|
|
||||||
|
|
||||||
# Partition table config is not required to build bootloader, but shown for clarity when you build full app later
|
|
||||||
# CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
||||||
# CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ rustflags = [
|
|||||||
target = "riscv32imac-unknown-none-elf"
|
target = "riscv32imac-unknown-none-elf"
|
||||||
|
|
||||||
[target.riscv32imac-unknown-none-elf]
|
[target.riscv32imac-unknown-none-elf]
|
||||||
#runner = "espflash flash --monitor --bootloader bootloader.bin --chip esp32c6 --baud 921600 --partition-table partitions.csv"
|
runner = "espflash flash --monitor --chip esp32c6 --baud 921600 --partition-table partitions.csv"
|
||||||
#runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv -b no-reset" # Select this runner in case of usb ttl
|
#runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv -b no-reset" # Select this runner in case of usb ttl
|
||||||
#runner = "espflash flash --monitor"
|
#runner = "espflash flash --monitor"
|
||||||
#runner = "cargo runner"
|
#runner = "cargo runner"
|
||||||
|
|||||||
Generated
+2931
File diff suppressed because it is too large
Load Diff
+44
-80
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "plant-ctrl2"
|
name = "plant-ctrl2"
|
||||||
@@ -13,6 +14,19 @@ test = false
|
|||||||
bench = false
|
bench = false
|
||||||
doc = false
|
doc = false
|
||||||
|
|
||||||
|
[package.metadata.cargo_runner]
|
||||||
|
# The string `$TARGET_FILE` will be replaced with the path from cargo.
|
||||||
|
command = [
|
||||||
|
"cargo",
|
||||||
|
"espflash",
|
||||||
|
"save-image",
|
||||||
|
"--chip",
|
||||||
|
"esp32c6",
|
||||||
|
"image.bin",
|
||||||
|
"--partition-table",
|
||||||
|
"partitions.csv"
|
||||||
|
]
|
||||||
|
|
||||||
#this strips the bootloader, we need that tho
|
#this strips the bootloader, we need that tho
|
||||||
#strip = true
|
#strip = true
|
||||||
|
|
||||||
@@ -37,82 +51,44 @@ partition_table = "partitions.csv"
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Shared CAN API
|
|
||||||
canapi = { path = "canapi" }
|
|
||||||
#ESP stuff
|
#ESP stuff
|
||||||
esp-bootloader-esp-idf = { version = "0.2.0", features = ["esp32c6"] }
|
log = "0.4.28"
|
||||||
esp-hal = { version = "=1.0.0-rc.0", features = [
|
esp-bootloader-esp-idf = { version = "0.5.0", features = ["esp32c6", "log-04"] }
|
||||||
"esp32c6",
|
esp-hal = { version = "1.1.0", features = ["esp32c6", "log-04"] }
|
||||||
"log-04",
|
esp-rtos = { version = "0.3.0", features = ["esp32c6", "embassy", "esp-radio"] }
|
||||||
"unstable",
|
esp-backtrace = { version = "0.19.0", features = ["esp32c6", "panic-handler", "println", "colors", "custom-halt"] }
|
||||||
"rt"
|
esp-println = { version = "0.17.0", features = ["esp32c6", "log-04", "auto"] }
|
||||||
] }
|
esp-storage = { version = "0.9.0", features = ["esp32c6"] }
|
||||||
log = "0.4.27"
|
esp-radio = { version = "0.18.0", features = ["esp32c6", "log-04", "wifi", "unstable"] }
|
||||||
|
esp-alloc = { version = "0.10.0", features = ["esp32c6", "internal-heap-stats"] }
|
||||||
|
|
||||||
embassy-net = { version = "0.7.1", default-features = false, features = [
|
# Async runtime (Embassy core)
|
||||||
"dhcpv4",
|
embassy-executor = { version = "0.10.0", features = ["log", "nightly"] }
|
||||||
"log",
|
embassy-time = { version = "0.5.1", features = ["log"], default-features = false }
|
||||||
"medium-ethernet",
|
embassy-sync = { version = "0.8.0", features = ["log"] }
|
||||||
"tcp",
|
|
||||||
"udp",
|
|
||||||
"proto-ipv4",
|
|
||||||
"dns"
|
|
||||||
] }
|
|
||||||
embedded-io = "0.6.1"
|
|
||||||
embedded-io-async = "0.6.1"
|
|
||||||
esp-alloc = "0.8.0"
|
|
||||||
esp-backtrace = { version = "0.17.0", features = [
|
|
||||||
"esp32c6",
|
|
||||||
"exception-handler",
|
|
||||||
"panic-handler",
|
|
||||||
"println",
|
|
||||||
"colors",
|
|
||||||
"custom-halt"
|
|
||||||
] }
|
|
||||||
esp-println = { version = "0.15.0", features = ["esp32c6", "log-04"] }
|
|
||||||
# for more networking protocol support see https://crates.io/crates/edge-net
|
|
||||||
embassy-executor = { version = "0.7.0", features = [
|
|
||||||
"log",
|
|
||||||
"task-arena-size-64",
|
|
||||||
"nightly"
|
|
||||||
] }
|
|
||||||
embassy-time = { version = "0.5.0", features = ["log"], default-features = false }
|
|
||||||
esp-hal-embassy = { version = "0.9.0", features = ["esp32c6", "log-04"] }
|
|
||||||
esp-storage = { version = "0.7.0", features = ["esp32c6"] }
|
|
||||||
|
|
||||||
esp-wifi = { version = "0.15.0", features = [
|
# Networking and protocol stacks
|
||||||
"builtin-scheduler",
|
embassy-net = { version = "0.8.0", features = ["dhcpv4", "log", "medium-ethernet", "tcp", "udp", "proto-ipv4", "dns", "proto-ipv6"] }
|
||||||
"esp-alloc",
|
sntpc = { version = "0.6.1", default-features = false, features = ["log", "embassy-socket", "embassy-socket-ipv6"] }
|
||||||
"esp32c6",
|
edge-dhcp = "0.7.0"
|
||||||
"log-04",
|
edge-nal = "0.6.0"
|
||||||
"smoltcp",
|
edge-nal-embassy = "0.8.1"
|
||||||
"wifi",
|
edge-http = { version = "0.7.0", features = ["log"] }
|
||||||
] }
|
|
||||||
smoltcp = { version = "0.12.0", default-features = false, features = [
|
esp32c6 = { version = "0.23.2" }
|
||||||
"alloc",
|
|
||||||
"log",
|
# Hardware abstraction traits and HAL adapters
|
||||||
"medium-ethernet",
|
|
||||||
"multicast",
|
|
||||||
"proto-dhcpv4",
|
|
||||||
"proto-ipv6",
|
|
||||||
"proto-dns",
|
|
||||||
"proto-ipv4",
|
|
||||||
"socket-dns",
|
|
||||||
"socket-icmp",
|
|
||||||
"socket-raw",
|
|
||||||
"socket-tcp",
|
|
||||||
"socket-udp",
|
|
||||||
] }
|
|
||||||
#static_cell = "2.1.1"
|
|
||||||
embedded-hal = "1.0.0"
|
embedded-hal = "1.0.0"
|
||||||
embedded-hal-bus = { version = "0.3.0" }
|
embedded-storage = "0.3.1"
|
||||||
|
embassy-embedded-hal = "0.6.0"
|
||||||
|
nb = "1.1.0"
|
||||||
|
|
||||||
#Hardware additional driver
|
#Hardware additional driver
|
||||||
|
|
||||||
#bq34z100 = { version = "0.3.0", default-features = false }
|
#bq34z100 = { version = "0.3.0", default-features = false }
|
||||||
|
lib-bms-protocol = { git = "https://gitea.wlandt.de/judge/ch32-bms.git", default-features = false }
|
||||||
onewire = "0.4.0"
|
onewire = "0.4.0"
|
||||||
#strum = { version = "0.27.0", default-feature = false, features = ["derive"] }
|
#strum = { version = "0.27.0", default-feature = false, features = ["derive"] }
|
||||||
measurements = "0.11.0"
|
|
||||||
ds323x = "0.6.0"
|
ds323x = "0.6.0"
|
||||||
|
|
||||||
#json
|
#json
|
||||||
@@ -127,35 +103,23 @@ strum_macros = "0.27.0"
|
|||||||
unit-enum = "1.4.1"
|
unit-enum = "1.4.1"
|
||||||
pca9535 = { version = "2.0.0" }
|
pca9535 = { version = "2.0.0" }
|
||||||
ina219 = { version = "0.2.0" }
|
ina219 = { version = "0.2.0" }
|
||||||
embedded-storage = "=0.3.1"
|
|
||||||
portable-atomic = "1.11.1"
|
portable-atomic = "1.11.1"
|
||||||
embassy-sync = { version = "0.7.2", features = ["log"] }
|
|
||||||
async-trait = "0.1.89"
|
async-trait = "0.1.89"
|
||||||
bq34z100 = { version = "0.4.0", default-features = false }
|
bq34z100 = { version = "0.4.0", default-features = false }
|
||||||
edge-dhcp = "0.6.0"
|
|
||||||
edge-nal = "0.5.0"
|
|
||||||
edge-nal-embassy = "0.6.0"
|
|
||||||
static_cell = "2.1.1"
|
static_cell = "2.1.1"
|
||||||
edge-http = { version = "0.6.1", features = ["log"] }
|
|
||||||
littlefs2 = { version = "0.6.1", features = ["c-stubs", "alloc"] }
|
littlefs2 = { version = "0.6.1", features = ["c-stubs", "alloc"] }
|
||||||
littlefs2-core = "0.1.1"
|
littlefs2-core = "0.1.1"
|
||||||
bytemuck = { version = "1.23.2", features = ["derive", "min_const_generics", "pod_saturating", "extern_crate_alloc"] }
|
bytemuck = { version = "1.23.2", features = ["derive", "min_const_generics", "pod_saturating", "extern_crate_alloc"] }
|
||||||
deranged = "0.5.3"
|
deranged = "0.5.3"
|
||||||
embassy-embedded-hal = "0.5.0"
|
|
||||||
bincode = { version = "2.0.1", default-features = false, features = ["derive"] }
|
bincode = { version = "2.0.1", default-features = false, features = ["derive"] }
|
||||||
sntpc = { version = "0.6.0", default-features = false, features = ["log", "embassy-socket", "embassy-socket-ipv6"] }
|
|
||||||
option-lock = { version = "0.3.1", default-features = false }
|
option-lock = { version = "0.3.1", default-features = false }
|
||||||
|
measurements = "0.11.1"
|
||||||
#stay in sync with mcutie version here!
|
|
||||||
heapless = { version = "0.7.17", features = ["serde"] }
|
heapless = { version = "0.7.17", features = ["serde"] }
|
||||||
mcutie = { version = "0.3.0", default-features = false, features = ["log", "homeassistant"] }
|
mcutie = { path = "./src/mcutie_3_0_0/", default-features = false, features = ["log"] }
|
||||||
nb = "1.1.0"
|
|
||||||
embedded-can = "0.4.1"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
mcutie = { git = 'https://github.com/empirephoenix/mcutie.git' }
|
|
||||||
#bq34z100 = { path = "../../bq34z100_rust" }
|
#bq34z100 = { path = "../../bq34z100_rust" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
+20
-10
@@ -1,12 +1,22 @@
|
|||||||
rm ./src/webserver/index.html.gz
|
#!/usr/bin/env bash
|
||||||
rm ./src/webserver/bundle.js.gz
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
cd ./src_webpack/
|
|
||||||
npx webpack build
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
cp index.html.gz ../src/webserver/index.html.gz
|
|
||||||
cp bundle.js.gz ../src/webserver/bundle.js.gz
|
"${SCRIPT_DIR}/build_website.sh"
|
||||||
cd ../
|
|
||||||
|
|
||||||
cargo build --release
|
cargo build --release
|
||||||
espflash save-image --bootloader bootloader.bin --partition-table partitions.csv --chip esp32c6 target/riscv32imac-unknown-none-elf/release/plant-ctrl2 image.bin
|
espflash save-image \
|
||||||
espflash flash --monitor --bootloader bootloader.bin --chip esp32c6 --baud 921600 --partition-table partitions.csv target/riscv32imac-unknown-none-elf/release/plant-ctrl2
|
--bootloader "${SCRIPT_DIR}/bootloader.bin" \
|
||||||
|
--partition-table "${SCRIPT_DIR}/partitions.csv" \
|
||||||
|
--chip esp32c6 \
|
||||||
|
target/riscv32imac-unknown-none-elf/release/plant-ctrl2 \
|
||||||
|
"${SCRIPT_DIR}/image.bin"
|
||||||
|
|
||||||
|
espflash flash --monitor \
|
||||||
|
--bootloader "${SCRIPT_DIR}/bootloader.bin" \
|
||||||
|
--chip esp32c6 \
|
||||||
|
--baud 921600 \
|
||||||
|
--partition-table "${SCRIPT_DIR}/partitions.csv" \
|
||||||
|
target/riscv32imac-unknown-none-elf/release/plant-ctrl2
|
||||||
|
|||||||
Binary file not shown.
@@ -49,5 +49,8 @@ fn linker_be_nice() {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
linker_be_nice();
|
linker_be_nice();
|
||||||
|
// Non-existent path causes Cargo to always re-run this script,
|
||||||
|
// keeping VERGEN_BUILD_TIMESTAMP fresh on every build.
|
||||||
|
println!("cargo:rerun-if-changed=ALWAYS_REBUILD_SENTINEL");
|
||||||
let _ = EmitBuilder::builder().all_git().all_build().emit();
|
let _ = EmitBuilder::builder().all_git().all_build().emit();
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WEBPACK_DIR="${SCRIPT_DIR}/src_webpack"
|
||||||
|
WEBSERVER_DIR="${SCRIPT_DIR}/src/webserver"
|
||||||
|
|
||||||
|
rm -f "${WEBSERVER_DIR}/index.html.gz"
|
||||||
|
rm -f "${WEBSERVER_DIR}/bundle.js.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/index.html.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/bundle.js.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/index.html"
|
||||||
|
rm -f "${WEBPACK_DIR}/bundle.js"
|
||||||
|
|
||||||
|
pushd "${WEBPACK_DIR}"
|
||||||
|
npm install
|
||||||
|
npx webpack build
|
||||||
|
cp index.html.gz "${WEBSERVER_DIR}/index.html.gz"
|
||||||
|
cp bundle.js.gz "${WEBSERVER_DIR}/bundle.js.gz"
|
||||||
|
popd
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "canapi"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "canapi"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = []
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bincode = { version = "2.0.1", default-features = false, features = ["derive"] }
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
#![no_std]
|
|
||||||
//! CAN bus API shared crate for PlantCtrl sensors and controller.
|
|
||||||
//! Addressing and messages are defined here to be reused by all bus participants.
|
|
||||||
|
|
||||||
use bincode::{Decode, Encode};
|
|
||||||
|
|
||||||
/// Total plants supported by addressing (0..=15)
|
|
||||||
pub const MAX_PLANTS: u8 = 16;
|
|
||||||
|
|
||||||
/// Sensors per plant: 0..=1 => A/B
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
|
||||||
#[repr(u8)]
|
|
||||||
pub enum SensorSlot {
|
|
||||||
A = 0,
|
|
||||||
B = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SensorSlot {
|
|
||||||
pub const fn from_index(idx: u8) -> Option<Self> {
|
|
||||||
match idx {
|
|
||||||
0 => Some(SensorSlot::A),
|
|
||||||
1 => Some(SensorSlot::B),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Legacy sensor base address kept for compatibility with existing code.
|
|
||||||
/// Each plant uses SENSOR_BASE_ADDRESS + plant_index (0..PLANT_COUNT-1).
|
|
||||||
/// 11-bit standard ID space, safe range.
|
|
||||||
pub const SENSOR_BASE_ADDRESS: u16 = 1000;
|
|
||||||
|
|
||||||
/// Typed topics within the SENSOR_BASE space.
|
|
||||||
/// Additional offsets allow distinct message semantics while keeping plant-indexed layout.
|
|
||||||
pub mod id {
|
|
||||||
use crate::{SensorSlot, MAX_PLANTS, SENSOR_BASE_ADDRESS};
|
|
||||||
|
|
||||||
/// Number of plants addressable per sensor slot group
|
|
||||||
pub const PLANTS_PER_GROUP: u16 = MAX_PLANTS as u16; // 16
|
|
||||||
/// Offset applied for SensorSlot::B within a message group
|
|
||||||
pub const B_OFFSET: u16 = PLANTS_PER_GROUP; // 16
|
|
||||||
|
|
||||||
// Message group base offsets relative to SENSOR_BASE_ADDRESS
|
|
||||||
pub const MOISTURE_DATA_OFFSET: u16 = 0; // periodic data from sensor (sensor -> controller)
|
|
||||||
pub const IDENTIFY_CMD_OFFSET: u16 = 32; // identify LED command (controller -> sensor)
|
|
||||||
|
|
||||||
// Convenience constants for per-slot base offsets
|
|
||||||
pub const IDENTIFY_CMD_OFFSET_A: u16 = IDENTIFY_CMD_OFFSET + 0;
|
|
||||||
pub const IDENTIFY_CMD_OFFSET_B: u16 = IDENTIFY_CMD_OFFSET + B_OFFSET;
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub const fn plant_id(message_type_offset: u16, sensor: SensorSlot, plant: u16) -> u16 {
|
|
||||||
match sensor {
|
|
||||||
SensorSlot::A => SENSOR_BASE_ADDRESS + message_type_offset + plant,
|
|
||||||
SensorSlot::B => SENSOR_BASE_ADDRESS + message_type_offset + B_OFFSET + plant,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Kinds of message spaces recognized by the addressing scheme.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum MessageKind {
|
|
||||||
MoistureData, // sensor -> controller
|
|
||||||
IdentifyCmd, // controller -> sensor
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Try to classify a received 11-bit standard ID into a known message kind and extract plant and sensor slot.
|
|
||||||
/// Returns (kind, plant, slot) on success.
|
|
||||||
#[inline]
|
|
||||||
pub const fn classify(id: u16) -> Option<(MessageKind, u8, SensorSlot)> {
|
|
||||||
// Ensure the ID is within our base space
|
|
||||||
if id < SENSOR_BASE_ADDRESS {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let rel = id - SENSOR_BASE_ADDRESS;
|
|
||||||
|
|
||||||
// Helper: decode within a given group offset
|
|
||||||
const fn decode_in_group(rel: u16, group_base: u16) -> Option<(u8, SensorSlot)> {
|
|
||||||
if rel < group_base { return None; }
|
|
||||||
let inner = rel - group_base;
|
|
||||||
if inner < PLANTS_PER_GROUP { // A slot
|
|
||||||
Some((inner as u8, SensorSlot::A))
|
|
||||||
} else if inner >= B_OFFSET && inner < B_OFFSET + PLANTS_PER_GROUP { // B slot
|
|
||||||
Some(((inner - B_OFFSET) as u8, SensorSlot::B))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check known groups in order
|
|
||||||
if let Some((plant, slot)) = decode_in_group(rel, MOISTURE_DATA_OFFSET) {
|
|
||||||
return Some((MessageKind::MoistureData, plant, slot));
|
|
||||||
}
|
|
||||||
if let Some((plant, slot)) = decode_in_group(rel, IDENTIFY_CMD_OFFSET) {
|
|
||||||
return Some((MessageKind::IdentifyCmd, plant, slot));
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns Some((plant, slot)) regardless of message kind, if the id falls into any known group; otherwise None.
|
|
||||||
#[inline]
|
|
||||||
pub const fn extract_plant_slot(id: u16) -> Option<(u8, SensorSlot)> {
|
|
||||||
match classify(id) {
|
|
||||||
Some((_kind, plant, slot)) => Some((plant, slot)),
|
|
||||||
None => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if an id corresponds exactly to the given message kind, plant and slot.
|
|
||||||
#[inline]
|
|
||||||
pub const fn is_identify_for(id: u16, plant: u8, slot: SensorSlot) -> bool {
|
|
||||||
id == plant_id(IDENTIFY_CMD_OFFSET, slot, plant as u16)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub const fn is_moisture_data_for(id: u16, plant: u8, slot: SensorSlot) -> bool {
|
|
||||||
id == plant_id(MOISTURE_DATA_OFFSET, slot, plant as u16)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Periodic moisture data sent by sensors.
|
|
||||||
/// Fits into 5 bytes with bincode-v2 (no varint): u8 + u8 + u16 = 4, alignment may keep 4.
|
|
||||||
#[derive(Debug, Clone, Copy, Encode, Decode)]
|
|
||||||
pub struct MoistureData {
|
|
||||||
pub plant: u8, // 0..MAX_PLANTS-1
|
|
||||||
pub sensor: SensorSlot, // A/B
|
|
||||||
pub hz: u16, // measured frequency of moisture sensor
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Request a sensor to report immediately (controller -> sensor).
|
|
||||||
#[derive(Debug, Clone, Copy, Encode, Decode)]
|
|
||||||
pub struct MoistureRequest {
|
|
||||||
pub plant: u8,
|
|
||||||
pub sensor: SensorSlot, // target sensor (sensor filters by this)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Control a sensor's identify LED, if received by sensor, blink for a few seconds
|
|
||||||
#[derive(Debug, Clone, Copy, Encode, Decode)]
|
|
||||||
pub struct IdentifyLed {}
|
|
||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
cargo espflash erase-parts otadata --partition-table "${SCRIPT_DIR}/partitions.csv"
|
||||||
+13
-9
@@ -1,11 +1,15 @@
|
|||||||
rm ./src/webserver/index.html.gz
|
#!/usr/bin/env bash
|
||||||
rm ./src/webserver/bundle.js.gz
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
cd ./src_webpack/
|
|
||||||
npx webpack build
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
cp index.html.gz ../src/webserver/index.html.gz
|
|
||||||
cp bundle.js.gz ../src/webserver/bundle.js.gz
|
"${SCRIPT_DIR}/build_website.sh"
|
||||||
cd ../
|
|
||||||
|
|
||||||
cargo build --release
|
cargo build --release
|
||||||
espflash flash --monitor --bootloader bootloader.bin --chip esp32c6 --baud 921600 --partition-table partitions.csv target/riscv32imac-unknown-none-elf/release/plant-ctrl2
|
espflash flash --monitor \
|
||||||
|
--bootloader "${SCRIPT_DIR}/bootloader.bin" \
|
||||||
|
--chip esp32c6 \
|
||||||
|
--baud 921600 \
|
||||||
|
--partition-table "${SCRIPT_DIR}/partitions.csv" \
|
||||||
|
target/riscv32imac-unknown-none-elf/release/plant-ctrl2
|
||||||
|
|||||||
+15
-11
@@ -1,13 +1,17 @@
|
|||||||
rm image.bin
|
#!/usr/bin/env bash
|
||||||
rm ./src/webserver/index.html.gz
|
|
||||||
rm ./src/webserver/bundle.js.gz
|
set -euo pipefail
|
||||||
set -e
|
|
||||||
cd ./src_webpack/
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
npx webpack build
|
|
||||||
cp index.html.gz ../src/webserver/index.html.gz
|
rm -f "${SCRIPT_DIR}/image.bin"
|
||||||
cp bundle.js.gz ../src/webserver/bundle.js.gz
|
|
||||||
cd ../
|
"${SCRIPT_DIR}/build_website.sh"
|
||||||
|
|
||||||
set -e
|
|
||||||
cargo build --release
|
cargo build --release
|
||||||
espflash save-image --bootloader bootloader.bin --partition-table partitions.csv --chip esp32c6 target/riscv32imac-unknown-none-elf/release/plant-ctrl2 image.bin
|
espflash save-image \
|
||||||
|
--bootloader "${SCRIPT_DIR}/bootloader.bin" \
|
||||||
|
--partition-table "${SCRIPT_DIR}/partitions.csv" \
|
||||||
|
--chip esp32c6 \
|
||||||
|
target/riscv32imac-unknown-none-elf/release/plant-ctrl2 \
|
||||||
|
"${SCRIPT_DIR}/image.bin"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user