Compare commits
2 Commits
5d162f3971
...
9e2674187c
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e2674187c | |||
| 6482965edc |
@ -241,6 +241,7 @@ class TempWebServer:
|
|||||||
|
|
||||||
def _get_status_page(self, sensors, ac_monitor, heater_monitor, show_success=False):
|
def _get_status_page(self, sensors, ac_monitor, heater_monitor, show_success=False):
|
||||||
"""Generate HTML status page."""
|
"""Generate HTML status page."""
|
||||||
|
print("DEBUG: Generating status page...")
|
||||||
try:
|
try:
|
||||||
# Get current temperatures
|
# Get current temperatures
|
||||||
inside_temps = sensors['inside'].read_all_temps(unit='F')
|
inside_temps = sensors['inside'].read_all_temps(unit='F')
|
||||||
@ -320,7 +321,10 @@ class TempWebServer:
|
|||||||
inside_temp_str = "{:.1f}".format(inside_temp) if isinstance(inside_temp, float) else str(inside_temp)
|
inside_temp_str = "{:.1f}".format(inside_temp) if isinstance(inside_temp, float) else str(inside_temp)
|
||||||
outside_temp_str = "{:.1f}".format(outside_temp) if isinstance(outside_temp, float) else str(outside_temp)
|
outside_temp_str = "{:.1f}".format(outside_temp) if isinstance(outside_temp, float) else str(outside_temp)
|
||||||
|
|
||||||
# **NEW: Add HOLD mode banner**
|
# ===== START: Add HOLD mode banner =====
|
||||||
|
# Check if in HOLD mode (schedules exist but are disabled)
|
||||||
|
is_hold_mode = not config.get('schedule_enabled', False) and len(config.get('schedules', [])) > 0
|
||||||
|
|
||||||
hold_banner = ""
|
hold_banner = ""
|
||||||
if is_hold_mode:
|
if is_hold_mode:
|
||||||
hold_banner = """
|
hold_banner = """
|
||||||
@ -328,7 +332,7 @@ class TempWebServer:
|
|||||||
⏸️ HOLD MODE ACTIVE - Manual settings in use (Schedule paused)
|
⏸️ HOLD MODE ACTIVE - Manual settings in use (Schedule paused)
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
# ===== END: Add HOLD mode banner =====
|
||||||
html = """
|
html = """
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|||||||
6
main.py
6
main.py
@ -2,6 +2,7 @@ from machine import Pin
|
|||||||
import time
|
import time
|
||||||
import network
|
import network
|
||||||
import json
|
import json
|
||||||
|
import gc # ADD THIS - for garbage collection
|
||||||
|
|
||||||
# Initialize pins (LED light onboard)
|
# Initialize pins (LED light onboard)
|
||||||
led = Pin("LED", Pin.OUT)
|
led = Pin("LED", Pin.OUT)
|
||||||
@ -249,6 +250,11 @@ while True:
|
|||||||
# Pass schedule_monitor so web interface can reload config when schedules change
|
# Pass schedule_monitor so web interface can reload config when schedules change
|
||||||
web_server.check_requests(sensors, ac_monitor, heater_monitor, schedule_monitor)
|
web_server.check_requests(sensors, ac_monitor, heater_monitor, schedule_monitor)
|
||||||
|
|
||||||
|
# ===== START: Garbage Collection =====
|
||||||
|
# Free up unused memory to prevent fragmentation
|
||||||
|
gc.collect()
|
||||||
|
# ===== END: Garbage Collection =====
|
||||||
|
|
||||||
# Small delay to prevent CPU overload (0.1 seconds = 10 loops per second)
|
# Small delay to prevent CPU overload (0.1 seconds = 10 loops per second)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
# ===== END: Main Loop =====
|
# ===== END: Main Loop =====
|
||||||
Loading…
x
Reference in New Issue
Block a user