Several cleanups

This commit is contained in:
2026-04-13 22:10:32 +02:00
parent 1a8b47382c
commit 5c6b3fb295
4 changed files with 19 additions and 13 deletions

View File

@@ -128,6 +128,11 @@ class Gauge:
self._pin_step.value(0)
utime.sleep_us(delay_us)
def steps_toward(self, value, limit=5):
"""Return the step delta needed to move toward value, clamped to ±limit."""
delta = self._val_to_step(value) - self._current_step
return max(-limit, min(limit, delta))
def get(self):
return self._step_to_val(self._current_step)