diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml index e4f480041..d8a701534 100644 --- a/.github/workflows/pre_release.yml +++ b/.github/workflows/pre_release.yml @@ -38,15 +38,9 @@ jobs: sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts yarn build yarn webUI - - name: Build ESP32 4M firmware + - name: Build all target environments from default_envs run: | - platformio run -e ci - - name: Build ESP32-S3 16M firmware - run: | - platformio run -e ci_s3 - - name: Build ESP32 16M firmware - run: | - platformio run -e ci_16M + platformio run - name: Create GitHub Release id: 'automatic_releases' uses: 'marvinpinto/action-automatic-releases@latest' diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index 6602a717b..2ac1980ea 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -35,16 +35,10 @@ jobs: sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts yarn build yarn webUI - - name: Build ESP32 4M firmware + - name: Build all target environments from default_envs run: | - platformio run -e ci - - name: Build ESP32-S3 16M firmware - run: | - platformio run -e ci_s3 - - name: Build ESP32 16M firmware - run: | - platformio run -e ci_16M - - name: Release + platformio run + - name: Create GitHub Release uses: 'marvinpinto/action-automatic-releases@latest' with: repo_token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml index 39db0da86..4fdad6909 100644 --- a/.github/workflows/test_release.yml +++ b/.github/workflows/test_release.yml @@ -38,16 +38,10 @@ jobs: sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts yarn build yarn webUI - - name: Build ESP32 4M firmware + - name: Build all target environments from default_envs run: | - platformio run -e ci - - name: Build ESP32-S3 16M firmware - run: | - platformio run -e ci_s3 - - name: Build ESP32 16M firmware - run: | - platformio run -e ci_16M - - name: Create a GH Release + platformio run + - name: Create GitHub Release id: 'automatic_releases' uses: 'marvinpinto/action-automatic-releases@latest' with: diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index a11958fb5..dc060e860 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -55,3 +55,6 @@ - thermostat/remotetemp as command [#1835](https://github.com/emsesp/EMS-ESP32/discussions/1835) - temperaturesensor id notation with underscore [#1794](https://github.com/emsesp/EMS-ESP32/discussions/1794) - Change key-names in JSON to be compliant and consistent [#1860](https://github.com/emsesp/EMS-ESP32/issues/1860) +- Updates to webUI [#1920](https://github.com/emsesp/EMS-ESP32/issues/1920) +- Correct firmware naming #1933 [#1933](https://github.com/emsesp/EMS-ESP32/issues/1933) + \ No newline at end of file diff --git a/interface/src/app/main/validators.ts b/interface/src/app/main/validators.ts index 92bb00d15..520dbcbdb 100644 --- a/interface/src/app/main/validators.ts +++ b/interface/src/app/main/validators.ts @@ -136,30 +136,7 @@ export const createSettingsValidator = (settings: Settings) => rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATOR] }), ...(settings.board_profile === 'CUSTOM' && - settings.platform === 'ESP32R' && { - led_gpio: [ - { required: true, message: 'LED GPIO is required' }, - GPIO_VALIDATORR - ], - dallas_gpio: [ - { required: true, message: 'GPIO is required' }, - GPIO_VALIDATORR - ], - pbutton_gpio: [ - { required: true, message: 'Button GPIO is required' }, - GPIO_VALIDATORR - ], - tx_gpio: [ - { required: true, message: 'Tx GPIO is required' }, - GPIO_VALIDATORR - ], - rx_gpio: [ - { required: true, message: 'Rx GPIO is required' }, - GPIO_VALIDATORR - ] - }), - ...(settings.board_profile === 'CUSTOM' && - settings.platform === 'ESP32-C3' && { + settings.platform === 'ESP32C3' && { led_gpio: [ { required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORC3 @@ -182,7 +159,7 @@ export const createSettingsValidator = (settings: Settings) => ] }), ...(settings.board_profile === 'CUSTOM' && - settings.platform === 'ESP32-S2' && { + settings.platform === 'ESP32S2' && { led_gpio: [ { required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORS2 @@ -205,7 +182,7 @@ export const createSettingsValidator = (settings: Settings) => ] }), ...(settings.board_profile === 'CUSTOM' && - settings.platform === 'ESP32-S3' && { + settings.platform === 'ESP32S3' && { led_gpio: [ { required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORS3 @@ -487,15 +464,13 @@ export const analogSensorItemValidation = ( ], g: [ { required: true, message: 'GPIO is required' }, - platform === 'ESP32-S3' + platform === 'ESP32S3' ? GPIO_VALIDATORS3 - : platform === 'ESP32-S2' + : platform === 'ESP32S2' ? GPIO_VALIDATORS2 - : platform === 'ESP32-C3' + : platform === 'ESP32C3' ? GPIO_VALIDATORC3 - : platform === 'ESP32R' - ? GPIO_VALIDATORR - : GPIO_VALIDATOR, + : GPIO_VALIDATOR, ...(creating ? [isGPIOUniqueValidator(sensors)] : []) ] }); diff --git a/interface/src/app/settings/DownloadUpload.tsx b/interface/src/app/settings/DownloadUpload.tsx index 3ef8f7927..a26c0de07 100644 --- a/interface/src/app/settings/DownloadUpload.tsx +++ b/interface/src/app/settings/DownloadUpload.tsx @@ -90,9 +90,11 @@ const DownloadUpload = () => { // set immediate to false to avoid calling the API on page load and GH blocking while testing! const { data: latestVersion } = useRequest(getStableVersion, { immediate: true + // immediate: false }); const { data: latestDevVersion } = useRequest(getDevVersion, { immediate: true + // immediate: false }); const STABLE_URL = 'https://github.com/emsesp/EMS-ESP32/releases/download/'; @@ -104,21 +106,13 @@ const DownloadUpload = () => { 'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md'; const getBinURL = (v: string) => - 'EMS-ESP-' + - v.replaceAll('.', '_') + - '-' + - getPlatform().replaceAll('-', '_') + - '.bin'; + 'EMS-ESP-' + v.replaceAll('.', '_') + '-' + getPlatform() + '.bin'; const getPlatform = () => { - if ( - data.flash_chip_size >= 16384 && - data.esp_platform === 'ESP32' && - data.psram - ) { - return data.esp_platform + '-16M'; - } - return data.esp_platform; + return ( + [data.esp_platform, data.flash_chip_size >= 16384 ? '16MB' : '4MB'].join('-') + + (data.psram ? '+' : '') + ); }; const saveFile = (json: unknown, filename: string) => { diff --git a/interface/src/types/features.ts b/interface/src/types/features.ts index 5ae80def2..27041a2dc 100644 --- a/interface/src/types/features.ts +++ b/interface/src/types/features.ts @@ -1,4 +1,4 @@ export interface Features { version: string; - platform: string; // "ESP32-C3" "ESP32-S2" "ESP32-S3" "ESP32" + platform: string; // "ESP32C3" "ESP32S2" "ESP32S3" "ESP32" } diff --git a/mock-api/rest_server.ts b/mock-api/rest_server.ts index f5ebe5f40..8f97f42d1 100644 --- a/mock-api/rest_server.ts +++ b/mock-api/rest_server.ts @@ -369,29 +369,27 @@ const GENERATE_TOKEN_ENDPOINT = REST_ENDPOINT_ROOT + 'generateToken'; const hardware_status = { emsesp_version: '3.7-demo', - esp_platform: 'ESP32', - max_alloc_heap: 107, + esp_platform: 'ESP32S3', cpu_type: 'ESP32-S3', - cpu_rev: 3, + cpu_rev: 0, cpu_cores: 2, cpu_freq_mhz: 240, - free_heap: 166, - arduino_version: 'ESP32 Arduino v2.0.16', - sdk_version: 'v4.4.7', + max_alloc_heap: 191, + free_heap: 211, + arduino_version: 'ESP32 Arduino v2.0.17', + sdk_version: 'v4.4.7-dirty', partition: 'app0', - flash_chip_size: 4096, - flash_chip_speed: 40000000, - app_used: 1863, - app_free: 121, + flash_chip_size: 16384, + flash_chip_speed: 80000000, + app_used: 2258, + app_free: 3438, fs_used: 24, fs_free: 2024, - free_mem: 100, - psram: true, - // psram: false, - psram_size: 4093, - free_psram: 4074, + free_caps: 8376, + psram: 8189, + psram_size: 8189, + free_psram: 8166, has_loader: true, - free_caps: 4204, // model: '' model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)' }; @@ -671,7 +669,7 @@ let settings = { eth_power: 15, eth_phy_addr: 0, eth_clock_mode: 1, - platform: 'ESP32R', + platform: 'ESP32', modbus_enabled: false, modbus_port: 502, modbus_max_clients: 10, diff --git a/pio_local.ini_example b/pio_local.ini_example index 2283a7d4e..ddaf2118d 100644 --- a/pio_local.ini_example +++ b/pio_local.ini_example @@ -16,13 +16,12 @@ ; my_build_flags = -DEMSESP_DEBUG -DEMSESP_TEST -DEMSESP_PINGTEST [platformio] -; default_envs = esp32_4M -; default_envs = esp32_16M -default_envs = lolin_s3 -; default_envs = lolin_c3_mini +; default_envs = s_4M +; default_envs = s_16M_P ; BBQKees E32V2 +; default_envs = s3_16M ; BBQKees S3 +; default_envs = c3_mini_4M ; default_envs = native ; default_envs = debug -; default_envs = custom [env] ; upload settings @@ -31,7 +30,8 @@ default_envs = lolin_s3 ; upload_port = /dev/ttyUSB* ; for OTA add scripts/upload.py to extra_scripts upload_protocol = custom -custom_emsesp_ip = 10.10.10.175 +; custom_emsesp_ip = 10.10.10.175 +custom_emsesp_ip = 192.168.1.23 ; custom_emsesp_ip = ems-esp.local custom_username = admin custom_password = admin @@ -45,21 +45,21 @@ extra_scripts = ; pre:scripts/refresh_module_library_native.py post:scripts/run_native.py -[env:lolin_s3] +[env:s3_16M] extra_scripts = pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py scripts/upload.py -[env:esp32_16M] +[env:s_16M_P] extra_scripts = pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py -; scripts/upload.py + scripts/upload.py -[env:lolin_c3_mini] +[env:c3_mini_4M] extra_scripts = -; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time + pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py scripts/upload.py diff --git a/platformio.ini b/platformio.ini index fcd80b0e3..19326c0ae 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,12 +1,13 @@ ; PlatformIO Project Configuration File for EMS-ESP +; ; override any settings with your own local ones in pio_local.ini (see example pio_local.ini_example) +; The firmware is renamed following this convention, and placed in the build/firmware folder: +; EMS-ESP32---[+ if PSRAM onboard].bin +; For example: EMS-ESP-3_7_0-dev_31-esp32-16MB+.bin [platformio] -; default_envs = esp32_4M -default_envs = lolin_s3 -; default_envs = esp32_16M -; default_envs = native -; default_envs = espressi32_v3 +; build all the CI targets as default. Use pio_local.ini to override. +default_envs = ci_s_4M, ci_s_16M, ci_s_16M_P, ci_s3_16M_P extra_configs = factory_settings.ini @@ -16,10 +17,9 @@ extra_configs = core_build_flags = -std=gnu++2a -Isrc -Wno-type-limits -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-format core_unbuild_flags = -std=gnu++11 -; my_build_flags is set in pio_local.ini my_build_flags = -; explanation on some custom settings: +; explanation on these custom settings: ; CONFIG_ASYNC_TCP_QUEUE - see https://github.com/emsesp/EMS-ESP32/issues/177 ; CONFIG_ASYNC_TCP_STACK_SIZE - stack usage measured: ESP32: ~2.3K, ESP32S3: ~3.5k ; CONFIG_ASYNC_TCP_TASK_PRIORITY - default is 10, was 5 for EMS-ESP @@ -81,18 +81,44 @@ lib_ldf_mode = chain+ lib_deps = https://github.com/emsesp/EMS-ESP-Modules.git +; ; build for GitHub Actions CI +; ; the Web interface is built seperately, so is skipped in extra_scripts -[env:ci] -; 4MB using Tasmota (no SSL) - like BBQKees older S32 +; +[env:ci_s_4M] +; 4MB ESP32 - using Tasmota - no SSL, no PSRAM - like BBQKees older S32 extends = espressi32_base_tasmota extra_scripts = scripts/rename_fw.py board = esp32dev board_build.partitions = esp32_partition_4M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM +build_flags = + ${espressi32_base_tasmota.build_flags} + '-DEMSESP_DEFAULT_BOARD_PROFILE="S32"' -[env:ci_s3] -; 16MB ESP32-S3 - like BBQKees S3 +[env:ci_s_16M] +; 16MB ESP32 - no PSRAM - like some of the older BBQKees S32 +extends = espressi32_base +extra_scripts = scripts/rename_fw.py +board = esp32dev +board_build.partitions = esp32_partition_16M.csv +build_flags = + ${espressi32_base.build_flags} + '-DEMSESP_DEFAULT_BOARD_PROFILE="S32"' + +[env:ci_s_16M_P] +; 16MB ESP32 - with PSRAM - like BBQKees E32V2 +extends = espressi32_base +extra_scripts = scripts/rename_fw.py +board = esp32dev +board_build.partitions = esp32_partition_16M.csv +board_build.extra_flags = -DBOARD_HAS_PSRAM +build_flags = + ${espressi32_base.build_flags} + '-DEMSESP_DEFAULT_BOARD_PROFILE="E32V2"' + +[env:ci_s3_16M_P] +; 16MB ESP32-S3 - with PSRAM - like BBQKees S3 extends = espressi32_base extra_scripts = scripts/rename_fw.py board = lolin_s3 @@ -104,20 +130,11 @@ build_flags = ${espressi32_base.build_flags} '-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"' -[env:ci_16M] -; 16MB ESP32 with PSRAM - like BBQKees E32V2 -extends = espressi32_base -extra_scripts = scripts/rename_fw.py -board = esp32dev -board_build.partitions = esp32_partition_16M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM -build_flags = - ${espressi32_base.build_flags} - '-DEMSESP_DEFAULT_BOARD_PROFILE="E32V2"' - +; ; Direct builds +; -[env:esp32_4M] +[env:s_4M] extends = espressi32_base_tasmota board = esp32dev board_upload.flash_size = 4MB @@ -125,20 +142,20 @@ board_build.partitions = esp32_partition_4M.csv build_flags = ${espressi32_base_tasmota.build_flags} -[env:esp32_4Mplus] +[env:s_asym_4M] extends = espressi32_base_tasmota board = esp32dev board_upload.flash_size = 4MB board_build.partitions = esp32_asym_partition_4M.csv -[env:esp32_16M] +[env:s_16M_P] extends = espressi32_base board = esp32dev board_build.extra_flags = -DBOARD_HAS_PSRAM board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -[env:lolin_c3_mini] +[env:c3_mini_4M] extends = espressi32_base_tasmota board = lolin_c3_mini board_upload.flash_size = 4MB @@ -149,7 +166,7 @@ build_flags = ; lolin C3 mini v1 needs special wifi init. ; https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi -[env:lolin_c3_mini_v1] +[env:c3_miniv1_4M] extends = espressi32_base_tasmota board = lolin_c3_mini board_upload.flash_size = 4MB @@ -159,7 +176,7 @@ build_flags = -DBOARD_C3_MINI_V1 '-DEMSESP_DEFAULT_BOARD_PROFILE="C3MINI"' -[env:lolin_s2_mini] +[env:s2_4M] extends = espressi32_base_tasmota board = lolin_s2_mini board_upload.flash_size = 4MB @@ -168,7 +185,7 @@ build_flags = ${espressi32_base_tasmota.build_flags} '-DEMSESP_DEFAULT_BOARD_PROFILE="S2MINI"' -[env:lolin_s3] +[env:s3_16M] extends = espressi32_base board = lolin_s3 board_build.f_cpu = 240000000L @@ -180,7 +197,7 @@ build_flags = ${espressi32_base.build_flags} '-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"' -[env:esp32_s3_32M] +[env:s3_32M] extends = espressi32_base board = lolin_s3 board_build.f_cpu = 240000000L diff --git a/scripts/rename_fw.py b/scripts/rename_fw.py index 1e53fbfe5..6478d4e61 100755 --- a/scripts/rename_fw.py +++ b/scripts/rename_fw.py @@ -8,7 +8,7 @@ OUTPUT_DIR = "build{}".format(os.path.sep) def bin_copy(source, target, env): - # get the build info + # get the application version from version.h bag = {} exprs = [(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version')] with open('./src/version.h', 'r') as f: @@ -19,27 +19,48 @@ def bin_copy(source, target, env): bag[var] = m.group(1) app_version = bag.get('app_version') - platform = "ESP32" - chip_target = env.get('PIOENV').upper() - - # this breaks the CI so removed - # flash_size = env["PIOENV"].split('_')[1] - - # print(env.Dump()) - # my_flags = env.ParseFlags(env['BUILD_FLAGS']) - # defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")} - # print(my_flags) - # print(my_flags.get("CPPDEFINES") - + + # get the chip type, in uppercase + mcu = env.get('BOARD_MCU').upper() # alternatively take platform from the pio target # platform = str(target[0]).split(os.path.sep)[2] - - print("app version: " + app_version) - print("platform: " + platform) - print("chip_target: " + chip_target) + + # work out the flash memory from the PIO env name (sloppy but works) + # unfortunately the board_upload.flash_size is not passed down + flash_mem = "4MB" + pio_env = env.get('PIOENV').upper() + parts = pio_env.split('_') + # if it ends with a _P skip (we use this to denote PSRAM) + if parts[-1].endswith("P"): + index = -2 + else: + index = -1 + + # if doesn't have an M at the end + if parts[index].endswith("M"): + flash_mem = parts[index] + "B" + + # print(env.Dump()) + + # my_flags = env.ParseFlags(env['BUILD_FLAGS']) + # defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")} + + # find if BOARD_HAS_PSRAM is in the cppdefines + cppdefines = env.get("CPPDEFINES") + if 'BOARD_HAS_PSRAM' in cppdefines: + psram = True + else: + psram = False + + print("*********************************************") + print("EMS-ESP version: " + app_version) + print("Has PSRAM: "+str(psram)) + print("mcu: "+str(mcu)) + print("Flash Mem: " + flash_mem) # convert . to _ so Windows doesn't complain - variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + chip_target.replace("CI","ESP32") + # Format is EMS-ESP--- with + at the end if it has PSRAM + variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + mcu + "-" + flash_mem + ("+" if psram else "") # check if output directories exist and create if necessary if not os.path.isdir(OUTPUT_DIR): diff --git a/src/default_settings.h b/src/default_settings.h index 27ca6ef8f..f5824f462 100644 --- a/src/default_settings.h +++ b/src/default_settings.h @@ -274,11 +274,11 @@ enum { }; #if CONFIG_IDF_TARGET_ESP32C3 -#define EMSESP_PLATFORM "ESP32-C3" +#define EMSESP_PLATFORM "ESP32C3" #elif CONFIG_IDF_TARGET_ESP32S2 -#define EMSESP_PLATFORM "ESP32-S2" +#define EMSESP_PLATFORM "ESP32S2" #elif CONFIG_IDF_TARGET_ESP32S3 -#define EMSESP_PLATFORM "ESP32-S3" +#define EMSESP_PLATFORM "ESP32S3" #elif CONFIG_IDF_TARGET_ESP32 || EMSESP_STANDALONE #define EMSESP_PLATFORM "ESP32" #else diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index af89ab1ce..346330df4 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -142,8 +142,7 @@ void WebDataService::sensor_data(AsyncWebServerRequest * request) { } root["analog_enabled"] = EMSESP::analog_enabled(); - String platform = EMSESP_PLATFORM; - root["platform"] = (platform == "ESP32" && EMSESP::system_.PSram()) ? "ESP32R" : platform; + root["platform"] = EMSESP_PLATFORM; response->setLength(); request->send(response); diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index 054947c61..a3163bf72 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -75,8 +75,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) { root["eth_power"] = settings.eth_power; root["eth_phy_addr"] = settings.eth_phy_addr; root["eth_clock_mode"] = settings.eth_clock_mode; - String platform = EMSESP_PLATFORM; - root["platform"] = (platform == "ESP32" && EMSESP::system_.PSram()) ? "ESP32R" : platform; + root["platform"] = EMSESP_PLATFORM; root["modbus_enabled"] = settings.modbus_enabled; root["modbus_port"] = settings.modbus_port; root["modbus_max_clients"] = settings.modbus_max_clients; diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index dca2642fd..339cb5f87 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -46,7 +46,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { #endif #endif - root["esp_platform"] = EMSESP_PLATFORM; // from default_settings.h: ESP32, ESP32-C3, ESP32-S2, ESP32-S3 + root["esp_platform"] = EMSESP_PLATFORM; // from default_settings.h: ESP32, ESP32C3, ESP32S2, ESP32S3 root["status"] = EMSESP::bus_status(); // 0, 1 or 2 root["bus_uptime"] = EMSbus::bus_uptime(); root["num_devices"] = EMSESP::count_devices();