Compare commits

...

4 Commits

Author SHA1 Message Date
gorbit99
95f342f875 Fix 0 byte string sending and check for lengths 2025-06-18 14:27:38 +02:00
Eiren Rain
8d4a2c29df Report in GET TEST if magnetometer is not found 2025-06-12 05:19:31 +02:00
Eiren Rain
6e0b560694 Fix build flags quotes 2025-06-12 05:11:04 +02:00
Eiren Rain
ccc34a9683 Send vendor information on handshake
Embed vendor information into build parameters & defines so SlimeVR vendors can maintain their own firmware updates without adding new boards

Bump protocol version to 21
2025-06-12 05:01:35 +02:00
6 changed files with 63 additions and 3 deletions

View File

@@ -20,6 +20,11 @@ board = esp12e
build_flags =
${env.build_flags}
-D BOARD=BOARD_SLIMEVR
-D VENDOR_NAME='"SlimeVR"'
-D VENDOR_URL='"https://slimevr.dev"'
-D PRODUCT_NAME='"SlimeVR Tracker"'
-D UPDATE_ADDRESS='"SlimeVR/SlimeVR-Tracker-ESP"'
-D UPDATE_NAME='"BOARD_SLIMEVR-firmware"'
[env:BOARD_SLIMEVR_V1_2]
platform = espressif8266 @ 4.2.1
@@ -27,6 +32,11 @@ board = esp12e
build_flags =
${env.build_flags}
-D BOARD=BOARD_SLIMEVR_V1_2
-D VENDOR_NAME='"SlimeVR"'
-D VENDOR_URL='"https://slimevr.dev"'
-D PRODUCT_NAME='"SlimeVR Tracker v1.2"'
-D UPDATE_ADDRESS='"SlimeVR/SlimeVR-Tracker-ESP"'
-D UPDATE_NAME='"BOARD_SLIMEVR_V1_2-firmware"'
[env:BOARD_SLIMEVR_DEV]
platform = espressif8266 @ 4.2.1
@@ -34,6 +44,8 @@ board = esp12e
build_flags =
${env.build_flags}
-D BOARD=BOARD_SLIMEVR_DEV
-D VENDOR_NAME='"SlimeVR"'
-D PRODUCT_NAME='"SlimeVR Tracker (dev)"'
[env:BOARD_GLOVE_IMU_SLIMEVR_DEV]
platform = espressif32 @ 6.7.0
@@ -44,6 +56,7 @@ build_flags =
${env.build_flags}
-DESP32C3
-D BOARD=BOARD_GLOVE_IMU_SLIMEVR_DEV
-D PRODUCT_NAME='"SlimeVR Glove (dev)"'
board = lolin_c3_mini
[env:BOARD_NODEMCU]

View File

@@ -68,6 +68,14 @@ board = esp12e
; Comment out this line below if you have any trouble uploading the firmware
; and if it has a CP2102 on it (a square chip next to the usb port): change to 3000000 (3 million) for even faster upload speed
upload_speed = 921600
build_flags =
${env.build_flags}
-D BOARD=BOARD_SLIMEVR_V1_2
-D VENDOR_NAME='"SlimeVR"'
-D VENDOR_URL='"https://slimevr.dev"'
-D PRODUCT_NAME='"SlimeVR Tracker v1.2"'
-D UPDATE_ADDRESS='"SlimeVR/SlimeVR-Tracker-ESP"'
-D UPDATE_NAME='"BOARD_SLIMEVR_V1_2-firmware"'
; Uncomment below if you want to build for ESP-01
;[env:esp01_1m]

View File

@@ -94,7 +94,7 @@
// Not recommended for production
#define ENABLE_INSPECTION false
#define PROTOCOL_VERSION 20
#define PROTOCOL_VERSION 21
#ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION "UNKNOWN"

View File

@@ -52,3 +52,23 @@
#ifndef EXPERIMENTAL_BNO_DISABLE_ACCEL_CALIBRATION
#define EXPERIMENTAL_BNO_DISABLE_ACCEL_CALIBRATION true
#endif
#ifndef VENDOR_NAME
#define VENDOR_NAME "Unknown"
#endif
#ifndef VENDOR_URL
#define VENDOR_URL ""
#endif
#ifndef PRODUCT_NAME
#define PRODUCT_NAME "SlimeVR Tracker"
#endif
#ifndef UPDATE_ADDRESS
#define UPDATE_ADDRESS ""
#endif
#ifndef UPDATE_NAME
#define UPDATE_NAME ""
#endif

View File

@@ -23,6 +23,8 @@
#include "connection.h"
#include <string_view>
#include "GlobalVars.h"
#include "logging/Logger.h"
#include "packets.h"
@@ -165,8 +167,12 @@ bool Connection::sendPacketNumber() {
bool Connection::sendShortString(const char* str) {
uint8_t size = strlen(str);
assert(size <= 255);
MUST_TRANSFER_BOOL(sendByte(size));
MUST_TRANSFER_BOOL(sendBytes((const uint8_t*)str, size));
if (size > 0) {
MUST_TRANSFER_BOOL(sendBytes((const uint8_t*)str, size));
}
return true;
}
@@ -373,6 +379,16 @@ void Connection::sendTrackerDiscovery() {
// Tracker type to hint the server if it's a glove or normal tracker or
// something else
MUST_TRANSFER_BOOL(sendByte(static_cast<uint8_t>(TRACKER_TYPE)));
static_assert(std::string_view{VENDOR_NAME}.size() <= 255);
MUST_TRANSFER_BOOL(sendShortString(VENDOR_NAME));
static_assert(std::string_view{VENDOR_URL}.size() <= 255);
MUST_TRANSFER_BOOL(sendShortString(VENDOR_URL));
static_assert(std::string_view{PRODUCT_NAME}.size() <= 255);
MUST_TRANSFER_BOOL(sendShortString(PRODUCT_NAME));
static_assert(std::string_view{UPDATE_ADDRESS}.size() <= 255);
MUST_TRANSFER_BOOL(sendShortString(UPDATE_ADDRESS));
static_assert(std::string_view{UPDATE_NAME}.size() <= 255);
MUST_TRANSFER_BOOL(sendShortString(UPDATE_NAME));
return true;
},
0
@@ -751,7 +767,8 @@ void Connection::update() {
auto& sensors = sensorManager.getSensors();
if (sensorId >= sensors.size()) {
m_Logger.warn("Invalid sensor config flag packet: invalid sensor id"
m_Logger.warn(
"Invalid sensor config flag packet: invalid sensor id"
);
break;
}

View File

@@ -296,6 +296,8 @@ void cmdGet(CmdParser* parser) {
const char* mag = sensor0->getAttachedMagnetometer();
if (mag) {
logger.info("[TEST] Sensor[0] magnetometer: %s", mag);
} else {
logger.info("[TEST] Sensor[0] has no magnetometer attached");
}
if (!sensor0->getHadData()) {