commit to present

This commit is contained in:
2015-11-12 23:14:03 -06:00
committed by Anthony Correa
parent c3e5ef5576
commit 6ad007f1d7
6 changed files with 160 additions and 79 deletions

View File

@@ -50,7 +50,7 @@ class Camera:
self._cam.capture("temp_img_hi.jpg",
resize=self.high_quality_resolution,
quality=self.high_quality_compression_pct,
# **kwargs
**kwargs
)
with open("temp_img_hi.jpg", 'rb') as f:
# img_hi = base64.b64encode(f.read())
@@ -64,7 +64,7 @@ class Camera:
self._cam.capture("temp_img_lo.jpg",
resize=self.low_quality_resolution,
quality=self.low_quality_compression_pct,
# **kwargs
**kwargs
)
with open("temp_img_lo.jpg", 'rb') as f:
img_lo = str(base64.b64encode(f.read()),'ascii')
@@ -139,6 +139,56 @@ class Barometer:
return result
class Gps:
def __init__(self):
logger.debug("Intializing GPS")
# self.bmp = BMP085.BMP085()
logger.debug("Gps intilized")
pass
@property
def status (self):
return (0, "Barometer functioning properly")
@property
def temperature (self):
if self.status[0]:
return 'error'
temp = self.bmp.read_temperature()
return temp
@property
def pressure (self):
if (self.status[0]):
return 'error'
# press = 100000*random()
press = self.bmp.read_pressure()
return press
@property
def altitude (self):
if self.status[0]:
return 'error'
#TODO Set the altitude of your current location in meter
alt = self.bmp.read_altitude()
return alt
def read(self):
logger.debug("Reading from barometer")
#refresh each instrument
alt = self.altitude
press = self.pressure
temp = self.temperature
result = {"a":alt,
"t":temp,
"p":press,
}
logger.debug("Gps reads {}".format(result))
return result
# class Gps: