🫏 Adds getter for state

This commit is contained in:
Rune Harlyk
2024-11-23 12:54:15 +01:00
parent 852ff91b7d
commit 8792c06e8a
8 changed files with 49 additions and 48 deletions
@@ -96,7 +96,7 @@ class ServoController : public StatefulService<ServoSettings> {
void updateServoState() {
for (int i = 0; i < 12; i++) {
angles[i] = lerp(angles[i], target_angles[i], 0.2);
auto &servo = _state.servos[i];
auto &servo = state().servos[i];
float angle = servo.direction * angles[i] + servo.centerAngle;
uint16_t pwm = angle * servo.conversion + servo.centerPwm;
if (pwm < 125 || pwm > 600) {