Skip to content

Commit 9dc17fe

Browse files
committed
fix monitoring ESP32-C3, fix github workflow
1 parent 6a6ff56 commit 9dc17fe

4 files changed

Lines changed: 25 additions & 26 deletions

File tree

.github/scripts/createManifest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
parser.add_argument('-s', '--build', type=str, help='Buildnummer der GithubAction (Unique ID)')
1111
parser.add_argument('-t', '--stage', type=str, help='Stage (Branch name)')
1212
parser.add_argument('-bp', '--binarypath', type=str, help='Path of binary files')
13+
parser.add_argument('-fn', '--firmwarename', type=str, help='Name of the firmware')
1314
parser.add_argument('-rp', '--releasepath', type=str, default="release", help='Path of destination, BIN and JSON files')
1415
parser.add_argument('-rf', '--releasefile', type=str, help='Path of release file, contains version number')
1516
parser.add_argument('-a', '--arch', type=str, help='Architecture (ESP8266|ESP32|ESP32-S2|ESP32-C3|...)')
@@ -26,6 +27,7 @@
2627
logging.info(f"BUILDNUMMER={args.build}")
2728
logging.info(f"STAGE={args.stage}")
2829
logging.info(f"BINARYPATH={args.binarypath}")
30+
logging.info(f"FIRMWARENAME={args.firmwarename}")
2931
logging.info(f"RELEASEPATH={args.releasepath}")
3032
logging.info(f"RELEASEFILE={args.releasefile}")
3133
logging.info(f"ARCHITECTURE={args.arch}")
@@ -57,9 +59,7 @@
5759
for file in files:
5860
if file == 'firmware.bin':
5961
FILENAME = os.path.splitext(file)[0]
60-
FILEEXT = os.path.splitext(file)[1][1:]
61-
FIRMWARENAME = args.binarypath.split(os.sep)[-2] # get the name of the firmware folder
62-
62+
FILEEXT = os.path.splitext(file)[1][1:]
6363
DOWNLOADURL = f"https://tobiasfaust.github.io/{args.repository}/firmware/{FILENAME}.{FileExtension}.{FILEEXT}"
6464

6565
################ Create custom json ##################
@@ -98,40 +98,40 @@
9898

9999
if os.path.isfile(os.path.join(args.binarypath, "merged-firmware.bin")):
100100
manifest_data["parts"].append({
101-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/merged-firmware.{FileExtension}.bin",
101+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/merged-firmware.{FileExtension}.bin",
102102
"offset": 0
103103
})
104104
else:
105105
# fuer ESP8266
106106
manifest_data["parts"].append({
107-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/{FILENAME}.{FileExtension}.{FILEEXT}",
107+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/{FILENAME}.{FileExtension}.{FILEEXT}",
108108
"offset": 0
109109
})
110110

111111
# process files.json
112112
if os.path.isfile(os.path.join(args.binarypath, "bootloader.bin")):
113113
files_data["parts"].append({
114-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/bootloader.{FileExtension}.bin",
114+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/bootloader.{FileExtension}.bin",
115115
"offset": 4096,
116116
"filetype": "bootloader"
117117
})
118118
if os.path.isfile(os.path.join(args.binarypath, "partitions.bin")):
119119
files_data["parts"].append({
120-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/partitions.{FileExtension}.bin",
120+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/partitions.{FileExtension}.bin",
121121
"offset": 32768,
122122
"filetype": "partitions"
123123
})
124124
if os.path.isfile(os.path.join(args.binarypath, "littlefs.bin")):
125125
files_data["parts"].append({
126-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/littlefs.{FileExtension}.bin",
126+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/littlefs.{FileExtension}.bin",
127127
"offset": int(readOffsetFromPartitionCSV("partitions.csv", "webdata"), 16),
128128
"filetype": "filesystem"
129129
})
130130

131131

