Fix reset dish state and debug values
This commit is contained in:
@@ -230,6 +230,9 @@ async def request_cloud_cooking_plan(microwave_id, sensors_data):
|
||||
print(f"[{microwave_id}] Cloud Plan Received! Starting microwave: {c_time}s @ {c_power}W")
|
||||
cloud_alert = False # Reset alert flag on success
|
||||
microwave_states[microwave_id] = MicrowaveState.COOKING
|
||||
if config.DEBUG:
|
||||
c_time = min(c_time, 10) # Limit to 10s for debug
|
||||
c_temp = min(c_temp, 50) # Limit to 50°C for debug
|
||||
mqtt_client.publish(
|
||||
config.MQTT_TOPIC_COOKING,
|
||||
payloads.mqtt_cooking_config(microwave_id, c_time, c_power, c_temp),
|
||||
@@ -306,8 +309,8 @@ async def get_filtered_dish_height(samples=3, delay=0.04):
|
||||
valid_samples = []
|
||||
for _ in range(samples):
|
||||
h = await asyncio.to_thread(ultrasonicRanger.get_dish_height)
|
||||
# Discard 0.0 or near-zero timeout glitches
|
||||
if h is not None and h > 0.5:
|
||||
# Discard negative glitches
|
||||
if h is not None and h >= 0.0:
|
||||
valid_samples.append(h)
|
||||
await asyncio.sleep(delay)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user