diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5cdbfc2..9b970b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,6 @@ on: "**/portal/**", "tools/**", "test/**", - ".github/workflows/website.yml", - ".github/workflows/dependabot.yml", - ".github/dependabot.yml", ".github/FUNDING.yml", ] pull_request: @@ -35,9 +32,6 @@ on: "**/portal/**", "tools/**", "test/**", - ".github/workflows/website.yml", - ".github/workflows/dependabot.yml", - ".github/dependabot.yml", ".github/FUNDING.yml", ] @@ -103,12 +97,17 @@ jobs: python -m pip install --upgrade pip pip install --upgrade platformio - - name: Get Envs + - name: Get Pro Envs id: envs run: | + repo="${{ github.repository }}" rm -f platformio_override.ini echo "pio_name=$(pio project config --json-output | jq -cr '.[0][1][0][1]')" >> $GITHUB_OUTPUT - echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][1][1]')" >> $GITHUB_OUTPUT + if [[ "$repo" == "mathieucarbou/YaSolR" ]]; then + echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][2][1]|split(",")')" >> $GITHUB_OUTPUT + else + echo "pio_default_envs=$(pio project config --json-output | jq -cr '.[0][1][3][1]|split(",")')" >> $GITHUB_OUTPUT + fi outputs: pio_name: ${{ steps.envs.outputs.pio_name }} @@ -123,11 +122,9 @@ jobs: environment: ${{ fromJSON(needs.pio_envs.outputs.pio_default_envs) }} steps: - name: Checkout - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/checkout@v4 - name: Get Tags - if: ${{ github.repository == 'mathieucarbou/YaSolR' }} run: git fetch --force --tags origin - name: Remove Pro Content @@ -140,16 +137,16 @@ jobs: lib/WebSerialLite \ site \ docs \ + TODO.md \ make-oss.sh - name: Remove OSS Content - if: ${{ startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} + if: ${{ startsWith(matrix.environment, 'pro-') }} run: | rm -f -r -v \ lib/ESPDASH - name: Cache PlatformIO - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/cache@v4 with: key: ${{ runner.os }}-pio @@ -165,20 +162,18 @@ jobs: path: .pio/libdeps - name: Cache YaSolR Pro - if: ${{ startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} + if: ${{ startsWith(matrix.environment, 'pro-') }} uses: actions/cache@v4 with: key: ${{ runner.os }}-YaSolR-pro path: .pio/libdeps - name: Python - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/setup-python@v5 with: python-version: "3.x" - name: Build - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} run: | python -m pip install --upgrade pip pip install --upgrade platformio @@ -189,7 +184,6 @@ jobs: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin ./${{ needs.pio_envs.outputs.pio_name }}-$ref-${{ matrix.environment }}.factory.bin - name: Upload - if: ${{ startsWith(matrix.environment, 'oss-') || startsWith(matrix.environment, 'pro-') && github.repository == 'mathieucarbou/YaSolR' }} uses: actions/upload-artifact@v4 with: name: ${{ matrix.environment }} @@ -199,7 +193,7 @@ jobs: release: name: Release - if: ${{ github.repository == 'mathieucarbou/YaSolR' && github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} + if: ${{ github.repository_owner == 'mathieucarbou' && github.event_name != 'pull_request' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} runs-on: ubuntu-latest needs: [cpplint, YaSolR] permissions: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 9bfaa93..6953aa8 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -28,7 +28,7 @@ jobs: source: ./site destination: ./site/_site - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 with: path: ./site/_site @@ -46,4 +46,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v3 + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 26d2a57..e04cd31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![YaS☀️lR (Yet another Solar Router)](./site/assets/img/logo.png?raw=1)](https://yasolr.carbou.me/) +[![YaS☀️lR (Yet another Solar Router)](https://yasolr.carbou.me/assets/img/logo.png)](https://yasolr.carbou.me/) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html) [![Download](https://img.shields.io/badge/Download-bin-green.svg)](https://yasolr.carbou.me/download) diff --git a/TODO.md b/TODO.md index 7547908..b486628 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,7 @@ # Todo list +- tester avec board ethernet + - FEATURES - remote (espnow) diff --git a/lib/MycilaDimmer/MycilaDimmer.h b/lib/MycilaDimmer/MycilaDimmer.h index b082d66..6509e32 100644 --- a/lib/MycilaDimmer/MycilaDimmer.h +++ b/lib/MycilaDimmer/MycilaDimmer.h @@ -11,7 +11,7 @@ #include namespace Mycila { - enum class DimmerType { TRIAC, + enum class DimmerType { TRIAC = 0, SSR_RANDOM, SSR_ZC }; diff --git a/lib/MycilaTrial/MycilaTrial.cpp b/lib/MycilaTrial/MycilaTrial.cpp index 5d0f0da..7db60d8 100644 --- a/lib/MycilaTrial/MycilaTrial.cpp +++ b/lib/MycilaTrial/MycilaTrial.cpp @@ -31,16 +31,19 @@ void Mycila::TrialClass::begin() { } } _lastSave = millis(); + Logger.warn(TAG, "%lu seconds left for trial", duration > MYCILA_TRIAL_DURATION ? 0 : MYCILA_TRIAL_DURATION - duration); } void Mycila::TrialClass::loop() { const uint32_t uptime = millis(); - if (uptime - _lastSave >= MYCILA_TRIAL_SAVE * 1000) { + const uint32_t elapsed = uptime - _lastSave; + if (elapsed >= MYCILA_TRIAL_SAVE * 1000) { Preferences prefs; - prefs.begin(TAG, false); - const uint32_t duration = prefs.getLong("duration", 0) + (uptime - _lastSave) / 1000; + prefs.begin(TAG); + const uint32_t duration = prefs.getLong("duration", 0) + elapsed / 1000; prefs.putLong("duration", duration); prefs.end(); + Logger.warn(TAG, "%lu seconds left for trial", duration > MYCILA_TRIAL_DURATION ? 0 : MYCILA_TRIAL_DURATION - duration); _lastSave = uptime; if (duration >= MYCILA_TRIAL_DURATION) { Logger.error(TAG, "Trial expired"); @@ -48,7 +51,6 @@ void Mycila::TrialClass::loop() { delay(1000); } } - Logger.warn(TAG, "%lu seconds left for trial", duration > MYCILA_TRIAL_DURATION ? 0 : MYCILA_TRIAL_DURATION - duration); } } diff --git a/platformio.ini b/platformio.ini index 31a0b09..2adca6a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,7 +10,9 @@ [platformio] name = YaSolR -default_envs = pro-esp32, pro-esp32-debug, pro-esp32s, pro-esp32s-debug, oss-esp32 +default_envs = oss-esp32, oss-esp32-debug, oss-esp32s, oss-esp32s-debug, pro-esp32, pro-esp32-trial, pro-esp32-debug, pro-esp32s, pro-esp32s-trial, pro-esp32s-debug +pro_envs = oss-esp32,pro-esp32,pro-esp32-trial,pro-esp32-debug,pro-esp32s,pro-esp32s-trial,pro-esp32s-debug +oss_envs = oss-esp32,oss-esp32-debug,oss-esp32s,oss-esp32s-debug extra_configs = platformio_override.ini [env] @@ -141,9 +143,6 @@ build_flags = ${pro.build_flags} -D APP_VERSION_TRIAL -D MYCILA_TRIAL_DURATION=259200 - -D MYCILA_TRIAL_SAVE=300 - ; -D MYCILA_TRIAL_DURATION=60 - ; -D MYCILA_TRIAL_SAVE=10 lib_deps = lib_ignore = ElegantOTA diff --git a/src/YaSolRMycilaConfig.cpp b/src/YaSolRMycilaConfig.cpp index 1c388cf..77d6e19 100644 --- a/src/YaSolRMycilaConfig.cpp +++ b/src/YaSolRMycilaConfig.cpp @@ -241,9 +241,9 @@ Mycila::DimmerType Mycila::DimmerConfigClass::getType(const char* name) const { String val = Mycila::Config.get(key); if (val == "TRIAC") return Mycila::DimmerType::TRIAC; - if (val == "SSR RANDOM") + if (val == "SSR_RANDOM") return Mycila::DimmerType::SSR_RANDOM; - if (val == "SSR ZC") + if (val == "SSR_ZC") return Mycila::DimmerType::SSR_ZC; return Mycila::DimmerType::TRIAC; } diff --git a/src/YaSolRWebsite.cpp b/src/YaSolRWebsite.cpp index 16de5a5..e7b9184 100644 --- a/src/YaSolRWebsite.cpp +++ b/src/YaSolRWebsite.cpp @@ -51,8 +51,8 @@ void YaSolR::Website::begin() { _pushButtonAction.update("", "restart,bypass"); _relay1Type.update("", "NO,NC"); _relay2Type.update("", "NO,NC"); - _output1DimmerType.update("", "TRIAC,SSR RANDOM,SSR ZC"); - _output2DimmerType.update("", "TRIAC,SSR RANDOM,SSR ZC"); + _output1DimmerType.update("", "TRIAC,SSR_RANDOM,SSR_ZC"); + _output2DimmerType.update("", "TRIAC,SSR_RANDOM,SSR_ZC"); _ntpTimezone.update("", "/api/ntp/timezones"); // tabs @@ -656,6 +656,7 @@ void YaSolR::Website::update(bool skipWebSocketPush) { _output1BypassType.update(Mycila::Config.get(KEY_OUTPUT1_RELAY_TYPE)); _output1Dimmer.update(Mycila::Config.getBool(KEY_OUTPUT1_DIMMER_ENABLE)); _output1DimmerPin.update(String(Mycila::Config.get(KEY_OUTPUT1_DIMMER_PIN).toInt())); + _output1DimmerType.update(Mycila::Config.get(KEY_OUTPUT1_DIMMER_TYPE)); _output1DimmerPowerLimit.update(static_cast(Mycila::Config.get(KEY_OUTPUT1_DIMMER_LEVEL_LIMIT).toInt())); _output1Temp.update(Mycila::Config.getBool(KEY_OUTPUT1_TEMP_ENABLE)); _output1TempPin.update(String(Mycila::Config.get(KEY_OUTPUT1_TEMP_PIN).toInt())); @@ -674,6 +675,7 @@ void YaSolR::Website::update(bool skipWebSocketPush) { _output2BypassType.update(Mycila::Config.get(KEY_OUTPUT2_RELAY_TYPE)); _output2Dimmer.update(Mycila::Config.getBool(KEY_OUTPUT2_DIMMER_ENABLE)); _output2DimmerPin.update(String(Mycila::Config.get(KEY_OUTPUT2_DIMMER_PIN).toInt())); + _output2DimmerType.update(Mycila::Config.get(KEY_OUTPUT2_DIMMER_TYPE)); _output2DimmerPowerLimit.update(static_cast(Mycila::Config.get(KEY_OUTPUT2_DIMMER_LEVEL_LIMIT).toInt())); _output2Temp.update(Mycila::Config.getBool(KEY_OUTPUT2_TEMP_ENABLE)); _output2TempPin.update(String(Mycila::Config.get(KEY_OUTPUT2_TEMP_PIN).toInt()));