Compare commits

...

6 Commits

Author SHA1 Message Date
Ninluc 0f576467e1 send_reliably if cooking state update
Build, push image, and notify Watchtower / build-image (push) Successful in 40s
Build, push image, and notify Watchtower / notify (push) Successful in 15s
2026-08-23 16:19:09 +02:00
Ninluc 9d1a1f4c78 Try with normal image 2026-08-23 16:18:53 +02:00
Ninluc 701e7f1491 Reapply "Fix move to new messages"
This reverts commit e652831ce5.
2026-08-23 16:14:04 +02:00
Ninluc e652831ce5 Revert "Fix move to new messages"
This reverts commit 3bead59b23.
2026-08-23 16:12:15 +02:00
Ninluc ebc28546bc Better camera settings 2026-08-23 16:10:11 +02:00
Ninluc a51bfc1388 Bigger gaps 2026-08-23 16:10:00 +02:00
4 changed files with 23 additions and 16 deletions
+1 -1
View File
@@ -250,7 +250,7 @@ async def cooking_params():
enhanced_filepath = enhance_image_for_ai(filepath) enhanced_filepath = enhance_image_for_ai(filepath)
# Concurrent AI Execution # Concurrent AI Execution
safety_task = asyncio.to_thread(safety_checker.check_dish_safety, enhanced_filepath) safety_task = asyncio.to_thread(safety_checker.check_dish_safety, filepath)
planner_task = asyncio.to_thread( planner_task = asyncio.to_thread(
microwave_cook_planner.generate_plan, microwave_cook_planner.generate_plan,
image_path=enhanced_filepath, image_path=enhanced_filepath,
+13 -3
View File
@@ -49,19 +49,26 @@ PING_PAYLOAD = {
"type": deviceTypes.DEVICE_TYPES["MICROWAVE"] "type": deviceTypes.DEVICE_TYPES["MICROWAVE"]
} }
last_cooking_update = {}
def send_cooking_update(state=None, start_time=None, estimated_remaining_time=None, paused=None): def send_cooking_update(state=None, start_time=None, estimated_remaining_time=None, paused=None):
"""Sends a flexible COOKING_UPDATE payload containing only populated fields.""" """Sends a flexible COOKING_UPDATE payload containing only populated fields."""
global last_cooking_update
if not lora: if not lora:
return return
send_reliably = False
payload = { payload = {
"id": DEVICE_ID, "id": DEVICE_ID,
"action": LoraCommands.COOKING_UPDATE "action": LoraCommands.COOKING_UPDATE
} }
if state is not None: if state is not None and state != last_cooking_update.get("cooking_state"):
payload["cooking_state"] = state payload["cooking_state"] = state
send_reliably = True
if estimated_remaining_time is not None: if estimated_remaining_time is not None:
payload["estimated_remaining_time"] = estimated_remaining_time payload["estimated_remaining_time"] = estimated_remaining_time
if paused is not None: if paused is not None:
@@ -70,8 +77,11 @@ def send_cooking_update(state=None, start_time=None, estimated_remaining_time=No
# Only transmit if at least one field beyond id and action was provided # Only transmit if at least one field beyond id and action was provided
if len(payload) > 2: if len(payload) > 2:
log(f"[LoRa] Sending COOKING_UPDATE payload: {payload}") log(f"[LoRa] Sending COOKING_UPDATE payload: {payload}")
last_cooking_update = payload.copy()
lora.send(payload) if send_reliably:
lora.send_reliable(payload)
else:
lora.send(payload)
def on_new_alert(alert: Alert): def on_new_alert(alert: Alert):
+4 -4
View File
@@ -815,16 +815,16 @@ async def monitor_dish_height_task():
if dist is not None: if dist is not None:
# Hysteresis Thresholds: # Hysteresis Thresholds:
# - Must be > 1.2 cm to detect dish insertion # - Must be > 1.5 cm to detect dish insertion
# - Must be < 0.8 cm to detect dish removal # - Must be < 0.8 cm to detect dish removal
if dist > 1.2: if dist > 2.0:
consecutive_present += 1 consecutive_present += 1
consecutive_absent = 0 consecutive_absent = 0
elif dist < 0.8: elif dist < 1.0:
consecutive_absent += 1 consecutive_absent += 1
consecutive_present = 0 consecutive_present = 0
else: else:
# Dead-zone (1.2cm to 0.8cm) -> Noise buffer # Dead-zone (2.0cm to 1.0cm) -> Noise buffer
consecutive_present = 0 consecutive_present = 0
consecutive_absent = 0 consecutive_absent = 0
+5 -8
View File
@@ -16,14 +16,11 @@ camera_config = picam2.create_still_configuration(
main={"size": (1640, 1232)} main={"size": (1640, 1232)}
) )
picam2.set_controls({ picam2.set_controls({
"AeEnable": False, # Disable Auto Exposure to lock settings "AeEnable": True,
"ExposureTime": 60000, # 40 ms shutter time (brightens without grain) "AwbEnable": True,
"AnalogueGain": 2.0, # Keep gain low to eliminate sensor noise "ExposureTime": 60000,
"AwbEnable": False, # Disable Auto White Balance fluctuation "Brightness": 0.25,
"ColourGains": (1.4, 1.2), # Balanced RGB gains for indoor warm LED "Contrast": 1.1
"Brightness": 0.2, # Slight boost to shadow detail
"Contrast": 1.1, # Crisp edges around metallic surfaces
"ScalerCrop": [0, 0, max_width, max_height] # Uncrop the image
}) })
picam2.configure(camera_config) picam2.configure(camera_config)