132132
OFFSET = 0 if "ESP8266" in args.arch else int(readOffsetFromPartitionCSV("partitions.csv", "app0"), 16)
133133
files_data["parts"].append({
134-
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{FIRMWARENAME}/{FILENAME}.{FileExtension}.{FILEEXT}",
134+
"path": f"https://tobiasfaust.github.io/{args.repository}/firmware/{SubDir}/{args.firmwarename}/{FILENAME}.{FileExtension}.{FILEEXT}",
135135
"offset": OFFSET,
136136
"filetype": "firmware"
137137
})

.github/workflows/BuildAndDeploy.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ jobs:
6969
- name: Run PlatformIO
7070
id: buildFw
7171
run: |
72+
mkdir -p firmware/
7273
platformio run -e ${{ matrix.variant.firmware }}
74+
cp .pio/build/${{ matrix.variant.firmware }}/firmware.bin firmware/
75+
cp .pio/build/${{ matrix.variant.firmware }}/partitions.bin firmware/
76+
cp .pio/build/${{ matrix.variant.firmware }}/bootloader.bin firmware/
7377
if [ -d "data" ]; then
7478
platformio run --target buildfs -e ${{ matrix.variant.firmware }}
79+
cp .pio/build/${{ matrix.variant.firmware }}/littlefs.bin firmware/
7580
fi
7681
python .github/scripts/createMergedFirmware.py \
7782
--ChipFamily ${{ matrix.variant.architecture }} \
78-
--BuildDir .pio/build/${{ matrix.variant.firmware }} \
83+
--BuildDir firmware \
7984
--PathOfPartitionsCSV partitions.csv \
8085
>> "$GITHUB_OUTPUT"
8186
@@ -86,7 +91,7 @@ jobs:
8691
8792
- name: Display generated files
8893
run: |
89-
ls -R .pio/build/${{ matrix.variant.firmware }}/
94+
ls -R firmware/
9095
9196
- name: Schreibe Json/Manifest File
9297
id: json_params
@@ -97,7 +102,8 @@ jobs:
97102
--variant ${{ matrix.variant.subvariant }} \
98103
--stage ${{ env.BRANCH_NAME }} \
99104
--repository ${{ env.REPOSITORY }} \
100-
--binarypath .pio/build/${{ matrix.variant.firmware }}/ \
105+
--binarypath firmware/ \
106+
--firmwarename ${{ matrix.variant.firmware }} \
101107
--releasepath release \
102108
--artifactpath artifacts \
103109
--build ${{ github.run_number }} \
@@ -109,19 +115,6 @@ jobs:
109115
with:
110116
name: ${{ matrix.variant.firmware }}
111117
path: artifacts/*
112-
113-
# - name: Upload to AWS S3
114-
# uses: jakejarvis/s3-sync-action@master
115-
# with:
116-
# args: '--acl public-read --follow-symlinks'
117-
# env:
118-
# AWS_S3_BUCKET: 'tfa-releases'
119-
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
120-
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
121-
# AWS_REGION: 'eu-central-1' # optional: defaults to us-east-1
122-
# SOURCE_DIR: 'release' # optional: defaults to entire repository
123-
# DEST_DIR: ${{ env.REPOSITORY }}
124-
125118

126119
web-installer:
127120
needs: [build]

platformio.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ board = esp32-s3-devkitc-1
5757
[env:firmware_ESP32-C3]
5858
board = esp32-c3-devkitm-1
5959
build_flags = ${env.build_flags}
60+
-D ARDUINO_USB_MODE=1
61+
-D ARDUINO_USB_CDC_ON_BOOT=1
6062
-D DEFAULT_MODBUS_RX_PIN=6
6163
-D DEFAULT_MODBUS_TX_PIN=7

src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ void setup() {
5252

5353
Config = new BaseConfig(configFS);
5454

55-
Serial.begin(115200,
55+
#ifdef ARDUINO_USB_CDC_ON_BOOT
56+
Serial.begin(115200);
57+
#else
58+
Serial.begin(115200,
5659
SERIAL_8N1,
5760
Config->GetSerialRx(),
5861
Config->GetSerialTx()); // RX, TX, zb.: 33, 32
62+
#endif
5963
Serial.println("");
6064
Serial.println("ready");
6165

0 commit comments

Comments
 (0)