-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from spitzlbergerj/development
diverse Fehlerbehebungen und Verbesserungen/Stabilisierungen
- Loading branch information
Showing
31 changed files
with
3,518 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Plymouth Theme] | ||
Name=CaravanPi | ||
Description=CaravanPi Splash | ||
ModuleName=script | ||
|
||
[script] | ||
ImageDir=/usr/share/plymouth/themes/CaravanPi | ||
ScriptFile=/usr/share/plymouth/themes/CaravanPi/CaravanPi.script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
screen_width = Window.GetWidth(); | ||
screen_height = Window.GetHeight(); | ||
|
||
if (Plymouth.GetMode() != "shutdown") | ||
{ | ||
theme_image = Image("splash.png"); | ||
} | ||
else | ||
{ | ||
theme_image = Image("splash_halt.png"); | ||
} | ||
|
||
image_width = theme_image.GetWidth(); | ||
image_height = theme_image.GetHeight(); | ||
|
||
scale_x = image_width / screen_width; | ||
scale_y = image_height / screen_height; | ||
|
||
if (scale_x > 1 || scale_y > 1) | ||
{ | ||
if (scale_x > scale_y) | ||
{ | ||
resized_image = theme_image.Scale (screen_width, image_height / scale_x); | ||
image_x = 0; | ||
image_y = (screen_height - ((image_height * screen_width) / image_width)) / 2; | ||
} | ||
else | ||
{ | ||
resized_image = theme_image.Scale (image_width / scale_y, screen_height); | ||
image_x = (screen_width - ((image_width * screen_height) / image_height)) / 2; | ||
image_y = 0; | ||
} | ||
} | ||
else | ||
{ | ||
resized_image = theme_image.Scale (image_width, image_height); | ||
image_x = (screen_width - image_width) / 2; | ||
image_y = (screen_height - image_height) / 2; | ||
} | ||
|
||
sprite = Sprite (resized_image); | ||
sprite.SetPosition (image_x, image_y, -100); | ||
|
||
message_sprite = Sprite(); | ||
message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.9, 10000); | ||
|
||
fun message_callback (text) { | ||
my_image = Image.Text(text, 1, 1, 1); | ||
message_sprite.SetImage(my_image); | ||
sprite.SetImage (resized_image); | ||
} | ||
|
||
Plymouth.SetUpdateStatusFunction(message_callback); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import serial | ||
import threading | ||
from time import sleep | ||
import time | ||
import datetime | ||
import os | ||
|
||
serial_port = serial.Serial() | ||
|
||
serial_port.baudrate = 38400 | ||
serial_port.port = '/dev/serial0' | ||
serial_port.timeout = 1 | ||
serial_port.bytesize = 8 | ||
serial_port.stopbits = 1 | ||
serial_port.parity = serial.PARITY_NONE | ||
|
||
|
||
if serial_port.isOpen(): serial_port.close() | ||
serial_port.open() | ||
|
||
|
||
try: | ||
serial_port.write(str.encode('Q')) | ||
sleep(1) | ||
serial_port.write(str.encode('\x0D')) | ||
sleep(1) | ||
serial_port.write(str.encode('date-rpi')) | ||
sleep(0.1) | ||
serial_port.write(str.encode('\x0D')) | ||
data = serial_port.read(9999); | ||
date = int(data) | ||
|
||
strompi_year = date // 10000 | ||
strompi_month = date % 10000 // 100 | ||
strompi_day = date % 100 | ||
|
||
sleep(0.1) | ||
serial_port.write(str.encode('time-rpi')) | ||
sleep(0.1) | ||
serial_port.write(str.encode('\x0D')) | ||
data = serial_port.read(9999); | ||
timevalue = int(data) | ||
|
||
strompi_hour = timevalue // 10000 | ||
strompi_min = timevalue % 10000 // 100 | ||
strompi_sec = timevalue % 100 | ||
|
||
rpi_time = datetime.datetime.now().replace(microsecond=0) | ||
strompi_time = datetime.datetime(2000 + strompi_year, strompi_month, strompi_day, strompi_hour, strompi_min, strompi_sec, 0) | ||
|
||
command = 'set-time %02d %02d %02d' % (int(rpi_time.strftime('%H')),int(rpi_time.strftime('%M')),int(rpi_time.strftime('%S'))) | ||
|
||
if rpi_time > strompi_time: | ||
serial_port.write(str.encode('set-date %02d %02d %02d %02d' % (int(rpi_time.strftime('%d')),int(rpi_time.strftime('%m')),int(rpi_time.strftime('%Y'))%100,int(rpi_time.isoweekday())))) | ||
sleep(0.5) | ||
serial_port.write(str.encode('\x0D')) | ||
sleep(1) | ||
serial_port.write(str.encode('set-clock %02d %02d %02d' % (int(rpi_time.strftime('%H')),int(rpi_time.strftime('%M')),int(rpi_time.strftime('%S'))))) | ||
sleep(0.5) | ||
serial_port.write(str.encode('\x0D')) | ||
|
||
print ('-----------------------------------------') | ||
print ('The date und time has been synced: Raspberry Pi -> StromPi') | ||
print ('-----------------------------------------') | ||
|
||
else: | ||
os.system('sudo date +%%y%%m%%d --set=%02d%02d%02d' % (strompi_year, strompi_month, strompi_day)) | ||
os.system('sudo date +%%T -s "%02d:%02d:%02d"' % (strompi_hour, strompi_min, strompi_sec)) | ||
print ('-----------------------------------------') | ||
print ('The date und time has been synced: StromPi -> Raspberry Pi') | ||
print ('-----------------------------------------') | ||
|
||
except KeyboardInterrupt: | ||
print('interrupted!') | ||
|
||
serial_port.close() |
Oops, something went wrong.