diff --git a/.github/workflows/compile_development.yml b/.github/workflows/compile_development.yml new file mode 100644 index 00000000..838293b4 --- /dev/null +++ b/.github/workflows/compile_development.yml @@ -0,0 +1,58 @@ +name: Ahoy Dev-Build for ESP8266/ESP32 + +on: + push: + branches: development* + paths-ignore: + - '**.md' # Do no build on *.md changes +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + ref: development02 + - uses: benjlevesque/short-sha@v1.2 + id: short-sha + with: + length: 7 + - name: cache-pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: cache-platformio + uses: actions/cache@v3 + with: + path: ~/.platformio + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - name: setup-python + uses: actions/setup-python@v3 + - name: install-platformio + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + - name: update-html + working-directory: tools/esp8266/html + run: python convert.py + - name: Run PlatformIO + run: pio run -d tools/esp8266 --environment esp8266-release --environment esp32-wroom32-release + - name: rename-binary-files + id: rename-binary-files + working-directory: tools/esp8266/scripts + run: python getVersion.py + - name: set-version + uses: cschleiden/replace-tokens@v1 + with: + files: tools/esp8266/User_Manual.md + env: + VERSION: ${{ steps.rename-binary-files.outputs.name }} + - name: create-artifact + run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip tools/esp8266/.pio/build/out/* tools/esp8266/User_Manual.md + - uses: actions/upload-artifact@v3 + with: + name: ${{ steps.rename-binary-files.outputs.name }}_dev_build + path: ./${{ steps.rename-binary-files.outputs.name }}.zip diff --git a/tools/esp8266/.gitignore b/tools/esp8266/.gitignore index 89cc49cb..3e881135 100644 --- a/tools/esp8266/.gitignore +++ b/tools/esp8266/.gitignore @@ -3,3 +3,4 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +config_override.h diff --git a/tools/esp8266/README.md b/tools/esp8266/README.md index 0cece43f..37da7770 100644 --- a/tools/esp8266/README.md +++ b/tools/esp8266/README.md @@ -34,9 +34,11 @@ This code can be compiled using Visual Studio Code and **PlatformIO** Addon. The ### Optional Configuration before compilation - number of supported inverters (set to 3 by default) `config.h` -- DTU radio id `hmRadio.h` (default = 1234567801 +- DTU radio id `config.h` (default = 1234567801) - unformated list in webbrowser `/livedata` `config.h`, `LIVEDATA_VISUALIZED` +Alternativly, instead of modifying `config.h`, `config_override_example.h` can be copied to `config_override.h` and customized. +config_override.h is excluded from version control and stays local. ## Flash ESP with firmware @@ -87,20 +89,21 @@ The serial console will print the converted values which were read out of the in ## Todo's [See this post](https://github.com/grindylow/ahoy/issues/142) -- [ ] Wechsel zu AsyncWebServer und ElegantOTA für Stabilität +- [ ] Wechsel zu AsyncWebServer und ElegantOTA für Stabilität - [x] klarer Scheduler / Task manager, der ggf. den Receive Task priorisieren kann -- [x] Device Info Kommandos (Firmware Version, etc.) über das Dashboard anzeigen [Device Information ( `0x15` `REQ_ARW_DAT_ALL` ) SubCmd Kommandos #145](https://github.com/grindylow/ahoy/issues/145) +- [x] Device Info Kommandos (Firmware Version, etc.) über das Dashboard anzeigen [Device Information ( `0x15` `REQ_ARW_DAT_ALL` ) SubCmd Kommandos #145](https://github.com/grindylow/ahoy/issues/145) - [ ] AlarmData & AlarmUpdate Parsen und auf eigener Seite darstellen ------------------ SWIM LANE --------------------------- -- [ ] Device Control Kommandos aus dem Setup ermöglichen (TurnOn, TurnOff, Restart, ActivePower Limit, ReactivePower Limit, SetPowerFactor, etc.) +- HM300 +- [ ] Device Control Kommandos aus dem Setup ermöglichen (TurnOn, TurnOff, Restart, ActivePower Limit, ReactivePower Limit, SetPowerFactor, etc.) - [ ] Settings exportieren / importieren (API/UI) - [ ] Settings in settings.ini speichern (LittleFS statt EEPROM) [Settings in settings.ini speichern (LittleFS statt EEPROM) #164](https://github.com/grindylow/ahoy/issues/164) -- [ ] Homepage aufräumen nur ein Status (aktuell drei AJAX Calls /uptime, /time, /cmdstat) -- [ ] app.cpp aufräumen und in hmRadio / hmProtokollGen3 auslagern -- [ ] MI Wechselrichter unterstützen (miSystem, miInverter, miDefines, miProtokollGen2 etc.) -- [ ] nRF24 Interrupt Handling sinnvoll oder warum macht die nRF24 Bibliothek ständig `0x07` Statusabfragen [NRF24 polling trotz aktiviertem IRQ #83](https://github.com/grindylow/ahoy/issues/83) -- [ ] Debug Level im Setup änderbar -auch Livedata Visualisierung abschalten ? +- [ ] Homepage aufräumen nur ein Status (aktuell drei AJAX Calls /uptime, /time, /cmdstat) +- [ ] app.cpp aufräumen und in hmRadio / hmProtokollGen3 auslagern +- [ ] MI Wechselrichter unterstützen (miSystem, miInverter, miDefines, miProtokollGen2 etc.) +- [ ] nRF24 Interrupt Handling sinnvoll oder warum macht die nRF24 Bibliothek ständig `0x07` Statusabfragen [NRF24 polling trotz aktiviertem IRQ #83](https://github.com/grindylow/ahoy/issues/83) +- [ ] Debug Level im Setup änderbar -auch Livedata Visualisierung abschalten ? - [ ] MQTT Discovery (HomeAssistant) im Setup optional machen -- [x] MQTT Subscribe nur beim Reconnect [Das subscribe in der Reconnect Procedure sollte doch nur nach einem conect ausgeführt werden und nicht bei jedem Duchlauf #139](https://github.com/grindylow/ahoy/issues/139) +- [x] MQTT Subscribe nur beim Reconnect [Das subscribe in der Reconnect Procedure sollte doch nur nach einem conect ausgeführt werden und nicht bei jedem Duchlauf #139](https://github.com/grindylow/ahoy/issues/139) diff --git a/tools/esp8266/config.h b/tools/esp8266/config.h index 8331c273..e27a2e09 100644 --- a/tools/esp8266/config.h +++ b/tools/esp8266/config.h @@ -36,6 +36,9 @@ #define DEF_RF24_CE_PIN 2 #define DEF_RF24_IRQ_PIN 0 +// default radio ID +#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL) + // default NRF24 power, possible values (0 - 3) #define DEF_AMPLIFIERPOWER 2 @@ -96,4 +99,8 @@ // changes the style of "/setup" page, visualized = nicer #define LIVEDATA_VISUALIZED +#if __has_include("config_override.h") + #include "config_override.h" +#endif + #endif /*__CONFIG_H__*/ diff --git a/tools/esp8266/config_override_example.h b/tools/esp8266/config_override_example.h new file mode 100644 index 00000000..dbaf54df --- /dev/null +++ b/tools/esp8266/config_override_example.h @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778 +// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +//----------------------------------------------------------------------------- + +#ifndef __CONFIG_OVERRIDE_H__ +#define __CONFIG_OVERRIDE_H__ + +// override fallback WiFi info + +// each ovveride must be preceeded with an #undef statement +#undef FB_WIFI_SSID +#define FB_WIFI_SSID "MY_SSID" + +// each ovveride must be preceeded with an #undef statement +#undef FB_WIFI_PWD +#define FB_WIFI_PWD "MY_WIFI_KEY" + +// ESP32 default pinout +#undef DEF_RF24_CS_PIN +#define DEF_RF24_CS_PIN 5 +#undef DEF_RF24_CE_PIN +#define DEF_RF24_CE_PIN 4 +#undef DEF_RF24_IRQ_PIN +#define DEF_RF24_IRQ_PIN 16 + +#undef DTU_RADIO_ID +#define DTU_RADIO_ID ((uint64_t)0x1234567802ULL) + +#endif /*__CONFIG_OVERRIDE_H__*/ diff --git a/tools/esp8266/hmRadio.h b/tools/esp8266/hmRadio.h index de900218..c7fcf0e0 100644 --- a/tools/esp8266/hmRadio.h +++ b/tools/esp8266/hmRadio.h @@ -16,7 +16,6 @@ #define DEFAULT_RECV_CHANNEL 3 #define SPI_SPEED 1000000 -#define DTU_RADIO_ID ((uint64_t)0x1234567801ULL) #define DUMMY_RADIO_ID ((uint64_t)0xDEADBEEF01ULL) #define RF_CHANNELS 5 diff --git a/tools/esp8266/platformio.ini b/tools/esp8266/platformio.ini index 727b23ad..657cab44 100644 --- a/tools/esp8266/platformio.ini +++ b/tools/esp8266/platformio.ini @@ -14,9 +14,11 @@ src_dir = . [env] framework = arduino +build_flags = + -include "config.h" ; ;;;;; Possible Debug options ;;;;;; ; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level -;build_flags = -DDEBUG_ESP_PORT=Serial + ;-DDEBUG_ESP_PORT=Serial ;-DDEBUG_ESP_CORE ;-DDEBUG_ESP_WIFI ;-DDEBUG_ESP_HTTP_CLIENT