mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-02-11 07:03:07 +01:00
add buildname to cibuild, use the firmware name for file names
This commit is contained in:
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -62,5 +62,5 @@ jobs:
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: ${{ steps.version.outputs.version}}
|
||||
file: ./.pio/build/*/*-{all,update}.bin
|
||||
file: ./.pio/build/*/*${{ steps.version.outputs.version }}*-{all,update}.bin
|
||||
file_glob: true
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#define LOGLEVEL GwLog::DEBUG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GWBUILD_NAME
|
||||
#define FIRMWARE_TYPE GWSTRINGIFY(GWBUILD_NAME)
|
||||
#else
|
||||
#define FIRMWARE_TYPE GWSTRINGIFY(PIO_ENV_BUILD)
|
||||
#endif
|
||||
#define IDF_VERSION GWSTRINGIFY(ESP_IDF_VERSION_MAJOR) "." GWSTRINGIFY(ESP_IDF_VERSION_MINOR) "." GWSTRINGIFY(ESP_IDF_VERSION_PATCH)
|
||||
8
post.py
8
post.py
@@ -2,6 +2,7 @@ Import("env", "projenv")
|
||||
import os
|
||||
import glob
|
||||
import shutil
|
||||
import re
|
||||
|
||||
print("##post script running")
|
||||
HDROFFSET=288
|
||||
@@ -39,6 +40,7 @@ def post(source,target,env):
|
||||
appoffset=env.subst("$ESP32_APP_OFFSET")
|
||||
firmware=env.subst("$BUILD_DIR/${PROGNAME}.bin")
|
||||
(fwname,version)=getFirmwareInfo(firmware)
|
||||
fwname=re.sub(r"[^0-9A-Za-z_.-]*","",fwname)
|
||||
print("found fwname=%s, fwversion=%s"%(fwname,version))
|
||||
python=env.subst("$PYTHONEXE")
|
||||
print("base=%s,esptool=%s,appoffset=%s,uploaderflags=%s"%(base,esptool,appoffset,uploaderflags))
|
||||
@@ -70,10 +72,12 @@ def post(source,target,env):
|
||||
print("running %s"%" ".join(cmd))
|
||||
env.Execute(" ".join(cmd),"#testpost")
|
||||
ofversion="-"+version
|
||||
versionedFile=os.path.join(outdir,"%s%s-update.bin"%(base,ofversion))
|
||||
versionedFile=os.path.join(outdir,"%s%s-update.bin"%(fwname,ofversion))
|
||||
shutil.copyfile(firmware,versionedFile)
|
||||
versioneOutFile=os.path.join(outdir,"%s%s-all.bin"%(base,ofversion))
|
||||
print(f"wrote {versionedFile}")
|
||||
versioneOutFile=os.path.join(outdir,"%s%s-all.bin"%(fwname,ofversion))
|
||||
shutil.copyfile(outfile,versioneOutFile)
|
||||
print(f"wrote {versioneOutFile}")
|
||||
env.AddPostAction(
|
||||
"$BUILD_DIR/${PROGNAME}.bin",
|
||||
post
|
||||
|
||||
@@ -72,9 +72,9 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting
|
||||
#define MAX_NMEA2000_MESSAGE_SEASMART_SIZE 500
|
||||
#define MAX_NMEA0183_MESSAGE_SIZE MAX_NMEA2000_MESSAGE_SEASMART_SIZE
|
||||
//assert length of firmware name and version
|
||||
CASSERT(strlen(FIRMWARE_TYPE) <= 32, "environment name (FIRMWARE_TYPE) must not exceed 32 chars");
|
||||
CASSERT(strlen(VERSION) <= 32, "VERSION must not exceed 32 chars");
|
||||
CASSERT(strlen(IDF_VERSION) <= 32,"IDF_VERSION must not exceed 32 chars");
|
||||
CASSERT(strlen(FIRMWARE_TYPE) <= 31, "environment name (FIRMWARE_TYPE) must not exceed 32 chars");
|
||||
CASSERT(strlen(VERSION) <= 31, "VERSION must not exceed 32 chars");
|
||||
CASSERT(strlen(IDF_VERSION) <= 31,"IDF_VERSION must not exceed 32 chars");
|
||||
//https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/app_image_format.html
|
||||
//and removed the bugs in the doc...
|
||||
__attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = {
|
||||
|
||||
@@ -803,6 +803,13 @@ resources:
|
||||
|
||||
config:
|
||||
children:
|
||||
- type: string
|
||||
label: 'Build Name'
|
||||
key: buildname
|
||||
target: "define:GWBUILD_NAME"
|
||||
help: "Set a name to identify your build. Will also become the name for the generated files and the firmware type in the image. Max 31 characters."
|
||||
max: 31
|
||||
allowed: "0-9A-Za-z_-"
|
||||
- type: select
|
||||
target: environment
|
||||
label: 'Board'
|
||||
|
||||
@@ -234,7 +234,11 @@ class PipelineInfo{
|
||||
}
|
||||
const downloadConfig=()=>{
|
||||
let name=configName;
|
||||
if (isModified) name=name.replace(/[0-9]*$/,'')+formatDate(undefined,true);
|
||||
const buildname=config["root:buildname"]
|
||||
if (buildname && name != buildname){
|
||||
name+="-"+buildname+"-";
|
||||
}
|
||||
name=name.replace(/[0-9]*$/,'')+formatDate(undefined,true);
|
||||
name+=".json";
|
||||
fileDownload(JSON.stringify(config),name);
|
||||
}
|
||||
@@ -521,6 +525,34 @@ class PipelineInfo{
|
||||
addDescription(config,inputFrame);
|
||||
initialConfig=expandedValues[0];
|
||||
}
|
||||
if (config.type === 'string'){
|
||||
let ip=addEl('input','t'+config.type,inputFrame);
|
||||
addDescription(config,inputFrame);
|
||||
ip.value=current?current:"";
|
||||
ip.addEventListener('change',(ev)=>{
|
||||
let value=ev.target.value;
|
||||
let modified=false;
|
||||
if (config.max){
|
||||
if (value && value.length > config.max){
|
||||
modified=true;
|
||||
value=value.substring(0,config.max);
|
||||
}
|
||||
}
|
||||
if (config.allowed){
|
||||
let check=new RegExp("[^"+config.allowed+"]","g");
|
||||
let nv=value.replace(check,"");
|
||||
if (nv != value){
|
||||
modified=true;
|
||||
value=nv;
|
||||
}
|
||||
}
|
||||
if (modified){
|
||||
ev.target.value=value;
|
||||
}
|
||||
callback(Object.assign({},config,{key: value,value:value}),false);
|
||||
|
||||
});
|
||||
}
|
||||
let childFrame=addEl('div','childFrame',frame);
|
||||
if (initialConfig !== undefined){
|
||||
callback(initialConfig,true,childFrame);
|
||||
|
||||
Reference in New Issue
Block a user