Skip to content

Commit

Permalink
Merge pull request #13 from KanoComputing/reduce_cpu
Browse files Browse the repository at this point in the history
Reduce CPU
  • Loading branch information
Ealdwulf authored Jul 8, 2016
2 parents 83cc95c + fbfe93a commit cfc56b8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
kano-peripherals (3.4.0-0) unstable; urgency=low

* Added is_speaker_plugged api to daemon

-- Team Kano <dev@kano.me> Mon, 11 Jan 2016 12:00:00 +0000

kano-peripherals (2.3.0-0) unstable; urgency=low

* Added LED Speaker daemon.
Expand Down
4 changes: 4 additions & 0 deletions kano_peripherals/speaker_leds/driver/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def _detect_thread(self):

return True # keep calling this method indefinitely

@dbus.service.method(SPEAKER_LEDS_IFACE, in_signature='', out_signature='b')
def is_speaker_plugged(self):
return self.is_plugged

def _locking_thread(self):
"""
Check if the locking processes are still alive.
Expand Down
15 changes: 10 additions & 5 deletions kano_peripherals/speaker_leds/use_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,21 @@ def cpu_monitor_start(update_rate, check_settings, retry_count):
duration = update_rate
cycles = duration / 2

speakerleds_iface = high_level.get_speakerleds_interface()

while not high_level.interrupted:
led_speeds = _get_cpu_led_speeds(0.1, num_leds)
if speakerleds_iface.is_speaker_plugged():

led_speeds = _get_cpu_led_speeds(0.1, num_leds)

vf2 = high_level.pulse_each(vf, led_speeds)
successful = high_level.animate(vf2, duration, cycles)
vf2 = high_level.pulse_each(vf, led_speeds)
successful = high_level.animate(vf2, duration, cycles)

if not successful:
if not successful:
time.sleep(duration)
else:
time.sleep(duration)


def cpu_monitor_stop():
_stop('cpu-monitor')

Expand Down

0 comments on commit cfc56b8

Please sign in to comment.