From 8b000644ffef6b8e95ce8219e065b8f2231f91b4 Mon Sep 17 00:00:00 2001 From: Ondrej Hruska <11602729+ZycaR@users.noreply.github.com> Date: Sun, 1 Sep 2024 10:46:47 -0700 Subject: [PATCH 1/5] GET.INFO Serial Command Should Returns Battery Voltage & Level (in Percentages) (#338) * GET.INFO serial command return also battery voltage & level in percents * move public headers together --- src/GlobalVars.h | 2 ++ src/batterymonitor.h | 3 +++ src/serial/serialcommands.cpp | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/GlobalVars.h b/src/GlobalVars.h index 45adde97b..66bab0a8c 100644 --- a/src/GlobalVars.h +++ b/src/GlobalVars.h @@ -32,6 +32,7 @@ #include "network/manager.h" #include "sensors/SensorManager.h" #include "status/StatusManager.h" +#include "batterymonitor.h" extern Timer<> globalTimer; extern SlimeVR::LEDManager ledManager; @@ -40,5 +41,6 @@ extern SlimeVR::Configuration::Configuration configuration; extern SlimeVR::Sensors::SensorManager sensorManager; extern SlimeVR::Network::Manager networkManager; extern SlimeVR::Network::Connection networkConnection; +extern BatteryMonitor battery; #endif diff --git a/src/batterymonitor.h b/src/batterymonitor.h index e13644e5b..7ae8140f2 100644 --- a/src/batterymonitor.h +++ b/src/batterymonitor.h @@ -72,6 +72,9 @@ class BatteryMonitor void Setup(); void Loop(); + float getVoltage() const { return voltage; } + float getLevel() const { return level; } + private: unsigned long last_battery_sample = 0; #if BATTERY_MONITOR == BAT_MCP3021 || BATTERY_MONITOR == BAT_INTERNAL_MCP3021 diff --git a/src/serial/serialcommands.cpp b/src/serial/serialcommands.cpp index 72934b42f..e3d85ae0c 100644 --- a/src/serial/serialcommands.cpp +++ b/src/serial/serialcommands.cpp @@ -144,6 +144,11 @@ namespace SerialCommands { sensor->getHadData() ? "true" : "false" ); } + logger.info( + "Battery voltage: %.3f, level: %.1f%%", + battery.getVoltage(), + battery.getLevel() * 100 + ); } void cmdGet(CmdParser * parser) { From dbce4cb809e12e91d28587153ba4b7693e3a49dc Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Wed, 25 Sep 2024 12:02:37 -0400 Subject: [PATCH 2/5] Add dependabot & update workflows (#344) * Add dependabot & update workflows * Specify python-version & use pip cache * Add requirements.txt * Cache PIP generally instead & remove requirements --- .github/dependabot.yml | 8 ++++++++ .github/workflows/actions.yml | 18 +++++++++++++----- .github/workflows/release.yml | 6 +++--- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..df4d15b35 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1ab87a928..d2714f081 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -9,21 +9,29 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 + with: + python-version: "3.12" - - name: Install pio and its dependencies + - name: Install PlatformIO and its dependencies run: | python -m pip install --upgrade pip - pip install platformio + pip install --upgrade platformio - name: Run builds run: python ./ci/build.py - name: Upload binaries - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: binaries path: ./build/*.bin diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4aab4a714..553f1b86d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Releases -on: +on: push: tags: - '*' @@ -12,9 +12,9 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ncipollo/release-action@v1 with: artifacts: "./build/*.bin" draft: true - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} From e0751174e0bfb23adcc71ba5f9ec480d46effa26 Mon Sep 17 00:00:00 2001 From: m-RNA <41933749+m-RNA@users.noreply.github.com> Date: Sun, 27 Oct 2024 13:25:52 +0800 Subject: [PATCH 3/5] Enable caching to accelerate compilation (#354) --- .gitignore | 1 + platformio.ini | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 1863b5ac9..e60545875 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .vscode/* build/ venv/ +cache/ diff --git a/platformio.ini b/platformio.ini index 5e79a00fb..0e90d8028 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,6 +11,9 @@ ; https://docs.slimevr.dev/firmware/configuring-project.html#1-configuring-platformioini ; ================================================ +[platformio] +build_cache_dir = cache + [env] lib_deps= https://github.com/SlimeVR/CmdParser.git From b278bcfcf4d5bcc4a71d25d4485510c11bd8d530 Mon Sep 17 00:00:00 2001 From: DevMiner Date: Wed, 30 Oct 2024 18:46:40 +0100 Subject: [PATCH 4/5] chore: clarify protocol version (#350) * chore: clarify protocol version * Pull the bandaid on the test return --------- Co-authored-by: Eiren Rain --- src/debug.h | 2 +- src/network/connection.cpp | 2 +- src/serial/serialcommands.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/debug.h b/src/debug.h index b2c4968d5..f08260b89 100644 --- a/src/debug.h +++ b/src/debug.h @@ -90,7 +90,7 @@ // Not recommended for production #define ENABLE_INSPECTION false -#define FIRMWARE_BUILD_NUMBER 17 +#define PROTOCOL_VERSION 17 #define FIRMWARE_VERSION "0.4.0" #endif // SLIMEVR_DEBUG_H_ diff --git a/src/network/connection.cpp b/src/network/connection.cpp index d37f93d97..be7e74feb 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -401,7 +401,7 @@ void Connection::sendTrackerDiscovery() { MUST(sendInt(0)); MUST(sendInt(0)); MUST(sendInt(0)); - MUST(sendInt(FIRMWARE_BUILD_NUMBER)); + MUST(sendInt(PROTOCOL_VERSION)); MUST(sendShortString(FIRMWARE_VERSION)); // MAC address string MUST(sendBytes(mac, 6)); diff --git a/src/serial/serialcommands.cpp b/src/serial/serialcommands.cpp index e3d85ae0c..06c427942 100644 --- a/src/serial/serialcommands.cpp +++ b/src/serial/serialcommands.cpp @@ -124,10 +124,10 @@ namespace SerialCommands { void printState() { logger.info( - "SlimeVR Tracker, board: %d, hardware: %d, build: %d, firmware: %s, address: %s, mac: %s, status: %d, wifi state: %d", + "SlimeVR Tracker, board: %d, hardware: %d, protocol: %d, firmware: %s, address: %s, mac: %s, status: %d, wifi state: %d", BOARD, HARDWARE_MCU, - FIRMWARE_BUILD_NUMBER, + PROTOCOL_VERSION, FIRMWARE_VERSION, WiFiNetwork::getAddress().toString().c_str(), WiFi.macAddress().c_str(), @@ -205,10 +205,10 @@ namespace SerialCommands { if (parser->equalCmdParam(1, "TEST")) { logger.info( - "[TEST] Board: %d, hardware: %d, build: %d, firmware: %s, address: %s, mac: %s, status: %d, wifi state: %d", + "[TEST] Board: %d, hardware: %d, protocol: %d, firmware: %s, address: %s, mac: %s, status: %d, wifi state: %d", BOARD, HARDWARE_MCU, - FIRMWARE_BUILD_NUMBER, + PROTOCOL_VERSION, FIRMWARE_VERSION, WiFiNetwork::getAddress().toString().c_str(), WiFi.macAddress().c_str(), From 2946a6a7a69ce2b0052cc5ba44ba020429bce2f3 Mon Sep 17 00:00:00 2001 From: jojos38 Date: Wed, 30 Oct 2024 19:09:29 +0100 Subject: [PATCH 5/5] Fix softfusion watchdog timer reset (#346) Fix some microcontrollers crashing (Soft WDT reset) during the calibration loop --- src/sensors/softfusion/softfusionsensor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sensors/softfusion/softfusionsensor.h b/src/sensors/softfusion/softfusionsensor.h index ec076a757..5f70e5ff0 100644 --- a/src/sensors/softfusion/softfusionsensor.h +++ b/src/sensors/softfusion/softfusionsensor.h @@ -155,6 +155,7 @@ class SoftFusionSensor : public Sensor gyro[2] = xyz[2]; } ); + yield(); } return std::make_pair(accel, gyro); } @@ -484,6 +485,7 @@ class SoftFusionSensor : public Sensor [&accelSamples](const int16_t xyz[3], const sensor_real_t timeDelta) { accelSamples++; }, [&gyroSamples](const int16_t xyz[3], const sensor_real_t timeDelta) { gyroSamples++; } ); + yield(); } const auto millisFromStart = currentTime - (calibTarget - 1000 * SampleRateCalibSeconds);