From c87c38fca4825af46fdd54539d403862bb2f25e2 Mon Sep 17 00:00:00 2001 From: andreas Date: Sat, 9 Sep 2023 17:11:32 +0200 Subject: [PATCH] revert back for chip id in app info --- lib/appinfo/GwAppInfo.h | 6 +----- post.py | 7 ++++++- src/main.cpp | 7 +++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/appinfo/GwAppInfo.h b/lib/appinfo/GwAppInfo.h index 79e4622..f7eb143 100644 --- a/lib/appinfo/GwAppInfo.h +++ b/lib/appinfo/GwAppInfo.h @@ -16,8 +16,4 @@ #endif #define FIRMWARE_TYPE GWSTRINGIFY(PIO_ENV_BUILD) -#ifdef PIO_ENV_BOARD -#define BOARD_INFO "@@" GWSTRINGIFY(PIO_ENV_BOARD) -#else -#define BOARD_INFO "" -#endif \ No newline at end of file +#define IDF_VERSION GWSTRINGIFY(ESP_IDF_VERSION_MAJOR) "." GWSTRINGIFY(ESP_IDF_VERSION_MINOR) "." GWSTRINGIFY(ESP_IDF_VERSION_PATCH) \ No newline at end of file diff --git a/post.py b/post.py index c85a740..8b04ffa 100644 --- a/post.py +++ b/post.py @@ -42,11 +42,16 @@ def post(source,target,env): 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)) + chip="esp32" uploadparts=uploaderflags.split(" ") #currently hardcoded last 8 parameters... if len(uploadparts) < 6: print("uploaderflags does not have enough parameter") return + for i in range(0,len(uploadparts)): + if uploadparts[i]=="--chip": + if i < (len(uploadparts) -1): + chip=uploadparts[i+1] uploadfiles=uploadparts[-6:] for i in range(1,len(uploadfiles),2): if not os.path.isfile(uploadfiles[i]): @@ -64,7 +69,7 @@ def post(source,target,env): versionedFile=os.path.join(outdir,"%s%s-update.bin"%(base,ofversion)) shutil.copyfile(firmware,versionedFile) outfile=os.path.join(outdir,"%s%s-all.bin"%(base,ofversion)) - cmd=[python,esptool,"--chip","esp32","merge_bin","--target-offset",offset,"-o",outfile] + cmd=[python,esptool,"--chip",chip,"merge_bin","--target-offset",offset,"-o",outfile] cmd+=uploadfiles cmd+=[appoffset,firmware] print("running %s"%" ".join(cmd)) diff --git a/src/main.cpp b/src/main.cpp index 96a5903..09b1b03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,7 +76,7 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting //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(BOARD_INFO) <= 32,"BOARD_INFO must not exceed 32 chars"); +CASSERT(strlen(IDF_VERSION) <= 32,"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 = { @@ -87,14 +87,13 @@ __attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = FIRMWARE_TYPE, "00:00:00", "2021/12/13", - BOARD_INFO, + IDF_VERSION, {}, {} }; String firmwareType(FIRMWARE_TYPE); -String chipType(BOARD_INFO); typedef std::map StringMap; @@ -387,7 +386,7 @@ protected: GwConfigHandler::toHex(base,buffer,bsize); status["salt"] = buffer; status["fwtype"]= firmwareType; - status["chiptype"]=chipType.substring(2); + status["chipid"]=CONFIG_IDF_FIRMWARE_CHIP_ID; status["heap"]=(long)xPortGetFreeHeapSize(); Nmea2kTwai::Status n2kState=NMEA2000.getStatus(); Nmea2kTwai::STATE driverState=n2kState.state;