From 3b03d2793108cfe17b9efa126e4c70c9783fc1f8 Mon Sep 17 00:00:00 2001 From: lenvm Date: Fri, 10 Nov 2023 18:27:28 +0100 Subject: [PATCH] add workflows for GitHub Actions to compile different hardwares - comment out all #define macros related to batteries and inverters in USER_SETTINGS.h - remove workflow to compile arduino sketch, as the sketch does not compile without defining the #define macros - add workflow to compile all batteries in combination with the inverter communication protocol: BYD_MODBUS - add workflow to compile all inverter communication protocols in combination with the battery: NISSAN_LEAF_BATTERY - add workflow to compile all combinations of batteries and inverter communication protocols. This workflow can be triggered manually. --- .github/workflows/compile-all-batteries.yml | 77 ++++++++++++++++++ .../workflows/compile-all-combinations.yml | 80 +++++++++++++++++++ .github/workflows/compile-all-inverters.yml | 77 ++++++++++++++++++ .github/workflows/compile-arduino-sketch.yml | 33 -------- Software/USER_SETTINGS.h | 4 +- 5 files changed, 236 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/compile-all-batteries.yml create mode 100644 .github/workflows/compile-all-combinations.yml create mode 100644 .github/workflows/compile-all-inverters.yml delete mode 100644 .github/workflows/compile-arduino-sketch.yml diff --git a/.github/workflows/compile-all-batteries.yml b/.github/workflows/compile-all-batteries.yml new file mode 100644 index 00000000..f006d43e --- /dev/null +++ b/.github/workflows/compile-all-batteries.yml @@ -0,0 +1,77 @@ +# This is the name of the workflow, visible on GitHub UI. +name: Compile All Batteries + +# Here we tell GitHub when to run the workflow. +on: + # The workflow is run when a commit is pushed or for a + # Pull Request. + - push + - pull_request + +# This is the list of jobs that will be run concurrently. +# Since we use a build matrix, the actual number of jobs +# started depends on how many configurations the matrix +# will produce. +jobs: + # This is the name of the job + build-batteries: + + # Here we tell GitHub that the jobs must be determined + # dynamically depending on a matrix configuration. + strategy: + # The matrix will produce one job for each combination of parameters. + matrix: + # This is the development board hardware for which the code will be compiled. + # FBQN stands for "fully qualified board name", and is used by Arduino to define the hardware to compile for. + fqbn: + - esp32:esp32:esp32 + # further ESP32 chips + #- esp32:esp32:esp32c3 + #- esp32:esp32:esp32c2 + #- esp32:esp32:esp32c6 + #- esp32:esp32:esp32h2 + #- esp32:esp32:esp32s3 + # These are the batteries for which the code will be compiled. + battery: + - BMW_I3_BATTERY + - CHADEMO_BATTERY + - IMIEV_CZERO_ION_BATTERY + - KIA_HYUNDAI_64_BATTERY + - NISSAN_LEAF_BATTERY + - RENAULT_ZOE_BATTERY + - TESLA_MODEL_3_BATTERY + # These are the emulated inverter communication protocols for which the code will be compiled. + inverter: +# - BYD_CAN + - BYD_MODBUS +# - LUNA2000_MODBUS +# - PYLON_CAN +# - SMA_CAN +# - SOFAR_CAN +# - SOLAX_CAN + + # This is the platform GitHub will use to run our workflow. + runs-on: ubuntu-latest + + # This is the list of steps this job will run. + steps: + # First we clone the repo using the `checkout` action. + - name: Checkout + uses: actions/checkout@v4 + + # We use the `arduino/setup-arduino-cli` action to install and + # configure the Arduino CLI on the system. + - name: Setup Arduino CLI + uses: arduino/setup-arduino-cli@v1 + + # We then install the platform. + - name: Install platform + run: | + arduino-cli core update-index + arduino-cli core install esp32:esp32 + + # Finally, we compile the sketch, using the FQBN that was set + # in the build matrix, and using build flags to define the + # battery and inverter set in the build matrix. + - name: Compile Sketch + run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software diff --git a/.github/workflows/compile-all-combinations.yml b/.github/workflows/compile-all-combinations.yml new file mode 100644 index 00000000..378fc4e0 --- /dev/null +++ b/.github/workflows/compile-all-combinations.yml @@ -0,0 +1,80 @@ +# This is the name of the workflow, visible on GitHub UI. +name: Compile All Combinations + +# Here we tell GitHub when to run the workflow. +on: + # This allows you to run this workflow manually from the + # GitHub Actions tab. + workflow_dispatch: + # The workflow is run upon creating, editing, + # pre-releasing, releasing and publishing a release + release: + types: [created, edited, prereleased, released, published] + +# This is the list of jobs that will be run concurrently. +# Since we use a build matrix, the actual number of jobs +# started depends on how many configurations the matrix +# will produce. +jobs: + # This is the name of the job. + build-matrix: + + # Here we tell GitHub that the jobs must be determined + # dynamically depending on a matrix configuration. + strategy: + # The matrix will produce one job for each combination of parameters. + matrix: + # This is the development board hardware for which the code will be compiled. + # FBQN stands for "fully qualified board name", and is used by Arduino to define the hardware to compile for. + fqbn: + - esp32:esp32:esp32 + # further ESP32 chips + #- esp32:esp32:esp32c3 + #- esp32:esp32:esp32c2 + #- esp32:esp32:esp32c6 + #- esp32:esp32:esp32h2 + #- esp32:esp32:esp32s3 + # These are the batteries for which the code will be compiled. + battery: + - BMW_I3_BATTERY + - CHADEMO_BATTERY + - IMIEV_CZERO_ION_BATTERY + - KIA_HYUNDAI_64_BATTERY + - NISSAN_LEAF_BATTERY + - RENAULT_ZOE_BATTERY + - TESLA_MODEL_3_BATTERY + # These are the emulated inverter communication protocols for which the code will be compiled. + inverter: + - BYD_CAN + - BYD_MODBUS + - LUNA2000_MODBUS + - PYLON_CAN + - SMA_CAN + - SOFAR_CAN + - SOLAX_CAN + + # This is the platform GitHub will use to run our workflow. + runs-on: ubuntu-latest + + # This is the list of steps this job will run. + steps: + # First we clone the repo using the `checkout` action. + - name: Checkout + uses: actions/checkout@v4 + + # We use the `arduino/setup-arduino-cli` action to install and + # configure the Arduino CLI on the system. + - name: Setup Arduino CLI + uses: arduino/setup-arduino-cli@v1 + + # We then install the platform. + - name: Install platform + run: | + arduino-cli core update-index + arduino-cli core install esp32:esp32 + + # Finally, we compile the sketch, using the FQBN that was set + # in the build matrix, and using build flags to define the + # battery and inverter set in the build matrix. + - name: Compile Sketch + run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software diff --git a/.github/workflows/compile-all-inverters.yml b/.github/workflows/compile-all-inverters.yml new file mode 100644 index 00000000..954e263c --- /dev/null +++ b/.github/workflows/compile-all-inverters.yml @@ -0,0 +1,77 @@ +# This is the name of the workflow, visible on GitHub UI. +name: Compile All Inverters + +# Here we tell GitHub when to run the workflow. +on: + # The workflow is run when a commit is pushed or for a + # Pull Request. + - push + - pull_request + +# This is the list of jobs that will be run concurrently. +# Since we use a build matrix, the actual number of jobs +# started depends on how many configurations the matrix +# will produce. +jobs: + # This is the name of the job. + build-inverters: + + # Here we tell GitHub that the jobs must be determined + # dynamically depending on a matrix configuration. + strategy: + # The matrix will produce one job for each combination of parameters. + matrix: + # This is the development board hardware for which the code will be compiled. + # FBQN stands for "fully qualified board name", and is used by Arduino to define the hardware to compile for. + fqbn: + - esp32:esp32:esp32 + # further ESP32 chips + #- esp32:esp32:esp32c3 + #- esp32:esp32:esp32c2 + #- esp32:esp32:esp32c6 + #- esp32:esp32:esp32h2 + #- esp32:esp32:esp32s3 + # These are the batteries for which the code will be compiled. + battery: +# - BMW_I3_BATTERY +# - CHADEMO_BATTERY +# - IMIEV_CZERO_ION_BATTERY +# - KIA_HYUNDAI_64_BATTERY + - NISSAN_LEAF_BATTERY +# - RENAULT_ZOE_BATTERY +# - TESLA_MODEL_3_BATTERY + # These are the emulated inverter communication protocols for which the code will be compiled. + inverter: + - BYD_CAN + - BYD_MODBUS + - LUNA2000_MODBUS + - PYLON_CAN + - SMA_CAN + - SOFAR_CAN + - SOLAX_CAN + + # This is the platform GitHub will use to run our workflow. + runs-on: ubuntu-latest + + # This is the list of steps this job will run. + steps: + # First we clone the repo using the `checkout` action. + - name: Checkout + uses: actions/checkout@v4 + + # We use the `arduino/setup-arduino-cli` action to install and + # configure the Arduino CLI on the system. + - name: Setup Arduino CLI + uses: arduino/setup-arduino-cli@v1 + + # We then install the platform. + - name: Install platform + run: | + arduino-cli core update-index + arduino-cli core install esp32:esp32 + + # Finally, we compile the sketch, using the FQBN that was set + # in the build matrix, and using build flags to define the + # battery and inverter set in the build matrix. + - name: Compile Sketch + run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property "build.extra_flags=-DESP32 -D${{ matrix.battery}} -D${{ matrix.inverter}}" ./Software diff --git a/.github/workflows/compile-arduino-sketch.yml b/.github/workflows/compile-arduino-sketch.yml deleted file mode 100644 index 250a1f69..00000000 --- a/.github/workflows/compile-arduino-sketch.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Compile Arduino Sketch -on: - - push - - pull_request - -jobs: - build-for-esp32: - runs-on: ubuntu-latest - - strategy: - matrix: - fqbn: - - esp32:esp32:esp32 - # further ESP32 chips - #- esp32:esp32:esp32c3 - #- esp32:esp32:esp32c2 - #- esp32:esp32:esp32c6 - #- esp32:esp32:esp32h2 - #- esp32:esp32:esp32s3 - - steps: - - uses: actions/checkout@v4 - - uses: arduino/compile-sketches@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - fqbn: ${{ matrix.fqbn }} - platforms: | - - name: esp32:esp32 - source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - sketch-paths: | - - Software - cli-compile-flags: | - - --warnings="none" diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index 60ea8b16..6414731f 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -10,13 +10,13 @@ //#define CHADEMO_BATTERY //#define IMIEV_CZERO_ION_BATTERY //#define KIA_HYUNDAI_64_BATTERY -#define NISSAN_LEAF_BATTERY +//#define NISSAN_LEAF_BATTERY //#define RENAULT_ZOE_BATTERY //#define TESLA_MODEL_3_BATTERY /* Select inverter communication protocol. See Wiki for which to use with your inverter: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/wiki */ //#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus -#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU +//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU //#define LUNA2000_MODBUS //Enable this line to emulate a "Luna2000 battery" over Modbus RTU //#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus //#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus