Skip to content

Commit 6c68335

Browse files
authored
Merge branch 'main' into fancy-wifi-provisioning
2 parents 0e1f511 + 5541ed7 commit 6c68335

18 files changed

Lines changed: 571 additions & 5056 deletions

lib/bmi160/BMI160.cpp

Lines changed: 0 additions & 2420 deletions
This file was deleted.

lib/bmi160/BMI160.h

Lines changed: 0 additions & 767 deletions
This file was deleted.

src/LEDManager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@
2828

2929
namespace SlimeVR {
3030
void LEDManager::setup() {
31-
#if ENABLE_LEDS
32-
pinMode(m_Pin, OUTPUT);
33-
#endif
31+
if (m_Enabled) {
32+
pinMode(m_Pin, OUTPUT);
33+
}
3434

3535
// Do the initial pull of the state
3636
update();
3737
}
3838

3939
void LEDManager::on() {
40-
#if ENABLE_LEDS
41-
digitalWrite(m_Pin, LED__ON);
42-
#endif
40+
if (m_Enabled) {
41+
digitalWrite(m_Pin, m_On);
42+
}
4343
}
4444

4545
void LEDManager::off() {
46-
#if ENABLE_LEDS
47-
digitalWrite(m_Pin, LED__OFF);
48-
#endif
46+
if (m_Enabled) {
47+
digitalWrite(m_Pin, m_Off);
48+
}
4949
}
5050

5151
void LEDManager::blink(unsigned long time) {

src/LEDManager.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ enum LEDStage { OFF, ON, GAP, INTERVAL };
5151

5252
class LEDManager {
5353
public:
54-
LEDManager(uint8_t pin)
55-
: m_Pin(pin) {}
56-
5754
void setup();
5855

5956
/*!
@@ -88,7 +85,10 @@ class LEDManager {
8885
LEDStage m_CurrentStage = OFF;
8986
unsigned long m_LastUpdate = millis();
9087

91-
uint8_t m_Pin;
88+
uint8_t m_Pin = LED_PIN;
89+
bool m_Enabled = m_Pin >= 0 && m_Pin < LED_OFF;
90+
bool m_On = LED_INVERTED ? LOW : HIGH;
91+
bool m_Off = !m_On;
9292

9393
Logging::Logger m_Logger = Logging::Logger("LEDManager");
9494
};

src/batterymonitor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252
#endif
5353

5454
#if BATTERY_MONITOR == BAT_EXTERNAL
55-
#ifndef PIN_BATTERY_LEVEL
56-
#error Internal ADC enabled without pin! Please select a pin.
57-
#endif
5855
// Wemos D1 Mini has an internal Voltage Divider with R1=100K and R2=220K > this
5956
// means, 3.3V analogRead input voltage results in 1023.0 Wemos D1 Mini with Wemos
6057
// Battery Shield v1.2.0 or higher: Battery Shield with J2 closed, has an additional

src/board_default.h

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/*
2+
* LED configuration:
3+
* Configuration Priority 1 = Highest:
4+
* 1. LED_PIN
5+
* 2. LED_BUILTIN
6+
*
7+
* LED_PIN
8+
* - Number or Symbol (D1,..) of the Output
9+
* - To turn off the LED, set LED_PIN to LED_OFF
10+
* LED_INVERTED
11+
* - false for output 3.3V on high
12+
* - true for pull down to GND on high
13+
*/
14+
15+
/*
16+
* D1 Mini boards with ESP8266 have internal resistors. For these boards you only have
17+
* to adjust BATTERY_SHIELD_RESISTANCE. For other boards you can now adjust the other
18+
* resistor values. The diagram looks like this:
19+
* (Battery)--- [BATTERY_SHIELD_RESISTANCE] ---(INPUT_BOARD)--- [BATTERY_SHIELD_R2]
20+
* ---(ESP32_INPUT)--- [BATTERY_SHIELD_R1] --- (GND)
21+
* BATTERY_SHIELD_R(180)
22+
* 130k BatteryShield, 180k SlimeVR or fill in
23+
* external resistor value in kOhm BATTERY_R1(100)
24+
* Board voltage divider resistor Ain to GND in kOhm BATTERY_R2(220)
25+
* Board voltage divider resistor Ain to INPUT_BOARD in kOhm
26+
*/
27+
28+
#include "defines_helpers.h"
29+
30+
// Board-specific configurations
31+
#if BOARD == BOARD_SLIMEVR
32+
33+
SDA(14)
34+
SCL(12)
35+
INT(16)
36+
INT2(13)
37+
BATTERY(17)
38+
LED(2)
39+
INVERTED_LED(true)
40+
BATTERY_SHIELD_R(0)
41+
BATTERY_R1(10)
42+
BATTERY_R2(40.2)
43+
44+
#elif BOARD == BOARD_SLIMEVR_V1_2
45+
46+
SDA(4)
47+
SCL(5)
48+
INT(2)
49+
INT2(16)
50+
BATTERY(17)
51+
LED(2)
52+
INVERTED_LED(true)
53+
BATTERY_SHIELD_R(0)
54+
BATTERY_R1(10)
55+
BATTERY_R2(40.2)
56+
57+
#elif BOARD == BOARD_SLIMEVR_LEGACY || BOARD == BOARD_SLIMEVR_DEV
58+
59+
SDA(4)
60+
SCL(5)
61+
INT(10)
62+
INT2(13)
63+
BATTERY(17)
64+
LED(2)
65+
INVERTED_LED(true)
66+
BATTERY_SHIELD_R(0)
67+
BATTERY_R1(10)
68+
BATTERY_R2(40.2)
69+
70+
#elif BOARD == BOARD_NODEMCU || BOARD == BOARD_WEMOSD1MINI
71+
72+
SDA(D2)
73+
SCL(D1)
74+
INT(D5)
75+
INT2(D6)
76+
BATTERY(A0)
77+
BATTERY_SHIELD_R(180)
78+
BATTERY_R1(100)
79+
BATTERY_R2(220)
80+
81+
#elif BOARD == BOARD_ESP01
82+
83+
SDA(2)
84+
SCL(0)
85+
INT(255)
86+
INT2(255)
87+
BATTERY(255)
88+
LED(LED_OFF)
89+
INVERTED_LED(false)
90+
91+
#elif BOARD == BOARD_TTGO_TBASE
92+
93+
SDA(5)
94+
SCL(4)
95+
INT(14)
96+
INT2(13)
97+
BATTERY(A0)
98+
99+
#elif BOARD == BOARD_CUSTOM
100+
101+
// Define pins by the examples above
102+
103+
#elif BOARD == BOARD_WROOM32
104+
105+
SDA(21)
106+
SCL(22)
107+
INT(23)
108+
INT2(25)
109+
BATTERY(36)
110+
111+
#elif BOARD == BOARD_LOLIN_C3_MINI
112+
113+
SDA(5)
114+
SCL(4)
115+
INT(6)
116+
INT2(8)
117+
BATTERY(3)
118+
LED(7)
119+
120+
#elif BOARD == BOARD_BEETLE32C3
121+
122+
SDA(8)
123+
SCL(9)
124+
INT(6)
125+
INT2(7)
126+
BATTERY(3)
127+
LED(10)
128+
INVERTED_LED(false)
129+
130+
#elif BOARD == BOARD_ESP32C3DEVKITM1 || BOARD == BOARD_ESP32C6DEVKITC1
131+
132+
SDA(5)
133+
SCL(4)
134+
INT(6)
135+
INT2(7)
136+
BATTERY(3)
137+
LED(LED_OFF)
138+
139+
#elif BOARD == BOARD_WEMOSWROOM02
140+
141+
SDA(2)
142+
SCL(14)
143+
INT(0)
144+
INT2(4)
145+
BATTERY(A0)
146+
LED(16)
147+
INVERTED_LED(true)
148+
149+
#elif BOARD == BOARD_XIAO_ESP32C3
150+
151+
SDA(6)
152+
SCL(7) // D5
153+
INT(5) // D3
154+
INT2(10) // D10
155+
LED(4) // D2
156+
INVERTED_LED(false)
157+
BATTERY(2) // D0 / A0
158+
BATTERY_SHIELD_R(0)
159+
BATTERY_R1(100)
160+
BATTERY_R2(100)
161+
162+
#elif BOARD == BOARD_GLOVE_IMU_SLIMEVR_DEV
163+
164+
SDA(1)
165+
SCL(0)
166+
#define PCA_ADDR 0x70
167+
INT(16)
168+
INT2(13)
169+
BATTERY(3)
170+
LED(2)
171+
INVERTED_LED(true)
172+
BATTERY_SHIELD_R(0)
173+
BATTERY_R1(10)
174+
BATTERY_R2(40.2)
175+
176+
#endif

src/consts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum class SensorTypeID : uint8_t {
5858
#define IMU_BNO055 BNO055Sensor
5959
#define IMU_MPU6050 MPU6050Sensor
6060
#define IMU_BNO086 BNO086Sensor
61-
#define IMU_BMI160 BMI160Sensor
61+
#define IMU_BMI160 SoftFusionBMI160
6262
#define IMU_ICM20948 ICM20948Sensor
6363
#define IMU_ICM42688 SoftFusionICM42688
6464
#define IMU_BMI270 SoftFusionBMI270

0 commit comments

Comments
 (0)