mirror of
https://github.com/SlimeVR/SlimeVR-Tracker-ESP.git
synced 2026-04-05 17:51:57 +02:00
Added ON-OFF button support #204
Open
opened 2026-04-05 17:52:13 +02:00 by MrUnknownDE
·
0 comments
No Branch/Tag Specified
main
feat/serialbuffer
fix/use-realtime-tos
network-experiments
dependabot/github_actions/jidicula/clang-format-action-4.18.0
feat_flashmode
icm-55686
antiing-the-aliases
chg_networkname
feat/mlx90393-support
mag-support
fancy-wifi-provisioning
fake_v0.7.0
mdns-discovery
fix-server-discovery
config-change-logic
add-id-command
logging-ids
feat_benchmark
machine-optimized-spi
ads111x-implementation
mag-and-spi
glove-dynamic-sfusion
llelievr/ci-release
espnow
feat/toggle-mag
cleanup-feature-flags
v0.7.2
v0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.4
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.3
v0.2.2
v0.2.1
v0.2.0
Labels
Clear labels
Area: Continuous Integration
Area: Continuous Integration
Area: Continuous Integration
Area: Documentation
Area: Hardware Protocol
Area: Hardware Protocol
Area: Hardware Protocol
Area: Hardware Protocol
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: IMU Support
Area: Sensor Fusion
Area: Sensor Fusion
Area: Sensor Fusion
Area: Sensor Fusion
Difficulty: Math Heavy
Difficulty: Newbie Friendly
Priority: High
Priority: High
Priority: High
Priority: High
Priority: High
Priority: High
Priority: Low
Priority: Low
Priority: Low
Priority: Low
Priority: Low
Priority: Low
Priority: Normal
Priority: Normal
Priority: Normal
Priority: Normal
Priority: Normal
Priority: Normal
Priority: Normal
Priority: Normal
Status: Blocked by other issue
Status: Help Wanted
Status: Help Wanted
Status: Obsolete
Status: Unlabeled
Status: Unlabeled
Status: Unlabeled
Status: Unlabeled
Status: Unlabeled
Status: Unlabeled
Status: Wontfix
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Bug
Type: Discussion
Type: Discussion
Type: Discussion
Type: Discussion
Type: Discussion
Type: Discussion
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
Type: Enhancement
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
dependencies
github_actions
github_actions
github_actions
github_actions
github_actions
github_actions
github_actions
github_actions
github_actions
github_actions
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
MrUnknownDE
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github/SlimeVR-Tracker-ESP#204
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gorbit99 on 3/23/2024
This PR adds in support for non-blocking momentary push button based ON-OFF functionality using the ESP's deep sleep feature.
The code was tested on an ESP8266 (specifically a D1 mini) and an ESP32-C3 (supermini esp32c3). For the latter, attaching a push button between GND and any of the RTC GPIOs (GPIO0-5), the code should work, but for the ESP8266, the following hardware needs to be added:
GPIO13 can be set to any of the safe pins (4, 5, 12, 13, 14), however the other ones are already used by the default SlimeVR setup.
I have tried to make the setup work with a MOSFET instead of a transistor, but didn't manage to yet.The on-off behaviour can be activated by defining ON_OFF_BUTTON_PIN inside defines.h. For example:
for a D1 mini.
Functionality
When the tracker is on, holding down the button for 1 second puts it to deep sleep (this is debounced). When it's in deep sleep, pressing the button once will wake it up, resetting it.
The tracker attempts to deinitialize the imus attached to it. Using an ESP32, it's also possible to define a pin that acts as an enable pin for the IMU (or other hardware), for possibly a voltage regulator or mosfet, that completely depowers the IMU. This functionality is not available on ESP8266, due to it lacking deep sleep pin hold functionality. To use this feature, one needs to define
BUTTON_IMU_ENABLE_PINand optionallyBUTTON_IMU_ENABLE_ACTIVE_LEVEL(defaults to HIGH if not defined).Additionally the tracker can be made to automatically shut off after a certain period of inactivity or if the battery voltage drops below a certain threshold. Both of these are meant to stop the tracker from depleting the battery to dangerous levels if accidentally left on. To use these features, define
BUTTON_AUTO_SLEEP_TIME_SECONDSandBUTTON_BATTERY_VOLTAGE_THRESHOLDrespectively.While it varies, this setup should drop the power consumption to somewhere around 100-200uA, or even lower, if the IMU is completely depowered.
Battery consumption
Things that need checking: