Browse Source

Lib & firmware update + cleaner directories structure

master
Pierrick C 3 years ago
parent
commit
bb2a2f2665
  1. BIN
      circuitpython/code/lib/adafruit_bme280.mpy
  2. 0
      circuitpython/code/lib/adafruit_bus_device/__init__.py
  3. BIN
      circuitpython/code/lib/adafruit_bus_device/i2c_device.mpy
  4. BIN
      circuitpython/code/lib/adafruit_bus_device/spi_device.mpy
  5. BIN
      circuitpython/code/lib/adafruit_gps.mpy
  6. BIN
      circuitpython/code/lib/neopixel.mpy
  7. BIN
      circuitpython/firmware/feather_M0_express/firmware-3.0.0-2-g08def6b51-dirty.uf2
  8. BIN
      circuitpython/firmware/feather_M0_express/firmware-4.0.0-alpha-918-gdfa2581ff-dirty.uf2
  9. BIN
      circuitpython/lib/adafruit_bme280.mpy
  10. BIN
      circuitpython/lib/adafruit_bus_device/i2c_device.mpy
  11. BIN
      circuitpython/lib/adafruit_bus_device/spi_device.mpy
  12. BIN
      circuitpython/lib/adafruit_gps.mpy
  13. BIN
      circuitpython/lib/neopixel.mpy
  14. 0
      circuitpython/tools/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty+frozzen-mod.uf2
  15. 0
      circuitpython/tools/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty.uf2
  16. BIN
      circuitpython/tools/firmware/feather_M4_express/adafruit-circuitpython-feather_m4_express-3.0.1.uf2
  17. BIN
      circuitpython/tools/firmware/feather_M4_express/feather_m4_express-ERASE-CIRCUITPY.uf2
  18. BIN
      circuitpython/tools/mpy-cross
  19. 103
      raspberry/python/picam_mqtt.py

BIN
circuitpython/code/lib/adafruit_bme280.mpy

0
circuitpython/lib/adafruit_bus_device/__init__.py → circuitpython/code/lib/adafruit_bus_device/__init__.py

BIN
circuitpython/code/lib/adafruit_bus_device/i2c_device.mpy

BIN
circuitpython/code/lib/adafruit_bus_device/spi_device.mpy

BIN
circuitpython/code/lib/adafruit_gps.mpy

BIN
circuitpython/code/lib/neopixel.mpy

BIN
circuitpython/firmware/feather_M0_express/firmware-3.0.0-2-g08def6b51-dirty.uf2

BIN
circuitpython/firmware/feather_M0_express/firmware-4.0.0-alpha-918-gdfa2581ff-dirty.uf2

BIN
circuitpython/lib/adafruit_bme280.mpy

BIN
circuitpython/lib/adafruit_bus_device/i2c_device.mpy

BIN
circuitpython/lib/adafruit_bus_device/spi_device.mpy

BIN
circuitpython/lib/adafruit_gps.mpy

BIN
circuitpython/lib/neopixel.mpy

0
circuitpython/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty+frozzen-mod.uf2 → circuitpython/tools/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty+frozzen-mod.uf2

0
circuitpython/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty.uf2 → circuitpython/tools/firmware/feather_M4_express/3.0.0-7-gcac760aa6-dirty.uf2

BIN
circuitpython/tools/firmware/feather_M4_express/adafruit-circuitpython-feather_m4_express-3.0.1.uf2

BIN
circuitpython/tools/firmware/feather_M4_express/feather_m4_express-ERASE-CIRCUITPY.uf2

BIN
circuitpython/tools/mpy-cross

103
raspberry/python/picam_mqtt.py

@ -0,0 +1,103 @@
#!/usr/bin/python3
# -*- coding: UTF8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
Take a picture with the Pi Camera module and publish the path
and name of the file on a MQTT broker
@author: arofarn
"""
import os
from time import sleep
from datetime import datetime
import picamera
import paho.mqtt.publish as mqtt
from cameteo_conf import CONFIG_MQTT, CONFIG_PI_CAMERA, PICTURES_EXTENSIONS
MQTT_CLIENT_ID = "picamera"
NOW = datetime.utcNOW()
########
# Main #
########
if not os.path.exists(CONFIG_PI_CAMERA['PICT_DIR']):
print("Create photos directory : " + CONFIG_PI_CAMERA['PICT_DIR'])
os.mkdir(CONFIG_PI_CAMERA['PICT_DIR'])
FILE_NAME = os.path.extsep.join((datetime.strftime(NOW, CONFIG_PI_CAMERA['PICT_NAME']),
PICTURES_EXTENSIONS[CONFIG_PI_CAMERA['PICT_FORMAT']]))
FILE_PATH = os.path.join(CONFIG_PI_CAMERA['PICT_DIR'], FILE_NAME)
print("Shooting " + FILE_PATH)
# Taking a photo
#################
# Tell the MQTT that we start shooting
mqtt.single(CONFIG_PI_CAMERA['MQTT_TOPIC'] + "/shooting",
payload=1,
qos=1,
retain=True,
hostname=CONFIG_MQTT['HOST'],
port=CONFIG_MQTT['PORT'],
client_id=MQTT_CLIENT_ID,
auth=CONFIG_MQTT['AUTH'])
# Camera settings
cam = picamera.PiCamera(resolution=CONFIG_PI_CAMERA['RESOLUTION'])
cam.iso = CONFIG_PI_CAMERA['ISO']
cam.awb_mode = CONFIG_PI_CAMERA['AWB']
cam.rotation = CONFIG_PI_CAMERA['ROTATION']
cam.contrast = CONFIG_PI_CAMERA['CONSTRAST']
cam.exposure_mode = CONFIG_PI_CAMERA['EXPO_MODE']
cam.image_effect = 'none'
#Add some EXIF tags
cam.exif_tags['EXIF.UserComment'] = 'Cameteo !'
# Warm-up
cam.start_preview()
sleep(CONFIG_PI_CAMERA['WARMUP_TIME'])
cam.capture(FILE_PATH, format=CONFIG_PI_CAMERA['PICT_FORMAT'],
quality=95, thumbnail=None)
cam.close()
# MQTT publication
###################
MQTT_DATA = [{'topic': CONFIG_PI_CAMERA['MQTT_TOPIC'] + "/shooting",
'payload': 0,
'qos': 2,
'retain': True},
{'topic': CONFIG_PI_CAMERA['MQTT_TOPIC'] + "/photos_path",
'payload': CONFIG_PI_CAMERA['PICT_DIR'],
'qos': 2,
'retain': True},
{'topic': CONFIG_PI_CAMERA['MQTT_TOPIC'] + "/last_photo",
'payload': CONFIG_PI_CAMERA['PICT_NAME'],
'qos': 2,
'retain': True},
]
mqtt.multiple(MQTT_DATA,
hostname=CONFIG_MQTT['HOST'],
port=CONFIG_MQTT['PORT'],
client_id=MQTT_CLIENT_ID,
auth=CONFIG_MQTT['AUTH'])
Loading…
Cancel
Save