23 lines
859 B
Python
23 lines
859 B
Python
"""Interpret the admitted FW 5.02 PPM input before its firmware deadband.
|
|
|
|
app_ppm.c publishes input_val before utils_deadband. A nonzero decoded value
|
|
inside app_ppm_conf.hyst is therefore not a motor command. Do not infer radio
|
|
link presence from this value: the receiver can keep emitting failsafe pulses.
|
|
"""
|
|
import math
|
|
|
|
|
|
def neutral_band(application):
|
|
band = application["app_ppm_conf.hyst"]
|
|
if (application["app_to_use"] not in (1, 4)
|
|
or application["app_ppm_conf.ctrl_type"] != 4
|
|
or not math.isfinite(band) or not .01 <= band <= .3):
|
|
raise ValueError("Unsupported PPM neutral configuration")
|
|
return band
|
|
|
|
|
|
def active(level, band):
|
|
if not math.isfinite(level) or not math.isfinite(band) or not .01 <= band <= .3:
|
|
raise ValueError("Invalid PPM level or neutral band")
|
|
return abs(level) > band
|