Implemented debug option and ImageFileAdapter to main-file and fixed some string formating errors.
This commit is contained in:
parent
2785542aa0
commit
a6cede3554
1 changed files with 15 additions and 11 deletions
|
@ -23,11 +23,15 @@ try:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Something didn't work right, maybe you're offline?"+e.reason)
|
print("Something didn't work right, maybe you're offline?"+e.reason)
|
||||||
|
|
||||||
if display_colours == "bwr":
|
DEBUG_TO_FILE = True
|
||||||
|
|
||||||
|
if DEBUG_TO_FILE:
|
||||||
|
import ImageFileAdapter
|
||||||
|
epd = ImageFileAdapter.ImageFileAdapter()
|
||||||
|
elif display_colours == "bwr":
|
||||||
import Epd7in5bAdapter
|
import Epd7in5bAdapter
|
||||||
epd = Epd7in5bAdapter.Epd7in5bAdapter()
|
epd = Epd7in5bAdapter.Epd7in5bAdapter()
|
||||||
|
elif display_colours == "bw":
|
||||||
if display_colours == "bw":
|
|
||||||
import Epd7in5Adapter
|
import Epd7in5Adapter
|
||||||
epd = Epd7in5Adapter.Epd7in5Adapter()
|
epd = Epd7in5Adapter.Epd7in5Adapter()
|
||||||
|
|
||||||
|
@ -41,8 +45,8 @@ def main():
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
time = datetime.now()
|
time = datetime.now()
|
||||||
hour = int(time.strftime("%-H"))
|
hour = int(time.strftime("%H"))
|
||||||
month = int(time.now().strftime('%-m'))
|
month = int(time.now().strftime('%m'))
|
||||||
year = int(time.now().strftime('%Y'))
|
year = int(time.now().strftime('%Y'))
|
||||||
|
|
||||||
for i in range(1):
|
for i in range(1):
|
||||||
|
@ -54,7 +58,7 @@ def main():
|
||||||
print('performing calibration for colours now')
|
print('performing calibration for colours now')
|
||||||
calibration()
|
calibration()
|
||||||
|
|
||||||
print('Date:', time.strftime('%a %-d %b %y')+', time: '+time.strftime('%H:%M')+'\n')
|
print('Date:', time.strftime('%a %d %b %y')+', time: '+time.strftime('%H:%M')+'\n')
|
||||||
|
|
||||||
"""Create a blank white page, for debugging, change mode to
|
"""Create a blank white page, for debugging, change mode to
|
||||||
to 'RGB' and and save the image by uncommenting the image.save
|
to 'RGB' and and save the image by uncommenting the image.save
|
||||||
|
@ -140,12 +144,12 @@ def main():
|
||||||
write_text(100, 35, windspeed+" mph", (114, 0))
|
write_text(100, 35, windspeed+" mph", (114, 0))
|
||||||
|
|
||||||
if hours == "24":
|
if hours == "24":
|
||||||
sunrisetime = str(datetime.fromtimestamp(int(weather.get_sunrise_time(timeformat='unix'))).strftime('%-H:%M'))
|
sunrisetime = str(datetime.fromtimestamp(int(weather.get_sunrise_time(timeformat='unix'))).strftime('%H:%M'))
|
||||||
sunsettime = str(datetime.fromtimestamp(int(weather.get_sunset_time(timeformat='unix'))).strftime('%-H:%M'))
|
sunsettime = str(datetime.fromtimestamp(int(weather.get_sunset_time(timeformat='unix'))).strftime('%H:%M'))
|
||||||
|
|
||||||
if hours == "12":
|
if hours == "12":
|
||||||
sunrisetime = str(datetime.fromtimestamp(int(weather.get_sunrise_time(timeformat='unix'))).strftime('%-I:%M'))
|
sunrisetime = str(datetime.fromtimestamp(int(weather.get_sunrise_time(timeformat='unix'))).strftime('%I:%M'))
|
||||||
sunsettime = str(datetime.fromtimestamp(int(weather.get_sunset_time(timeformat='unix'))).strftime('%-I:%M'))
|
sunsettime = str(datetime.fromtimestamp(int(weather.get_sunset_time(timeformat='unix'))).strftime('%I:%M'))
|
||||||
|
|
||||||
print('Temperature: '+Temperature+' °C')
|
print('Temperature: '+Temperature+' °C')
|
||||||
print('Humidity: '+Humidity+'%')
|
print('Humidity: '+Humidity+'%')
|
||||||
|
@ -275,7 +279,7 @@ def main():
|
||||||
epd.render(image)
|
epd.render(image)
|
||||||
|
|
||||||
for i in range(1):
|
for i in range(1):
|
||||||
nexthour = ((60 - int(time.strftime("%-M")))*60) - (int(time.strftime("%-S")))
|
nexthour = ((60 - int(time.strftime("%M")))*60) - (int(time.strftime("%S")))
|
||||||
sleep(nexthour)
|
sleep(nexthour)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue