mirror of
https://github.com/janishutz/BiogasControllerApp.git
synced 2025-11-25 05:44:23 +00:00
Fixed an error that could cause the app to crash if cloned from the repository.
This commit is contained in:
@@ -85,12 +85,12 @@ class SwitchMode:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def enable_fastmode(self):
|
def enable_fastmode(self, special_port):
|
||||||
com.connect(19200,"")
|
com.connect(19200, special_port)
|
||||||
com.send("FM")
|
com.send("FM")
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
|
|
||||||
def disable_fastmode(self):
|
def disable_fastmode(self, special_port):
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
com.send("NM")
|
com.send("NM")
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class ComportService:
|
|||||||
self.__import = []
|
self.__import = []
|
||||||
self.__working = []
|
self.__working = []
|
||||||
|
|
||||||
def get_comport(self, special_port=""):
|
def get_comport(self, special_port):
|
||||||
self.__comport = [comport.device for comport in serial.tools.list_ports.comports()]
|
self.__comport = [comport.device for comport in serial.tools.list_ports.comports()]
|
||||||
self.__pos = 0
|
self.__pos = 0
|
||||||
if special_port != "":
|
if special_port != "":
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ logger.setLevel(config['Dev Settings']['log_level'])
|
|||||||
logger.info(f"Logger initialized, app is running Version: {version_app}")
|
logger.info(f"Logger initialized, app is running Version: {version_app}")
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
|
if config['Port Settings']['specificPort'] == "None" or "\"\"":
|
||||||
|
special_port = ""
|
||||||
|
else:
|
||||||
|
special_port = config['Port Settings']['specificPort']
|
||||||
|
print(type(special_port))
|
||||||
cvr = bin.lib.csv_parsers.CsvRead()
|
cvr = bin.lib.csv_parsers.CsvRead()
|
||||||
cvw = bin.lib.csv_parsers.CsvWrite()
|
cvw = bin.lib.csv_parsers.CsvWrite()
|
||||||
com = bin.lib.lib.Com()
|
com = bin.lib.lib.Com()
|
||||||
@@ -95,7 +99,7 @@ class DetailInfo(Popup):
|
|||||||
def infos(self):
|
def infos(self):
|
||||||
self.err = ""
|
self.err = ""
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.err += "Errormessage:\n"
|
self.err += "Errormessage:\n"
|
||||||
@@ -106,13 +110,13 @@ class DetailInfo(Popup):
|
|||||||
def error_tips(self):
|
def error_tips(self):
|
||||||
self.err_tip = ""
|
self.err_tip = ""
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.err_tip += "Possible way to resolve the issue: \n\n"
|
self.err_tip += "Possible way to resolve the issue: \n\n"
|
||||||
if str(err)[0:10] == "[Errno 13]":
|
if str(err)[0:10] == "[Errno 13]":
|
||||||
if platform.system() == "Linux":
|
if platform.system() == "Linux":
|
||||||
self.err_tip += f"Open a terminal and type in: sudo chmod 777 {bin.lib.comport_search.ComportService().get_comport()}"
|
self.err_tip += f"Open a terminal and type in: sudo chmod 777 {bin.lib.comport_search.ComportService().get_comport(special_port)}"
|
||||||
elif platform.system() == "Macintosh":
|
elif platform.system() == "Macintosh":
|
||||||
self.err_tip += "Give permission to access the cable"
|
self.err_tip += "Give permission to access the cable"
|
||||||
elif platform.system() == "Windows":
|
elif platform.system() == "Windows":
|
||||||
@@ -130,7 +134,7 @@ class DetailInfo(Popup):
|
|||||||
self.err_tip += "Unknown OS"
|
self.err_tip += "Unknown OS"
|
||||||
elif str(err)[0:34] == "could not open port '/dev/ttyUSB0'":
|
elif str(err)[0:34] == "could not open port '/dev/ttyUSB0'":
|
||||||
self.err_tip += "Please connect the PC with the microcontroller!"
|
self.err_tip += "Please connect the PC with the microcontroller!"
|
||||||
elif str(err)[0:26] == f"could not open port '{bin.lib.comport_search.ComportService().get_comport()}'":
|
elif str(err)[0:26] == f"could not open port '{bin.lib.comport_search.ComportService().get_comport(special_port)}'":
|
||||||
self.err_tip += "Try using a different cable or close all monitoring software (like MSI Afterburner)"
|
self.err_tip += "Try using a different cable or close all monitoring software (like MSI Afterburner)"
|
||||||
else:
|
else:
|
||||||
self.err_tip += "Special Error, consult the manual of Serial"
|
self.err_tip += "Special Error, consult the manual of Serial"
|
||||||
@@ -171,7 +175,7 @@ class HomeScreen(Screen):
|
|||||||
self.connected = 1
|
self.connected = 1
|
||||||
self.info = f"You are currently running Version {version_app} - If you encounter a bug, please report it!"
|
self.info = f"You are currently running Version {version_app} - If you encounter a bug, please report it!"
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
@@ -180,7 +184,7 @@ class HomeScreen(Screen):
|
|||||||
|
|
||||||
def tryconnection(self):
|
def tryconnection(self):
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
com.quitcom()
|
com.quitcom()
|
||||||
self.connected = 1
|
self.connected = 1
|
||||||
self.manager.current = "Readout"
|
self.manager.current = "Readout"
|
||||||
@@ -213,7 +217,7 @@ class ReadoutScreen(Screen):
|
|||||||
|
|
||||||
def comstart(self, pu_on):
|
def comstart(self, pu_on):
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
self.go = 1
|
self.go = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.go = 0
|
self.go = 0
|
||||||
@@ -331,9 +335,9 @@ class ReadoutScreen(Screen):
|
|||||||
|
|
||||||
if self.com_ok == 1:
|
if self.com_ok == 1:
|
||||||
if text == "Normal Mode":
|
if text == "Normal Mode":
|
||||||
bin.lib.communication.SwitchMode().disable_fastmode()
|
bin.lib.communication.SwitchMode().disable_fastmode(special_port)
|
||||||
else:
|
else:
|
||||||
bin.lib.communication.SwitchMode().enable_fastmode()
|
bin.lib.communication.SwitchMode().enable_fastmode(special_port)
|
||||||
logger.info("Switched mode, restarting COM")
|
logger.info("Switched mode, restarting COM")
|
||||||
self.openpupups()
|
self.openpupups()
|
||||||
self.comstart(0)
|
self.comstart(0)
|
||||||
@@ -451,7 +455,7 @@ class Program(Screen):
|
|||||||
|
|
||||||
def read_data(self):
|
def read_data(self):
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
self.go = 1
|
self.go = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.go = 0
|
self.go = 0
|
||||||
@@ -556,7 +560,7 @@ class Program(Screen):
|
|||||||
self.__transmit.append(self.ids.s4_t.text)
|
self.__transmit.append(self.ids.s4_t.text)
|
||||||
logger.debug("trying to send...")
|
logger.debug("trying to send...")
|
||||||
try:
|
try:
|
||||||
self.coms.change_all(self.__transmit, "")
|
self.coms.change_all(self.__transmit, special_port)
|
||||||
logger.info("Transmission successful")
|
logger.info("Transmission successful")
|
||||||
logger.debug("purging fields...")
|
logger.debug("purging fields...")
|
||||||
self.ids.s1_a.text = ""
|
self.ids.s1_a.text = ""
|
||||||
@@ -633,7 +637,7 @@ class ProgramTemp(Screen):
|
|||||||
def read_data(self):
|
def read_data(self):
|
||||||
logger.info("Trying to establish connection...")
|
logger.info("Trying to establish connection...")
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
self.go = 1
|
self.go = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.go = 0
|
self.go = 0
|
||||||
@@ -712,7 +716,7 @@ class ProgramTemp(Screen):
|
|||||||
self.__transmit.append(self.ids.temp_s3.text)
|
self.__transmit.append(self.ids.temp_s3.text)
|
||||||
self.__transmit.append(self.ids.temp_s4.text)
|
self.__transmit.append(self.ids.temp_s4.text)
|
||||||
logger.debug("Transmitting...")
|
logger.debug("Transmitting...")
|
||||||
self.coms.change_temp(self.__transmit, "")
|
self.coms.change_temp(self.__transmit, special_port)
|
||||||
self.ids.temp_s1.text = ""
|
self.ids.temp_s1.text = ""
|
||||||
self.ids.temp_s2.text = ""
|
self.ids.temp_s2.text = ""
|
||||||
self.ids.temp_s3.text = ""
|
self.ids.temp_s3.text = ""
|
||||||
@@ -741,7 +745,7 @@ class ReadData(Screen):
|
|||||||
def read_data(self):
|
def read_data(self):
|
||||||
logger.info("Trying to connect to the microcontroller")
|
logger.info("Trying to connect to the microcontroller")
|
||||||
try:
|
try:
|
||||||
com.connect(19200, "")
|
com.connect(19200, special_port)
|
||||||
self.go = 1
|
self.go = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.go = 0
|
self.go = 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ sizeW = 800
|
|||||||
|
|
||||||
[Dev Settings]
|
[Dev Settings]
|
||||||
# Settings generally aimed towards the devs of this software!
|
# Settings generally aimed towards the devs of this software!
|
||||||
verbose = True
|
verbose = False
|
||||||
log_level = DEBUG
|
log_level = DEBUG
|
||||||
disableConnectionCheck = True
|
disableConnectionCheck = False
|
||||||
|
|
||||||
[Info]
|
[Info]
|
||||||
version = V2.3.0
|
version = V2.3.0
|
||||||
subVersion = -dev1
|
subVersion =
|
||||||
|
|||||||
5
BiogasControllerApp-V2.2/log/logging.md
Normal file
5
BiogasControllerApp-V2.2/log/logging.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
What is getting logged?
|
||||||
|
Generally this app logs how and when you interact with the app and sometimes, which values you enter.
|
||||||
|
No logs are being sent to anybody automatically, you can choose to attach the log file to the bug report.
|
||||||
|
This helps the devs a lot, as they can better understand the state of the app as it crashed. The logs are
|
||||||
|
all found in this folder here.
|
||||||
Reference in New Issue
Block a user