Several cleanups
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user