Refactor into config file
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import grovepi
|
||||
from sensors.lock import grove_lock
|
||||
from shared import config
|
||||
|
||||
# Connect the Grove Ultrasonic Ranger to digital port D4
|
||||
# SIG,NC,VCC,GND
|
||||
@@ -25,8 +26,8 @@ def get_dish_height():
|
||||
# Assuming the ultrasonic sensor is mounted at a fixed height above the dish
|
||||
# and pointing downwards, we can calculate the height of the dish.
|
||||
# For example, if the sensor is 30 cm above the dish when it's empty:
|
||||
SENSOR_HEIGHT = 30 # cm
|
||||
dish_height = SENSOR_HEIGHT - distance
|
||||
# cm
|
||||
dish_height = config.COOKING_COMPARTMENT_HEIGHT - distance
|
||||
return max(dish_height, 0) # Ensure height is not negative
|
||||
else:
|
||||
return None
|
||||
Reference in New Issue
Block a user