From 37bb71b41f758409bdb0bcf5c6c6ea3bd3929be6 Mon Sep 17 00:00:00 2001 From: Jaakko Haakana Date: Sat, 26 Jul 2025 20:02:57 +0300 Subject: [PATCH] Fix build when logging and add workflow to build common image with debug logging --- .../compile-common-image-lilygo-logging.yml | 58 +++++++++++++++++++ Software/src/battery/BMW-IX-BATTERY.cpp | 1 + Software/src/battery/BMW-PHEV-BATTERY.cpp | 1 + .../src/battery/IMIEV-CZERO-ION-BATTERY.cpp | 1 + Software/src/battery/KIA-E-GMP-BATTERY.cpp | 1 + .../src/battery/KIA-HYUNDAI-64-BATTERY.cpp | 1 + Software/src/battery/MEB-BATTERY.cpp | 1 + Software/src/battery/MG-HS-PHEV-BATTERY.cpp | 1 + .../src/battery/RENAULT-KANGOO-BATTERY.cpp | 1 + Software/src/battery/VOLVO-SPA-BATTERY.cpp | 1 + .../src/battery/VOLVO-SPA-HYBRID-BATTERY.cpp | 1 + Software/src/charger/CHEVY-VOLT-CHARGER.cpp | 1 + Software/src/inverter/FOXESS-CAN.cpp | 1 + Software/src/inverter/SOLAX-CAN.cpp | 1 + 14 files changed, 71 insertions(+) create mode 100644 .github/workflows/compile-common-image-lilygo-logging.yml diff --git a/.github/workflows/compile-common-image-lilygo-logging.yml b/.github/workflows/compile-common-image-lilygo-logging.yml new file mode 100644 index 00000000..a84381e5 --- /dev/null +++ b/.github/workflows/compile-common-image-lilygo-logging.yml @@ -0,0 +1,58 @@ +# This is the name of the workflow, visible on GitHub UI. +name: 🔋 Compile Common Image for Lilygo with debug logging + +# 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. +jobs: + # This pre-job is run to skip workflows in case a workflow is already run, i.e. because the workflow is triggered by both push and pull_request + skip-duplicate-actions: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + # All of these options are optional, so you can remove them if you are happy with the defaults + concurrent_skipping: 'never' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + + build-common-image: + # This is the platform GitHub will use to run our workflow. + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Copy USER_SECRETS.TEMPLATE.h to USER_SECRETS.h + - name: Copy USER_SECRETS.TEMPLATE.h to USER_SECRETS.h + run: cp ./Software/USER_SECRETS.TEMPLATE.h ./Software/USER_SECRETS.h + + # 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@v2 + + # We then install the platform. + - name: Install platform + run: | + arduino-cli core update-index + arduino-cli core install esp32:esp32 + + - name: Compile Sketch + run: arduino-cli compile --output-dir ./ --fqbn esp32:esp32:esp32 --build-property build.partitions=min_spiffs --build-property upload.maximum_size=1966080 --build-property "build.extra_flags=-Wall -Wextra -Wpedantic -Werror -DESP32 -DDEBUG_VIA_USB -DCOMMON_IMAGE -DHW_LILYGO" ./Software + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: battery-emulator-lilygo-debug.bin + path: Software.ino.bin diff --git a/Software/src/battery/BMW-IX-BATTERY.cpp b/Software/src/battery/BMW-IX-BATTERY.cpp index 018ccf38..1b84b437 100644 --- a/Software/src/battery/BMW-IX-BATTERY.cpp +++ b/Software/src/battery/BMW-IX-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" // Function to check if a value has gone stale over a specified time period bool BmwIXBattery::isStale(int16_t currentValue, uint16_t& lastValue, unsigned long& lastChangeTime) { diff --git a/Software/src/battery/BMW-PHEV-BATTERY.cpp b/Software/src/battery/BMW-PHEV-BATTERY.cpp index c59dcc24..9e4c3193 100644 --- a/Software/src/battery/BMW-PHEV-BATTERY.cpp +++ b/Software/src/battery/BMW-PHEV-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" const unsigned char crc8_table[256] = { // CRC8_SAE_J1850_ZER0 formula,0x1D Poly,initial value 0x3F,Final XOR value varies diff --git a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp index 2db084a0..85f3519a 100644 --- a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp +++ b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.cpp @@ -2,6 +2,7 @@ #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" //Code still work in progress, TODO: //Figure out if CAN messages need to be sent to keep the system happy? diff --git a/Software/src/battery/KIA-E-GMP-BATTERY.cpp b/Software/src/battery/KIA-E-GMP-BATTERY.cpp index 77954440..d8c01e31 100644 --- a/Software/src/battery/KIA-E-GMP-BATTERY.cpp +++ b/Software/src/battery/KIA-E-GMP-BATTERY.cpp @@ -2,6 +2,7 @@ #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" #include "../system_settings.h" const unsigned char crc8_table[256] = diff --git a/Software/src/battery/KIA-HYUNDAI-64-BATTERY.cpp b/Software/src/battery/KIA-HYUNDAI-64-BATTERY.cpp index f933861a..4b0cb2f6 100644 --- a/Software/src/battery/KIA-HYUNDAI-64-BATTERY.cpp +++ b/Software/src/battery/KIA-HYUNDAI-64-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" void KiaHyundai64Battery:: update_values() { //This function maps all the values fetched via CAN to the correct parameters used for modbus diff --git a/Software/src/battery/MEB-BATTERY.cpp b/Software/src/battery/MEB-BATTERY.cpp index 6edc41b0..9bda7d84 100644 --- a/Software/src/battery/MEB-BATTERY.cpp +++ b/Software/src/battery/MEB-BATTERY.cpp @@ -5,6 +5,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" //For "More battery info" webpage #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" /* TODO list diff --git a/Software/src/battery/MG-HS-PHEV-BATTERY.cpp b/Software/src/battery/MG-HS-PHEV-BATTERY.cpp index e0e96e6d..5250e346 100644 --- a/Software/src/battery/MG-HS-PHEV-BATTERY.cpp +++ b/Software/src/battery/MG-HS-PHEV-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../communication/contactorcontrol/comm_contactorcontrol.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" /* MG HS PHEV 16.6kWh battery integration diff --git a/Software/src/battery/RENAULT-KANGOO-BATTERY.cpp b/Software/src/battery/RENAULT-KANGOO-BATTERY.cpp index 12fb991a..e723b00d 100644 --- a/Software/src/battery/RENAULT-KANGOO-BATTERY.cpp +++ b/Software/src/battery/RENAULT-KANGOO-BATTERY.cpp @@ -2,6 +2,7 @@ #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" /* TODO: There seems to be some values on the Kangoo that differ between the 22/33 kWh version diff --git a/Software/src/battery/VOLVO-SPA-BATTERY.cpp b/Software/src/battery/VOLVO-SPA-BATTERY.cpp index 71352fdb..6159002c 100644 --- a/Software/src/battery/VOLVO-SPA-BATTERY.cpp +++ b/Software/src/battery/VOLVO-SPA-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" //For "More battery info" webpage #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" void VolvoSpaBattery:: update_values() { //This function maps all the values fetched via CAN to the correct parameters used for the inverter diff --git a/Software/src/battery/VOLVO-SPA-HYBRID-BATTERY.cpp b/Software/src/battery/VOLVO-SPA-HYBRID-BATTERY.cpp index 97e95859..9d54b8fd 100644 --- a/Software/src/battery/VOLVO-SPA-HYBRID-BATTERY.cpp +++ b/Software/src/battery/VOLVO-SPA-HYBRID-BATTERY.cpp @@ -3,6 +3,7 @@ #include "../datalayer/datalayer.h" #include "../datalayer/datalayer_extended.h" //For "More battery info" webpage #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" void VolvoSpaHybridBattery:: update_values() { //This function maps all the values fetched via CAN to the correct parameters used for the inverter diff --git a/Software/src/charger/CHEVY-VOLT-CHARGER.cpp b/Software/src/charger/CHEVY-VOLT-CHARGER.cpp index f00cb245..07480195 100644 --- a/Software/src/charger/CHEVY-VOLT-CHARGER.cpp +++ b/Software/src/charger/CHEVY-VOLT-CHARGER.cpp @@ -1,6 +1,7 @@ #include "CHEVY-VOLT-CHARGER.h" #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" +#include "../devboard/utils/logging.h" /* This implements Chevy Volt / Ampera charger support (2011-2015 model years). * diff --git a/Software/src/inverter/FOXESS-CAN.cpp b/Software/src/inverter/FOXESS-CAN.cpp index f9b4c5ce..d9148d83 100644 --- a/Software/src/inverter/FOXESS-CAN.cpp +++ b/Software/src/inverter/FOXESS-CAN.cpp @@ -2,6 +2,7 @@ #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" /* Based on info from this excellent repo: https://github.com/FozzieUK/FoxESS-Canbus-Protocol */ /* The FoxESS protocol emulates the stackable (1-8) 48V towers found in the HV2600 / ECS4100 batteries diff --git a/Software/src/inverter/SOLAX-CAN.cpp b/Software/src/inverter/SOLAX-CAN.cpp index 386457f5..4d0503c7 100644 --- a/Software/src/inverter/SOLAX-CAN.cpp +++ b/Software/src/inverter/SOLAX-CAN.cpp @@ -2,6 +2,7 @@ #include "../communication/can/comm_can.h" #include "../datalayer/datalayer.h" #include "../devboard/utils/events.h" +#include "../devboard/utils/logging.h" #define NUMBER_OF_MODULES 0 #define BATTERY_TYPE 0x50