kopia lustrzana https://github.com/sq9atk/sr0wx
naprawienie błędu otwierania portu szeregowego
rodzic
a51d8a05be
commit
e488ab88e9
39
config.py
39
config.py
|
@ -16,9 +16,6 @@
|
||||||
# sudo apt-get install ffmpeg
|
# sudo apt-get install ffmpeg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# UWAGA MINT 13
|
# UWAGA MINT 13
|
||||||
# z uwagi na fakt zakończenia wsparcia do mint 13 należy przepiąć źródła oprogramowania:
|
# z uwagi na fakt zakończenia wsparcia do mint 13 należy przepiąć źródła oprogramowania:
|
||||||
# odpalamy w konsoli:
|
# odpalamy w konsoli:
|
||||||
|
@ -27,11 +24,11 @@
|
||||||
#
|
#
|
||||||
# z pliku usuwamy wszystko i wstawiamy poniższe linijki (oczywiście bez hashów na poczatku),
|
# z pliku usuwamy wszystko i wstawiamy poniższe linijki (oczywiście bez hashów na poczatku),
|
||||||
#
|
#
|
||||||
# deb http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse
|
# deb http://old-releases.ubuntu.com/ubuntu/ precise main restricted universe multiverse
|
||||||
# deb http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
|
# deb http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
|
||||||
# deb http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
|
# deb http://old-releases.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
|
||||||
# #Optional
|
# #Optional
|
||||||
# deb http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
|
# deb http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
|
||||||
#
|
#
|
||||||
# zapisujemy plik CTRL+S
|
# zapisujemy plik CTRL+S
|
||||||
#
|
#
|
||||||
|
@ -51,6 +48,18 @@
|
||||||
# i potem ma się zainstalować ffmpg
|
# i potem ma się zainstalować ffmpg
|
||||||
|
|
||||||
|
|
||||||
|
# UWAGA!
|
||||||
|
# Jeśli ptt sterujesz przez port COM i otrzymujesz błąd:
|
||||||
|
# Failed to open serial port /dev/ttyS0@9600
|
||||||
|
#
|
||||||
|
# Dodaj aktualnego użytkownika na którym odpalasz pogodynkędo grupy dialout
|
||||||
|
# sudo gpasswd --add ${USER} dialout
|
||||||
|
# oraz
|
||||||
|
# w config.py zaraz po:
|
||||||
|
# serial_port = '/dev/ttyS0'
|
||||||
|
# serial_baud_rate = 9600
|
||||||
|
# dopisz:
|
||||||
|
# serial_signal = 'DTR'
|
||||||
|
|
||||||
|
|
||||||
import logging, logging.handlers
|
import logging, logging.handlers
|
||||||
|
@ -75,14 +84,13 @@ log_handlers = [{
|
||||||
|
|
||||||
serial_port = '/dev/ttyS0'
|
serial_port = '/dev/ttyS0'
|
||||||
serial_baud_rate = 9600
|
serial_baud_rate = 9600
|
||||||
|
serial_signal = 'DTR'
|
||||||
|
|
||||||
|
|
||||||
import pl_google.pl_google as pl_google
|
import pl_google.pl_google as pl_google
|
||||||
lang = "pl_google"
|
lang = "pl_google"
|
||||||
pygame_bug = 0
|
pygame_bug = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hello_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa']
|
hello_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa']
|
||||||
goodbye_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa']
|
goodbye_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa']
|
||||||
|
|
||||||
|
@ -127,8 +135,6 @@ openweathersq9atk = OpenWeatherSq9atk(
|
||||||
# language=pl_google,
|
# language=pl_google,
|
||||||
# service_url="https://pogoda.onet.pl/prognoza-pogody/krakow-306020",
|
# service_url="https://pogoda.onet.pl/prognoza-pogody/krakow-306020",
|
||||||
#)
|
#)
|
||||||
|
|
||||||
|
|
||||||
# Warszawa: https://pogoda.onet.pl/prognoza-pogody/warszawa-357732
|
# Warszawa: https://pogoda.onet.pl/prognoza-pogody/warszawa-357732
|
||||||
# Kraków: https://pogoda.onet.pl/prognoza-pogody/krakow-306020
|
# Kraków: https://pogoda.onet.pl/prognoza-pogody/krakow-306020
|
||||||
# Wrocław: https://pogoda.onet.pl/prognoza-pogody/wroclaw-362450
|
# Wrocław: https://pogoda.onet.pl/prognoza-pogody/wroclaw-362450
|
||||||
|
@ -150,7 +156,6 @@ openweathersq9atk = OpenWeatherSq9atk(
|
||||||
# Gdynia: https://pogoda.onet.pl/prognoza-pogody/gdynia-287798
|
# Gdynia: https://pogoda.onet.pl/prognoza-pogody/gdynia-287798
|
||||||
# Częstochowa: https://pogoda.onet.pl/prognoza-pogody/czestochowa-280687
|
# Częstochowa: https://pogoda.onet.pl/prognoza-pogody/czestochowa-280687
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# meteoalarm_sq9atk
|
# meteoalarm_sq9atk
|
||||||
# -----------------
|
# -----------------
|
||||||
|
@ -177,7 +182,6 @@ meteoalarmsq9atk = MeteoalarmSq9atk(region="IT003") # testowo Lombardia
|
||||||
# PL802-Pomorze Zachodnie
|
# PL802-Pomorze Zachodnie
|
||||||
# IT003-Lombardia
|
# IT003-Lombardia
|
||||||
|
|
||||||
|
|
||||||
# -------------
|
# -------------
|
||||||
# imgw_podest_sq9atk
|
# imgw_podest_sq9atk
|
||||||
# ------------
|
# ------------
|
||||||
|
@ -348,7 +352,6 @@ airpollutionsq9atk = AirPollutionSq9atk(
|
||||||
# 10447 Kraków, os. Wadów
|
# 10447 Kraków, os. Wadów
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
# geomagnetic_sq9atk
|
# geomagnetic_sq9atk
|
||||||
# --------------------
|
# --------------------
|
||||||
|
@ -382,7 +385,6 @@ radioactivesq9atk = RadioactiveSq9atk(
|
||||||
## więcej czujników na stronie http://radioactiveathome.org/map/
|
## więcej czujników na stronie http://radioactiveathome.org/map/
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# ---------------
|
# ---------------
|
||||||
# propagation_sq9atk
|
# propagation_sq9atk
|
||||||
# ---------------
|
# ---------------
|
||||||
|
@ -392,7 +394,6 @@ propagationsq9atk = PropagationSq9atk(
|
||||||
service_url="https://rigreference.com/solar/img/tall",
|
service_url="https://rigreference.com/solar/img/tall",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# ---------------
|
# ---------------
|
||||||
# calendar_sq9atk
|
# calendar_sq9atk
|
||||||
# ---------------
|
# ---------------
|
||||||
|
@ -418,8 +419,6 @@ calendarsq9atk = CalendarSq9atk(
|
||||||
# 756135 Warsaw
|
# 756135 Warsaw
|
||||||
# 3081368 Wrocław
|
# 3081368 Wrocław
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# WŁĄCZONE MODUŁY
|
# WŁĄCZONE MODUŁY
|
||||||
modules = [
|
modules = [
|
||||||
activitymap,
|
activitymap,
|
||||||
|
@ -431,5 +430,5 @@ modules = [
|
||||||
propagationsq9atk,
|
propagationsq9atk,
|
||||||
geomagneticsq9atk,
|
geomagneticsq9atk,
|
||||||
radioactivesq9atk,
|
radioactivesq9atk,
|
||||||
calendarsq9atk,
|
calendarsq9atk,
|
||||||
]
|
]
|
||||||
|
|
30
sr0wx.py
30
sr0wx.py
|
@ -231,19 +231,19 @@ for el in message:
|
||||||
if config.serial_port is not None:
|
if config.serial_port is not None:
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
try:
|
#try:
|
||||||
ser = serial.Serial(config.serial_port, config.serial_baud_rate)
|
ser = serial.Serial(config.serial_port, config.serial_baud_rate)
|
||||||
if config.serial_signal == 'DTR':
|
if config.serial_signal == 'DTR':
|
||||||
logger.info(COLOR_OKGREEN + "RTS/PTT set to ON\n" + COLOR_ENDC)
|
logger.info(COLOR_OKGREEN + "RTS/PTT set to ON\n" + COLOR_ENDC)
|
||||||
ser.setDTR(0)
|
ser.setDTR(0)
|
||||||
ser.setRTS(1)
|
ser.setRTS(1)
|
||||||
else:
|
else:
|
||||||
logger.info(COLOR_OKGREEN + "DTR/PTT set to ON\n" + COLOR_ENDC)
|
logger.info(COLOR_OKGREEN + "DTR/PTT set to ON\n" + COLOR_ENDC)
|
||||||
ser.setDTR(1)
|
ser.setDTR(1)
|
||||||
ser.setRTS(0)
|
ser.setRTS(0)
|
||||||
except:
|
#except:
|
||||||
log = COLOR_FAIL + "Failed to open serial port %s@%i\n" + COLOR_ENDC
|
# log = COLOR_FAIL + "Failed to open serial port %s@%i\n" + COLOR_ENDC
|
||||||
logger.error(log, config.serial_port, config.serial_baud_rate)
|
# logger.error(log, config.serial_port, config.serial_baud_rate)
|
||||||
|
|
||||||
|
|
||||||
pygame.time.delay(1000)
|
pygame.time.delay(1000)
|
||||||
|
@ -283,7 +283,7 @@ for el in message:
|
||||||
# other stuff) before closing the ``pygame`` mixer and display some debug
|
# other stuff) before closing the ``pygame`` mixer and display some debug
|
||||||
# informations.
|
# informations.
|
||||||
|
|
||||||
logger.info(COLOR_WARNING + "finishing..." + COLOR_ENDC)
|
logger.info(COLOR_WARNING + "finishing...\n" + COLOR_ENDC)
|
||||||
|
|
||||||
pygame.time.delay(1000)
|
pygame.time.delay(1000)
|
||||||
|
|
||||||
|
@ -291,7 +291,9 @@ pygame.time.delay(1000)
|
||||||
try:
|
try:
|
||||||
if config.serial_port is not None:
|
if config.serial_port is not None:
|
||||||
ser.close()
|
ser.close()
|
||||||
|
logger.info(COLOR_OKGREEN + "RTS/PTT set to OF\n" + COLOR_ENDC)
|
||||||
except NameError:
|
except NameError:
|
||||||
|
# sudo gpasswd --add ${USER} dialout
|
||||||
logger.exception(COLOR_FAIL + "Couldn't close serial port" + COLOR_ENDC)
|
logger.exception(COLOR_FAIL + "Couldn't close serial port" + COLOR_ENDC)
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue