made proxmity and bme680 optional
This commit is contained in:
@@ -13,6 +13,10 @@ from fastapi.middleware.cors import CORSMiddleware
|
||||
db_user = 'sensor_user'
|
||||
db_password = 'dein_passwort'
|
||||
|
||||
use_bme680 = False
|
||||
use_proximity = False
|
||||
use_camera = True
|
||||
|
||||
# --- Database connection setup ---
|
||||
try:
|
||||
# Connect to local MySQL database
|
||||
@@ -176,14 +180,19 @@ app = FastAPI()
|
||||
|
||||
@app.on_event("startup")
|
||||
def startup_event():
|
||||
sensor_thread = threading.Thread(target=sensor_loop, daemon=True)
|
||||
sensor_thread.start()
|
||||
if use_bme680:
|
||||
sensor_thread = threading.Thread(target=sensor_loop, daemon=True)
|
||||
sensor_thread.start()
|
||||
|
||||
if use_proximity:
|
||||
proxmity_thread = threading.Thread(target=proxmity_loop, daemon=True)
|
||||
proxmity_thread.start()
|
||||
|
||||
if use_bme680:
|
||||
database_thread = threading.Thread(target=database_loop, daemon=True)
|
||||
database_thread.start()
|
||||
|
||||
proxmity_thread = threading.Thread(target=proxmity_loop, daemon=True)
|
||||
proxmity_thread.start()
|
||||
|
||||
database_thread = threading.Thread(target=database_loop, daemon=True)
|
||||
database_thread.start()
|
||||
print("Sensor thread started")
|
||||
|
||||
# --- CORS configuration (allows cross-origin requests) ---
|
||||
|
||||
Reference in New Issue
Block a user