compass update in settings

This commit is contained in:
rgarcia-herrera 2020-08-30 15:41:04 -05:00
parent 8ba7112ab9
commit e40f5776c4
2 changed files with 24 additions and 1 deletions

View File

@ -168,6 +168,23 @@
orientation: 'horizontal' orientation: 'horizontal'
value: 0.88 value: 0.88
on_value: app.set_smoothing() on_value: app.set_smoothing()
BackgroundLabel:
text: "Compas update frequency"
background_color: rgba("#f3e8d2")
color: rgba("#346645")
font_size: '14sp'
BgSlider:
id: slider_compass_update
background_color: rgba("#f3e8d2")
color: rgba("#346645")
min: 0.1
max: 0.9
step: 0.05
orientation: 'horizontal'
value: 0.777
on_value: app.set_compass_update()
BackgroundLabel: BackgroundLabel:
text: "Update frequency" text: "Update frequency"
background_color: rgba("#f3e8d2") background_color: rgba("#f3e8d2")

View File

@ -66,6 +66,11 @@ class FlockompassApp(App):
def set_smoothing(self): def set_smoothing(self):
self.session_data['smoothing'] = self.ss.ids.slider_smoothing.value self.session_data['smoothing'] = self.ss.ids.slider_smoothing.value
def set_compass_update(self):
self.session_data['compass_update'] = self.ss.ids.slider_compass_update.value
self.compass_disable()
self.compass_enable()
def set_destination(self): def set_destination(self):
self.compass_enable() self.compass_enable()
self.session_data['dest_lat'] = self.ms.ids.centermark.lat self.session_data['dest_lat'] = self.ms.ids.centermark.lat
@ -176,7 +181,8 @@ class FlockompassApp(App):
def compass_enable(self): def compass_enable(self):
self.cs.facade.enable() self.cs.facade.enable()
Clock.schedule_interval(self.get_field, 1 / 33.3) Clock.schedule_interval(self.get_field,
1.0 - self.session_data.get('compass_update', 0.777))
def compass_disable(self): def compass_disable(self):
self.cs.facade.disable() self.cs.facade.disable()