mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-26 15:13:26 +00:00
Server: Add check_current_position parameter to config
This commit is contained in:
@@ -29,10 +29,12 @@ config_version = float(default='1.0')
|
||||
__many__ = preset_param
|
||||
|
||||
[CHECKS]
|
||||
# in meters
|
||||
battery_min = float(default=50.0, min=0, max=100)
|
||||
check_current_position = boolean(default=True)
|
||||
# in meters
|
||||
start_pos_delta_max = float(default=1.0, min=0)
|
||||
# in meters
|
||||
# in seconds
|
||||
time_delta_max = float(default=1.0, min=0)
|
||||
|
||||
[BROADCAST]
|
||||
|
||||
@@ -45,6 +45,7 @@ class ModelChecks:
|
||||
battery_min = 50.0
|
||||
start_pos_delta_max = 1.0
|
||||
time_delta_max = 1.0
|
||||
check_current_pos = True
|
||||
|
||||
@classmethod
|
||||
def column_check(cls, column, pass_context=False):
|
||||
@@ -111,6 +112,8 @@ def check_selfcheck(item):
|
||||
|
||||
@ModelChecks.column_check("current_position")
|
||||
def check_pos(item):
|
||||
if not ModelChecks.check_current_pos:
|
||||
return True
|
||||
if item == 'NO_POS':
|
||||
return False
|
||||
return not math.isnan(item[0])
|
||||
|
||||
@@ -91,6 +91,7 @@ class ServerQt(Server):
|
||||
def load_config(self):
|
||||
super().load_config()
|
||||
table.ModelChecks.battery_min = self.config.checks_battery_min
|
||||
table.ModelChecks.check_current_pos = self.config.checks_check_current_position
|
||||
table.ModelChecks.start_pos_delta_max = self.config.checks_start_pos_delta_max
|
||||
table.ModelChecks.time_delta_max = self.config.checks_time_delta_max
|
||||
|
||||
|
||||
Reference in New Issue
Block a user