From fd2fd206f007eebb716da338b00c35f23226c47e Mon Sep 17 00:00:00 2001 From: lumapu Date: Tue, 22 Aug 2023 00:35:00 +0200 Subject: [PATCH] 0.7.40 * added default pins for opendtu-fusion-v1 board * fixed hw version display in `live` * removed development builds, renamed environments in `platform.ini` --- .github/workflows/compile_development.yml | 4 +- .github/workflows/compile_release.yml | 4 +- scripts/getVersion.py | 18 ++-- src/CHANGES.md | 5 + src/config/config.h | 77 +++++++++++--- src/config/settings.h | 31 +++--- src/defines.h | 2 +- src/hm/hmDefines.h | 8 +- src/hm/hmRadio.h | 2 +- src/platformio.ini | 124 ++++++---------------- src/web/html/visualization.html | 4 +- src/web/web.h | 12 +-- 12 files changed, 141 insertions(+), 150 deletions(-) diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml index e010c4a7..49d9d713 100644 --- a/.github/workflows/compile_development.yml +++ b/.github/workflows/compile_development.yml @@ -47,10 +47,10 @@ jobs: run: python convert.py - name: Run PlatformIO - run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment esp32-wroom32-ethernet-release --environment opendtufusionv1-release + run: pio run -d src --environment esp8266 --environment esp8266-prometheus --environment esp8285 --environment esp32-wroom32 --environment esp32-wroom32-prometheus --environment esp32-wroom32-ethernet --environment opendtufusionv1 - name: Copy boot_app0.bin - run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1-release/ota.bin + run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1/ota.bin - name: Rename Binary files id: rename-binary-files diff --git a/.github/workflows/compile_release.yml b/.github/workflows/compile_release.yml index 96c7f28c..5d7078e2 100644 --- a/.github/workflows/compile_release.yml +++ b/.github/workflows/compile_release.yml @@ -51,10 +51,10 @@ jobs: run: python convert.py - name: Run PlatformIO - run: pio run -d src --environment esp8266-release --environment esp8266-release-prometheus --environment esp8285-release --environment esp32-wroom32-release --environment esp32-wroom32-release-prometheus --environment esp32-wroom32-ethernet-release --environment opendtufusionv1-release + run: pio run -d src --environment esp8266 --environment esp8266-prometheus --environment esp8285 --environment esp32-wroom32 --environment esp32-wroom32-prometheus --environment esp32-wroom32-ethernet --environment opendtufusionv1 - name: Copy boot_app0.bin - run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1-release/ota.bin + run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusionv1/ota.bin - name: Rename Binary files id: rename-binary-files diff --git a/scripts/getVersion.py b/scripts/getVersion.py index 11a76f62..9e6c90b7 100644 --- a/scripts/getVersion.py +++ b/scripts/getVersion.py @@ -54,50 +54,50 @@ def readVersion(path, infile): sha = os.getenv("SHA",default="sha") versionout = version[:-1] + "_" + sha + "_esp8266.bin" - src = path + ".pio/build/esp8266-release/firmware.bin" + src = path + ".pio/build/esp8266/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp8266_prometheus.bin" - src = path + ".pio/build/esp8266-release-prometheus/firmware.bin" + src = path + ".pio/build/esp8266-prometheus/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp8285.bin" - src = path + ".pio/build/esp8285-release/firmware.bin" + src = path + ".pio/build/esp8285/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) gzip_bin(dst, dst + ".gz") versionout = version[:-1] + "_" + sha + "_esp32.bin" - src = path + ".pio/build/esp32-wroom32-release/firmware.bin" + src = path + ".pio/build/esp32-wroom32/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp32_prometheus.bin" - src = path + ".pio/build/esp32-wroom32-release-prometheus/firmware.bin" + src = path + ".pio/build/esp32-wroom32-prometheus/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp32_ethernet.bin" - src = path + ".pio/build/esp32-wroom32-ethernet-release/firmware.bin" + src = path + ".pio/build/esp32-wroom32-ethernet/firmware.bin" dst = path + "firmware/" + versionout os.rename(src, dst) versionout = version[:-1] + "_" + sha + "_esp32s3.bin" - src = path + ".pio/build/opendtufusionv1-release/firmware.bin" + src = path + ".pio/build/opendtufusionv1/firmware.bin" dst = path + "firmware/s3/" + versionout os.rename(src, dst) # other ESP32 bin files - src = path + ".pio/build/esp32-wroom32-release/" + src = path + ".pio/build/esp32-wroom32/" dst = path + "firmware/" os.rename(src + "bootloader.bin", dst + "bootloader.bin") os.rename(src + "partitions.bin", dst + "partitions.bin") genOtaBin(path + "firmware/") # other ESP32S3 bin files - src = path + ".pio/build/opendtufusionv1-release/" + src = path + ".pio/build/opendtufusionv1/" dst = path + "firmware/s3/" os.rename(src + "bootloader.bin", dst + "bootloader.bin") os.rename(src + "partitions.bin", dst + "partitions.bin") diff --git a/src/CHANGES.md b/src/CHANGES.md index 83e4124d..c660a8da 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,10 @@ # Development Changes +## 0.7.40 - 2023-08-21 +* added default pins for opendtu-fusion-v1 board +* fixed hw version display in `live` +* removed development builds, renamed environments in `platform.ini` + ## 0.7.39 - 2023-08-21 * fix background color of invalid inputs * add hardware info (click in `live` on inverter name) diff --git a/src/config/config.h b/src/config/config.h index 5169edd3..397ad15a 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -7,6 +7,10 @@ #define __CONFIG_H__ +// globally used +#define DEF_PIN_OFF 255 + + //------------------------------------- // WIFI CONFIGURATION //------------------------------------- @@ -60,25 +64,66 @@ // for the ESP32-S3 there is no sane 'default', as it has full flexibility // to map its two HW SPIs anywhere and PCBs differ materially, // so it has to be selected in the Web UI - #define DEF_CS_PIN 5 - #define DEF_CE_PIN 17 - #define DEF_IRQ_PIN 16 - #define DEF_MISO_PIN 19 - #define DEF_MOSI_PIN 23 - #define DEF_SCLK_PIN 18 - - #define DEF_CMT_CSB 27 - #define DEF_CMT_FCSB 26 - #define DEF_CMT_IRQ 34 + #ifndef DEF_NRF_CS_PIN + #define DEF_NRF_CS_PIN 5 + #endif + #ifndef DEF_NRF_CE_PIN + #define DEF_NRF_CE_PIN 17 + #endif + #ifndef DEF_NRF_IRQ_PIN + #define DEF_NRF_IRQ_PIN 16 + #endif + #ifndef DEF_NRF_MISO_PIN + #define DEF_NRF_MISO_PIN 19 + #endif + #ifndef DEF_NRF_MOSI_PIN + #define DEF_NRF_MOSI_PIN 23 + #endif + #ifndef DEF_NRF_SCLK_PIN + #define DEF_NRF_SCLK_PIN 18 + #endif + + #ifndef DEF_CMT_CSB + #define DEF_CMT_CSB 27 + #endif + #ifndef DEF_CMT_FCSB + #define DEF_CMT_FCSB 26 + #endif + #ifndef DEF_CMT_IRQ + #define DEF_CMT_IRQ 34 + #endif #else - #define DEF_CS_PIN 15 - #define DEF_CE_PIN 0 - #define DEF_IRQ_PIN 2 + #ifndef DEF_NRF_CS_PIN + #define DEF_NRF_CS_PIN 15 + #endif + #ifndef DEF_NRF_CE_PIN + #define DEF_NRF_CE_PIN 0 + #endif + #ifndef DEF_NRF_IRQ_PIN + #define DEF_NRF_IRQ_PIN 2 + #endif // these are given to relay the correct values via API // they cannot actually be moved for ESP82xx models - #define DEF_MISO_PIN 12 - #define DEF_MOSI_PIN 13 - #define DEF_SCLK_PIN 14 + #ifndef DEF_NRF_MISO_PIN + #define DEF_NRF_MISO_PIN 12 + #endif + #ifndef DEF_NRF_MOSI_PIN + #define DEF_NRF_MOSI_PIN 13 + #endif + #ifndef DEF_NRF_SCLK_PIN + #define DEF_NRF_SCLK_PIN 14 + #endif +#endif +#ifndef DEF_LED0 + #define DEF_LED0 DEF_PIN_OFF +#endif +#ifndef DEF_LED1 + #define DEF_LED1 DEF_PIN_OFF +#endif +#ifdef LED_ACTIVE_HIGH + #define LED_HIGH_ACTIVE true +#else + #define LED_HIGH_ACTIVE false #endif // default NRF24 power, possible values (0 - 3) diff --git a/src/config/settings.h b/src/config/settings.h index fe1be71a..99da3265 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -29,7 +29,6 @@ * More info: * https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html#flash-layout * */ -#define DEF_PIN_OFF 255 #define PROT_MASK_INDEX 0x0001 @@ -385,12 +384,12 @@ class settings { mCfg.nrf.sendInterval = SEND_INTERVAL; mCfg.nrf.maxRetransPerPyld = DEF_MAX_RETRANS_PER_PYLD; - mCfg.nrf.pinCs = DEF_CS_PIN; - mCfg.nrf.pinCe = DEF_CE_PIN; - mCfg.nrf.pinIrq = DEF_IRQ_PIN; - mCfg.nrf.pinMiso = DEF_MISO_PIN; - mCfg.nrf.pinMosi = DEF_MOSI_PIN; - mCfg.nrf.pinSclk = DEF_SCLK_PIN; + mCfg.nrf.pinCs = DEF_NRF_CS_PIN; + mCfg.nrf.pinCe = DEF_NRF_CE_PIN; + mCfg.nrf.pinIrq = DEF_NRF_IRQ_PIN; + mCfg.nrf.pinMiso = DEF_NRF_MISO_PIN; + mCfg.nrf.pinMosi = DEF_NRF_MOSI_PIN; + mCfg.nrf.pinSclk = DEF_NRF_SCLK_PIN; mCfg.nrf.amplifierPower = DEF_AMPLIFIERPOWER & 0x03; mCfg.nrf.enabled = true; @@ -433,9 +432,9 @@ class settings { mCfg.inst.rstMaxValsMidNight = false; mCfg.inst.yieldEffiency = 0.955f; - mCfg.led.led0 = DEF_PIN_OFF; - mCfg.led.led1 = DEF_PIN_OFF; - mCfg.led.led_high_active = false; + mCfg.led.led0 = DEF_LED0; + mCfg.led.led1 = DEF_LED1; + mCfg.led.led_high_active = LED_HIGH_ACTIVE; memset(&mCfg.inst, 0, sizeof(cfgInst_t)); @@ -522,12 +521,12 @@ class settings { mCfg.nrf.enabled = (bool) obj[F("en")]; #endif if((obj[F("cs")] == obj[F("ce")])) { - mCfg.nrf.pinCs = DEF_CS_PIN; - mCfg.nrf.pinCe = DEF_CE_PIN; - mCfg.nrf.pinIrq = DEF_IRQ_PIN; - mCfg.nrf.pinSclk = DEF_SCLK_PIN; - mCfg.nrf.pinMosi = DEF_MOSI_PIN; - mCfg.nrf.pinMiso = DEF_MISO_PIN; + mCfg.nrf.pinCs = DEF_NRF_CS_PIN; + mCfg.nrf.pinCe = DEF_NRF_CE_PIN; + mCfg.nrf.pinIrq = DEF_NRF_IRQ_PIN; + mCfg.nrf.pinSclk = DEF_NRF_SCLK_PIN; + mCfg.nrf.pinMosi = DEF_NRF_MOSI_PIN; + mCfg.nrf.pinMiso = DEF_NRF_MISO_PIN; } } } diff --git a/src/defines.h b/src/defines.h index ffdcab75..f75c01af 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 39 +#define VERSION_PATCH 40 //------------------------------------- typedef struct { diff --git a/src/hm/hmDefines.h b/src/hm/hmDefines.h index a040d01b..3c63aa9e 100644 --- a/src/hm/hmDefines.h +++ b/src/hm/hmDefines.h @@ -268,11 +268,11 @@ const devInfo_t devInfo[] = { { 0x101020, 350 }, { 0x101030, 400 }, { 0x101040, 400 }, - { 0x101110, 600 }, + { 0x101110, 600 }, // [TSOL800(DE) ..20, HWv=??], [HM-600 ..20, HWv=2.66] { 0x101120, 700 }, { 0x101130, 800 }, { 0x101140, 800 }, - { 0x101210, 1200 }, + { 0x101210, 1200 }, // ..00 { 0x101230, 1500 }, // HMS @@ -287,12 +287,12 @@ const devInfo_t devInfo[] = { { 0x102241, 1600 }, { 0x101251, 1800 }, { 0x102251, 1800 }, - { 0x101271, 2000 }, + { 0x101271, 2000 }, // ..00 { 0x102271, 2000 }, // HMT { 0x103311, 1800 }, - { 0x103331, 2250 } + { 0x103331, 2250 } // ..00 }; #endif /*__HM_DEFINES_H__*/ diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index 07bb8c00..583479e8 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -27,7 +27,7 @@ const char* const rf24AmpPowerNames[] = {"MIN", "LOW", "HIGH", "MAX"}; //----------------------------------------------------------------------------- // HM Radio class //----------------------------------------------------------------------------- -template +template class HmRadio { public: HmRadio() : mNrf24(CE_PIN, CS_PIN, SPI_SPEED) { diff --git a/src/platformio.ini b/src/platformio.ini index 28c47783..50be00c4 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -32,125 +32,60 @@ lib_deps = https://github.com/JChristensen/Timezone @ ^1.2.4 olikraus/U8g2 @ ^2.34.17 zinggjm/GxEPD2 @ ^1.5.2 +build_flags = + -std=c++17 + -std=gnu++17 +build_unflags = + -std=gnu++11 -[env:esp8266-release] +[env:esp8266] platform = espressif8266 board = esp12e board_build.f_cpu = 80000000L -build_flags = - -D RELEASE - -std=gnu++17 +build_flags = ${env.build_flags} -DEMC_MIN_FREE_MEMORY=4096 ;-Wl,-Map,output.map monitor_filters = esp8266_exception_decoder -[env:esp8266-release-prometheus] +[env:esp8266-prometheus] platform = espressif8266 board = esp12e board_build.f_cpu = 80000000L -build_flags = - -D RELEASE - -std=gnu++17 +build_flags = ${env.build_flags} -DENABLE_PROMETHEUS_EP -DEMC_MIN_FREE_MEMORY=4096 monitor_filters = esp8266_exception_decoder -[env:esp8266-debug] -platform = espressif8266 -board = esp12e -board_build.f_cpu = 80000000L -build_flags = - -DDEBUG_LEVEL=DBG_DEBUG - -std=gnu++17 - -DEMC_MIN_FREE_MEMORY=4096 - -DDEBUG_ESP_CORE - -DDEBUG_ESP_WIFI - -DDEBUG_ESP_HTTP_CLIENT - -DDEBUG_ESP_HTTP_SERVER - -DDEBUG_ESP_OOM - -DDEBUG_ESP_PORT=Serial - -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 -build_type = debug -monitor_filters = - time ; Add timestamp with milliseconds for each new line - log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory - -[env:esp8285-release] +[env:esp8285] platform = espressif8266 board = esp8285 board_build.ldscript = eagle.flash.1m64.ld board_build.f_cpu = 80000000L -build_flags = - -D RELEASE - -std=gnu++17 +build_flags = ${env.build_flags} -DEMC_MIN_FREE_MEMORY=4096 monitor_filters = - time ; Add timestamp with milliseconds for each new line - -[env:esp8285-debug] -platform = espressif8266 -board = esp8285 -board_build.ldscript = eagle.flash.1m64.ld -board_build.f_cpu = 80000000L -build_flags = - -DDEBUG_LEVEL=DBG_DEBUG - -DEMC_MIN_FREE_MEMORY=4096 - -DDEBUG_ESP_CORE - -DDEBUG_ESP_WIFI - -DDEBUG_ESP_HTTP_CLIENT - -DDEBUG_ESP_HTTP_SERVER - -DDEBUG_ESP_OOM - -DDEBUG_ESP_PORT=Serial -build_type = debug -monitor_filters = - time ; Add timestamp with milliseconds for each new line - log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory + esp8266_exception_decoder -[env:esp32-wroom32-release] +[env:esp32-wroom32] platform = espressif32@6.1.0 board = lolin_d32 -build_flags = - -D RELEASE - -std=gnu++17 -build_unflags = -std=gnu++11 +build_flags = ${env.build_flags} monitor_filters = esp32_exception_decoder -[env:esp32-wroom32-release-prometheus] +[env:esp32-wroom32-prometheus] platform = espressif32@6.1.0 board = lolin_d32 -build_flags = - -D RELEASE - -std=gnu++17 +build_flags = ${env.build_flags} -DENABLE_PROMETHEUS_EP -build_unflags = -std=gnu++11 monitor_filters = esp32_exception_decoder -[env:esp32-wroom32-debug] -platform = espressif32@6.1.0 -board = lolin_d32 -build_flags = - -DDEBUG_LEVEL=DBG_DEBUG - -DDEBUG_ESP_CORE - -DDEBUG_ESP_WIFI - -DDEBUG_ESP_HTTP_CLIENT - -DDEBUG_ESP_HTTP_SERVER - -DDEBUG_ESP_OOM - -DDEBUG_ESP_PORT=Serial - -std=gnu++17 -build_unflags = -std=gnu++11 -build_type = debug -monitor_filters = - time ; Add timestamp with milliseconds for each new line - log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory - - -[env:esp32-wroom32-ethernet-release] +[env:esp32-wroom32-ethernet] platform = espressif32 board = esp32dev lib_deps = @@ -163,25 +98,32 @@ lib_deps = https://github.com/JChristensen/Timezone @ ^1.2.4 olikraus/U8g2 @ ^2.34.17 zinggjm/GxEPD2 @ ^1.5.2 -build_flags = +build_flags = ${env.build_flags} -D ETHERNET -DRELEASE -DLOG_LOCAL_LEVEL=ESP_LOG_INFO -DDEBUG_LEVEL=DBG_INFO - -std=gnu++17 -build_unflags = -std=gnu++11 monitor_filters = esp32_exception_decoder -[env:opendtufusionv1-release] +[env:opendtufusionv1] platform = espressif32@6.1.0 board = esp32-s3-devkitc-1 upload_protocol = esp-builtin debug_tool = esp-builtin debug_speed = 12000 -build_flags = - -D RELEASE - -std=gnu++17 -build_unflags = -std=gnu++11 +build_flags = ${env.build_flags} + -DDEF_NRF_CS_PIN=37 + -DDEF_NRF_CE_PIN=38 + -DDEF_NRF_IRQ_PIN=47 + -DDEF_NRF_MISO_PIN=48 + -DDEF_NRF_MOSI_PIN=35 + -DDEF_NRF_SCLK_PIN=36 + -DDEF_CMT_CSB=4 + -DDEF_CMT_FCSB=21 + -DDEF_CMT_IRQ=8 + -DDEF_LED0=17 + -DDEF_LED1=18 + -DLED_ACTIVE_HIGH monitor_filters = - time ; Add timestamp with milliseconds for each new line + esp32_exception_decoder diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index c7de12ff..0d72afac 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -276,7 +276,7 @@ ]), ml("tr", {}, [ ml("th", {}, "Hardware Version / Build"), - ml("td", {}, (obj.hw_ver.toString(16) / 100).toFixed(2) + " (build: " + String(obj.prod_cw) + "/" + String(obj.prod_year) + ")") + ml("td", {}, (obj.hw_ver/100).toFixed(2) + " (build: " + String(obj.prod_cw) + "/" + String(obj.prod_year) + ")") ]), ml("tr", {}, [ ml("th", {}, "Hardware Number"), @@ -284,7 +284,7 @@ ]), ml("tr", {}, [ ml("th", {}, "Bootloader Version"), - ml("td", {}, (obj.boot_ver / 100).toFixed(2)) + ml("td", {}, (obj.boot_ver/100).toFixed(2)) ]) ]) ]); diff --git a/src/web/web.h b/src/web/web.h index ae099656..aa3ad6f4 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -546,12 +546,12 @@ class Web { for (uint8_t i = 0; i < 12; i++) { pin = request->arg(String(pinArgNames[i])).toInt(); switch(i) { - case 0: mConfig->nrf.pinCs = ((pin != 0xff) ? pin : DEF_CS_PIN); break; - case 1: mConfig->nrf.pinCe = ((pin != 0xff) ? pin : DEF_CE_PIN); break; - case 2: mConfig->nrf.pinIrq = ((pin != 0xff) ? pin : DEF_IRQ_PIN); break; - case 3: mConfig->nrf.pinSclk = ((pin != 0xff) ? pin : DEF_SCLK_PIN); break; - case 4: mConfig->nrf.pinMosi = ((pin != 0xff) ? pin : DEF_MOSI_PIN); break; - case 5: mConfig->nrf.pinMiso = ((pin != 0xff) ? pin : DEF_MISO_PIN); break; + case 0: mConfig->nrf.pinCs = ((pin != 0xff) ? pin : DEF_NRF_CS_PIN); break; + case 1: mConfig->nrf.pinCe = ((pin != 0xff) ? pin : DEF_NRF_CE_PIN); break; + case 2: mConfig->nrf.pinIrq = ((pin != 0xff) ? pin : DEF_NRF_IRQ_PIN); break; + case 3: mConfig->nrf.pinSclk = ((pin != 0xff) ? pin : DEF_NRF_SCLK_PIN); break; + case 4: mConfig->nrf.pinMosi = ((pin != 0xff) ? pin : DEF_NRF_MOSI_PIN); break; + case 5: mConfig->nrf.pinMiso = ((pin != 0xff) ? pin : DEF_NRF_MISO_PIN); break; case 6: mConfig->led.led0 = pin; break; case 7: mConfig->led.led1 = pin; break; case 8: mConfig->led.led_high_active = pin; break; // this is not really a pin but a polarity, but handling it close to here makes sense