- Removed obsolete script `script_SANSDEMARRAGE.sh`. - Added new `Camera.py` and `Connexion.py` files for camera handling and socket communication. - Implemented `First_Try.py` for initial camera preview testing. - Created `Humidity.py` for humidity sensor data acquisition. - Developed `Send_data_stocked.py` for managing and sending stored data. - Introduced `Time_Lapse_Connection.py` and `Time_Lapse_NoConnection.py` for connected and offline modes. - Added `get_from_server.py` for retrieving camera status from the server. - Updated `sync_offline_data.py` for synchronizing offline data. - Created `timelapse.service` for managing the timelapse service on Raspberry Pi. - Established package structure with `__init__.py` and `api_client.py` for API interactions. - Enhanced `capture.py` for managing image captures and data storage. - Configured `config.py` for centralized configuration management. - Developed `sensors.py` for handling environmental sensors and camera operations. - Implemented `timelapse_offline.py` and `timelapse_online.py` for capturing images in offline and online modes.
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
# coding: utf-8
|
|
|
|
"""
|
|
Script principal pour la capture d'images en mode hors ligne.
|
|
Remplace l'ancien Time_Lapse_NoConnection.py
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import time
|
|
import logging
|
|
from timelapse.config import config
|
|
from timelapse.capture import timelapse_manager
|
|
from timelapse.sensors import micro_controller
|
|
|
|
|
|
def main():
|
|
"""
|
|
Fonction principale pour la capture d'images en mode hors ligne.
|
|
"""
|
|
logging.info("-------------------------------------------------------------------")
|
|
logging.info("Démarrage de la capture d'images en mode hors ligne")
|
|
|
|
try:
|
|
# Chargement de la configuration
|
|
remaining_images = config.get("nb_images_restantes", 0)
|
|
interval = config.get("timelapse", 3) # Intervalle par défaut: 3 secondes
|
|
|
|
logging.info(f"Configuration: {remaining_images} images à capturer, intervalle de {interval}s")
|
|
|
|
if remaining_images <= 0:
|
|
logging.info("Aucune image à capturer en mode hors ligne")
|
|
return
|
|
|
|
# Exécuter la séquence de capture en mode hors ligne
|
|
timelapse_manager.run_capture_sequence(online=False)
|
|
|
|
# Envoi de l'intervalle au microcontrôleur si nécessaire
|
|
if interval > 0:
|
|
micro_controller.send_interval(interval)
|
|
|
|
except Exception as e:
|
|
logging.error(f"Erreur lors de la capture en mode hors ligne: {e}")
|
|
sys.exit(1)
|
|
|
|
logging.info("Capture en mode hors ligne terminée")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |