Skip to content
This repository has been archived by the owner on Jan 4, 2018. It is now read-only.

Commit

Permalink
Pre-pre-merge cleanup
Browse files Browse the repository at this point in the history
* Adding a few changes that were on PAN001 before cleanup
* Adding some output and docstring
* Removing csv file that shouldn't have been committed
* Adding test directory
  • Loading branch information
wtgee committed Nov 6, 2017
1 parent 5d37d2f commit 4a4e9fb
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 113 deletions.
15 changes: 14 additions & 1 deletion bin/peas_shell
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ class PanSensorShell(cmd.Cmd):
##################################################################################################

def do_toggle_relay(self, *arg):
""" Toggle a relay
This will toggle a relay on the on the power board, switching off if on
and on if off. Possible relays include:
* fan
* camera_box
* weather
* mount
* cam_0
* cam_0
"""
relay = arg[0]
relay_lookup = {
'fan': {'pin': 6, 'board': 'telemetry_board'},
Expand All @@ -167,14 +179,15 @@ class PanSensorShell(cmd.Cmd):
relay_info = relay_lookup[relay]
self.environment.serial_readers[relay_info['board']]['reader'].write("{},9".format(relay_info['pin']))
except Exception as e:
print_warning("Problem toggling relay {}".format(relay))
print_warning(e)

def do_toggle_computer(self, *arg):
try:
board = 'telemetry_board'
pin = 8
# Special command will toggle off, wait 30 seconds, then toggle on
self.environment.serial_readers[board].write("{},0".format(pin))
self.environment.serial_readers[board]['reader'].write("{},0".format(pin))
except Exception as e:
print_warning(e)

Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ directories:
webcam: '/var/panoptes/webcams'
data: '/var/panoptes/data'
environment:
auto_detect: True,
auto_detect: True
weather:
station: mongo
aag_cloud:
Expand Down
2 changes: 1 addition & 1 deletion peas/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, auto_detect=False, *args, **kwargs):
def _connect_serial(self, port):
if port is not None:
self.logger.debug('Attempting to connect to serial port: {}'.format(port))
serial_reader = SerialData(port=port, threaded=True)
serial_reader = SerialData(port=port, threaded=False)
self.logger.debug(serial_reader)

try:
Expand Down
16 changes: 16 additions & 0 deletions peas/tests/test_boards.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest

from peas.sensors import ArduinoSerialMonitor


@pytest.fixture(scope='module')
def monitor():
return ArduinoSerialMonitor(auto_detect=True)


def test_create(monitor):
assert monitor is not None


def test_has_readers(monitor):
assert len(monitor.serial_readers) > 0
4 changes: 0 additions & 4 deletions scripts/simple_weather_capture.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import datetime
import os
import pandas
import sys
import time

from plotly import graph_objs as plotly_go
from plotly import plotly
from plotly import tools as plotly_tools

sys.path.append(os.getenv('PEAS', '.')) # Append the $PEAS dir

from peas import weather

names = [
Expand Down
106 changes: 0 additions & 106 deletions weather_info.csv

This file was deleted.

0 comments on commit 4a4e9fb

Please sign in to comment.