mirror of
https://github.com/kxgx/2.13-Ink-screen-clock.git
synced 2026-05-12 02:35:04 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
118cc0a2ee | ||
|
|
3155088921 | ||
|
|
28f0a9d37d |
40
bin/main.py
40
bin/main.py
@@ -36,7 +36,7 @@ def get_date():#返回当前年月日及星期几
|
|||||||
today=LunarDate.today()
|
today=LunarDate.today()
|
||||||
week_day_dict = {0: '星期一',1: '星期二',2: '星期三',3: '星期四',4: '星期五',5: '星期六',6: '星期日',}
|
week_day_dict = {0: '星期一',1: '星期二',2: '星期三',3: '星期四',4: '星期五',5: '星期六',6: '星期日',}
|
||||||
day = date.weekday()
|
day = date.weekday()
|
||||||
return time.strftime('%Y年%m月%d日')+' '+week_day_dict[day]+' '+today.strftime('农 %M月%D')
|
return time.strftime('%Y年%m月%d日')+''+week_day_dict[day]+''+today.strftime('农历%M月%D')
|
||||||
def get_time():#返回当前时间,不到秒,大写
|
def get_time():#返回当前时间,不到秒,大写
|
||||||
return time.strftime('%H:%M')
|
return time.strftime('%H:%M')
|
||||||
def Get_address():#获取当前的IP地址
|
def Get_address():#获取当前的IP地址
|
||||||
@@ -125,14 +125,14 @@ def Basic_refresh(): #全刷函数
|
|||||||
cpu_temp = str(CPU_temperature()) # 调用函数并转换为字符串
|
cpu_temp = str(CPU_temperature()) # 调用函数并转换为字符串
|
||||||
text_to_display = "CPU温度:" + cpu_temp + "°C"
|
text_to_display = "CPU温度:" + cpu_temp + "°C"
|
||||||
draw.text((4, 19), text_to_display, font=font06, fill=0) # 绘制文本
|
draw.text((4, 19), text_to_display, font=font06, fill=0) # 绘制文本
|
||||||
global mem_use
|
|
||||||
mem_use = str(Memory_footprint()) # 调用函数并转换为字符串
|
|
||||||
text_to_display = "内存占用:" + mem_use + "%" # 连接字符串
|
|
||||||
draw.text((4, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
|
||||||
global cpu_use
|
global cpu_use
|
||||||
cpu_use = str(CPU_usage()) # 调用函数并转换为字符串
|
cpu_use = str(CPU_usage()) # 调用函数并转换为字符串
|
||||||
text_to_display = "CPU占用:" + cpu_use + "%"
|
text_to_display = "CPU占用:" + cpu_use + "%"
|
||||||
draw.text((90, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
draw.text((4, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
||||||
|
global mem_use
|
||||||
|
mem_use = str(Memory_footprint()) # 调用函数并转换为字符串
|
||||||
|
text_to_display = "内存占用:" + mem_use + "%" # 连接字符串
|
||||||
|
draw.text((86, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
||||||
Bottom_edge() #添加底边内容
|
Bottom_edge() #添加底边内容
|
||||||
Weather() #天气内容
|
Weather() #天气内容
|
||||||
epd.display(epd.getbuffer(info_image.rotate(180)))
|
epd.display(epd.getbuffer(info_image.rotate(180)))
|
||||||
@@ -237,30 +237,30 @@ def Partial_refresh():#局刷函数
|
|||||||
Local_strong_brush() #局部强刷
|
Local_strong_brush() #局部强刷
|
||||||
#logging.info("CPU温度局部刷新")
|
#logging.info("CPU温度局部刷新")
|
||||||
'''CPU温度显示'''
|
'''CPU温度显示'''
|
||||||
'''内存百分比显示'''
|
|
||||||
global mem_use
|
|
||||||
mem_use1 =Memory_footprint()
|
|
||||||
if (mem_use1==mem_use) ==False:
|
|
||||||
draw.rectangle((1, 84, 90, 98), fill = 255)
|
|
||||||
mem_use = str(Memory_footprint()) # 调用函数并转换为字符串
|
|
||||||
text_to_display = "内存占用:" + mem_use + "%" # 连接字符串
|
|
||||||
draw.text((4, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
|
||||||
mem_use1=mem_use
|
|
||||||
Local_strong_brush() #局部强刷
|
|
||||||
#logging.info("内存百分比局部刷新")
|
|
||||||
'''内存百分比显示'''
|
|
||||||
'''CPU占用显示'''
|
'''CPU占用显示'''
|
||||||
global cpu_use
|
global cpu_use
|
||||||
cpu_use1 =CPU_usage()
|
cpu_use1 =CPU_usage()
|
||||||
if (cpu_use1==cpu_use) ==False:
|
if (cpu_use1==cpu_use) ==False:
|
||||||
draw.rectangle((90, 84, 170, 98), fill = 255)
|
draw.rectangle((1, 84, 85, 98), fill = 255)
|
||||||
cpu_use = str(CPU_usage()) # 调用函数并转换为字符串
|
cpu_use = str(CPU_usage()) # 调用函数并转换为字符串
|
||||||
text_to_display = "CPU占用:" + cpu_use + "%"
|
text_to_display = "CPU占用:" + cpu_use + "%"
|
||||||
draw.text((90, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
draw.text((4, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
||||||
cpu_use1=cpu_use
|
cpu_use1=cpu_use
|
||||||
Local_strong_brush() #局部强刷
|
Local_strong_brush() #局部强刷
|
||||||
#logging.info("CPU温度局部刷新")
|
#logging.info("CPU温度局部刷新")
|
||||||
'''CPU占用显示'''
|
'''CPU占用显示'''
|
||||||
|
'''内存百分比显示'''
|
||||||
|
global mem_use
|
||||||
|
mem_use1 =Memory_footprint()
|
||||||
|
if (mem_use1==mem_use) ==False:
|
||||||
|
draw.rectangle((86, 84, 170, 98), fill = 255)
|
||||||
|
mem_use = str(Memory_footprint()) # 调用函数并转换为字符串
|
||||||
|
text_to_display = "内存占用:" + mem_use + "%" # 连接字符串
|
||||||
|
draw.text((86, 84), text_to_display, font=font06, fill=0) # 绘制文本
|
||||||
|
mem_use1=mem_use
|
||||||
|
Local_strong_brush() #局部强刷
|
||||||
|
#logging.info("内存百分比局部刷新")
|
||||||
|
'''内存百分比显示'''
|
||||||
|
|
||||||
retry_interval = 180 # 设置重试间隔时间(秒)
|
retry_interval = 180 # 设置重试间隔时间(秒)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user