diff --git a/src/rom/app.py b/src/rom/app.py index 0179833..de87ae5 100644 --- a/src/rom/app.py +++ b/src/rom/app.py @@ -271,7 +271,9 @@ async def fetch_weather_data(city=None): advice = wdata.get("advice", []) lunar = wdata.get("lunar", None) - ip = wifi_manager.get_ip() + if city == "N/A": + advice.append("城市配置错误") + advice.append(wifi_manager.get_ip()) display.update_ui( city, @@ -279,7 +281,6 @@ async def fetch_weather_data(city=None): advice, aqi, lunar, - ip, envdat={"t": t, "rh": rh, "co2": co2, "pm": pm, "ap": ap}, ) else: diff --git a/src/rom/display.py b/src/rom/display.py index 4475ec3..583fde9 100644 --- a/src/rom/display.py +++ b/src/rom/display.py @@ -49,7 +49,7 @@ class Display: # 初始化显示屏 self.tft = ST7789( - SPI(1, 40_000_000, polarity=1), + SPI(1, 40_000_000, polarity=1, phase=1), 240, 240, dc=Pin(0, Pin.OUT), @@ -68,7 +68,7 @@ class Display: self.tft.init() self.tft.fill(0) self.show_jpg(self.bootimg, 80, 80) - self.message("WS2 v1.3.6 (20260203)") + self.message("WS2 v1.3.7 (20260203)") _print_mem() return True @@ -146,7 +146,7 @@ class Display: self.window("配置设备网络连接", tips, "portal ip: 192.168.4.1") # 更新ui数据 - def update_ui(self, city=None, weather=None, advice=None, aqi=None, lunar=None, ip=None, envdat=None): + def update_ui(self, city=None, weather=None, advice=None, aqi=None, lunar=None, envdat=None): self.ticks += 1 if self.ui_type == 'default': # 中文的城市名称 @@ -161,7 +161,6 @@ class Display: self.ui_data['weather'] = weather # 建议信息可能有很多条,需要轮换展示 if advice is not None and advice != self.ui_data.get('advice'): - if ip is not None: advice.append(ip) self.ui_data['advice'] = advice # AQI等级分成0-5级,分别对应优、良、中、差、污、恶 if aqi is not None and aqi != self.ui_data.get('aqi'): diff --git a/src/rom/www/index.html b/src/rom/www/index.html index a21acb7..35d4147 100644 --- a/src/rom/www/index.html +++ b/src/rom/www/index.html @@ -129,7 +129,7 @@ WS2是一款基于ESP8266的桌面气象站,能够实时显示天气信息、 href="https://iot.foresh.com/git/kicer/ws2/releases" target="_blank" > -ws2-firmware-v1.3.6-4M.bin 开源
协议: HTTP REST API
更新频率: 每小时

开放源码