lcd: spi init with phase=1
This commit is contained in:
@@ -271,7 +271,9 @@ async def fetch_weather_data(city=None):
|
|||||||
advice = wdata.get("advice", [])
|
advice = wdata.get("advice", [])
|
||||||
lunar = wdata.get("lunar", None)
|
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(
|
display.update_ui(
|
||||||
city,
|
city,
|
||||||
@@ -279,7 +281,6 @@ async def fetch_weather_data(city=None):
|
|||||||
advice,
|
advice,
|
||||||
aqi,
|
aqi,
|
||||||
lunar,
|
lunar,
|
||||||
ip,
|
|
||||||
envdat={"t": t, "rh": rh, "co2": co2, "pm": pm, "ap": ap},
|
envdat={"t": t, "rh": rh, "co2": co2, "pm": pm, "ap": ap},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Display:
|
|||||||
|
|
||||||
# 初始化显示屏
|
# 初始化显示屏
|
||||||
self.tft = ST7789(
|
self.tft = ST7789(
|
||||||
SPI(1, 40_000_000, polarity=1),
|
SPI(1, 40_000_000, polarity=1, phase=1),
|
||||||
240,
|
240,
|
||||||
240,
|
240,
|
||||||
dc=Pin(0, Pin.OUT),
|
dc=Pin(0, Pin.OUT),
|
||||||
@@ -68,7 +68,7 @@ class Display:
|
|||||||
self.tft.init()
|
self.tft.init()
|
||||||
self.tft.fill(0)
|
self.tft.fill(0)
|
||||||
self.show_jpg(self.bootimg, 80, 80)
|
self.show_jpg(self.bootimg, 80, 80)
|
||||||
self.message("WS2 v1.3.6 (20260203)")
|
self.message("WS2 v1.3.7 (20260203)")
|
||||||
|
|
||||||
_print_mem()
|
_print_mem()
|
||||||
return True
|
return True
|
||||||
@@ -146,7 +146,7 @@ class Display:
|
|||||||
self.window("配置设备网络连接", tips, "portal ip: 192.168.4.1")
|
self.window("配置设备网络连接", tips, "portal ip: 192.168.4.1")
|
||||||
|
|
||||||
# 更新ui数据
|
# 更新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
|
self.ticks += 1
|
||||||
if self.ui_type == 'default':
|
if self.ui_type == 'default':
|
||||||
# 中文的城市名称
|
# 中文的城市名称
|
||||||
@@ -161,7 +161,6 @@ class Display:
|
|||||||
self.ui_data['weather'] = weather
|
self.ui_data['weather'] = weather
|
||||||
# 建议信息可能有很多条,需要轮换展示
|
# 建议信息可能有很多条,需要轮换展示
|
||||||
if advice is not None and advice != self.ui_data.get('advice'):
|
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
|
self.ui_data['advice'] = advice
|
||||||
# AQI等级分成0-5级,分别对应优、良、中、差、污、恶
|
# AQI等级分成0-5级,分别对应优、良、中、差、污、恶
|
||||||
if aqi is not None and aqi != self.ui_data.get('aqi'):
|
if aqi is not None and aqi != self.ui_data.get('aqi'):
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ WS2是一款基于ESP8266的桌面气象站,能够实时显示天气信息、
|
|||||||
href="https://iot.foresh.com/git/kicer/ws2/releases"
|
href="https://iot.foresh.com/git/kicer/ws2/releases"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
ws2-firmware-v1.3.6-4M.bin </a
|
ws2-firmware-xxx-4M.bin </a
|
||||||
><span class="badge badge-success">开源</span></div><div class="list-item"><strong>协议:</strong> HTTP REST API
|
><span class="badge badge-success">开源</span></div><div class="list-item"><strong>协议:</strong> HTTP REST API
|
||||||
</div><div class="list-item"><strong>更新频率:</strong> 每小时
|
</div><div class="list-item"><strong>更新频率:</strong> 每小时
|
||||||
</div></div></div></div><h3 class="mt-3">开放源码</h3><a
|
</div></div></div></div><h3 class="mt-3">开放源码</h3><a
|
||||||
|
|||||||
Reference in New Issue
Block a user