Skip to content

Commit

Permalink
Merge branch 'main' into feat_defines
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel authored Oct 30, 2024
2 parents 452efcc + 2946a6a commit 1ca0cc6
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
18 changes: 13 additions & 5 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Releases

on:
on:
push:
tags:
- '*'
Expand All @@ -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 }}
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode/*
build/
venv/
cache/
3 changes: 3 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/GlobalVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
3 changes: 3 additions & 0 deletions src/batterymonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
#define ENABLE_INSPECTION false
#endif

#define FIRMWARE_BUILD_NUMBER 17
#define PROTOCOL_VERSION 17
#define FIRMWARE_VERSION "0.4.0"

#endif // SLIMEVR_DEBUG_H_
2 changes: 1 addition & 1 deletion src/network/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions src/sensors/softfusion/softfusionsensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class SoftFusionSensor : public Sensor
gyro[2] = xyz[2];
}
);
yield();
}
return std::make_pair(accel, gyro);
}
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 9 additions & 4 deletions src/serial/serialcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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) {
Expand Down Expand Up @@ -200,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(),
Expand Down

0 comments on commit 1ca0cc6

Please sign in to comment.