trigger_analog: Require trigger_value to be an integer

Have the callers convert convert the trigger_value from a float to an
integer (if necessary).  This is in preparation for implementing
rounding in to_fixed_32().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2026-04-12 17:34:25 -04:00
parent aea1bcf56e
commit 2a5c2fe35c
2 changed files with 2 additions and 2 deletions

View File

@@ -332,7 +332,7 @@ class LoadCellProbingMove:
sos_filter.set_offset_scale(int(-tare_counts), gpc, Q17_14_FRAC_BITS)
# update trigger
trigger_val = self._config_helper.get_trigger_force_grams(gcmd)
trigger_frac_grams = trigger_val * FRAC_GRAMS_CONV
trigger_frac_grams = int(trigger_val * FRAC_GRAMS_CONV)
self._mcu_trigger_analog.set_trigger("abs_ge", trigger_frac_grams)
# Probe towards z_min until the trigger_analog on the MCU triggers

View File

@@ -333,7 +333,7 @@ class MCU_trigger_analog:
self._set_raw_range_cmd.send(args)
self._last_range_args = args
# Update trigger in mcu (if it has changed)
args = [self._oid, self._trigger_type, to_fixed_32(self._trigger_value)]
args = [self._oid, self._trigger_type, self._trigger_value]
if args != self._last_trigger_args:
self._set_trigger_cmd.send(args)
self._last_trigger_args = args