mirror of
https://github.com/janishutz/BiogasControllerApp.git
synced 2025-11-25 13:54:24 +00:00
Updated to Version V2.3.0-stable, installer and compiled version will soon be available
This commit is contained in:
3
BiogasControllerApp-V2.3/.idea/.gitignore
generated
vendored
Normal file
3
BiogasControllerApp-V2.3/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
1
BiogasControllerApp-V2.3/.idea/.name
generated
Normal file
1
BiogasControllerApp-V2.3/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
biogascontrollerapp.py
|
||||
10
BiogasControllerApp-V2.3/.idea/ENATECH.iml
generated
Normal file
10
BiogasControllerApp-V2.3/.idea/ENATECH.iml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
BiogasControllerApp-V2.3/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
BiogasControllerApp-V2.3/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
4
BiogasControllerApp-V2.3/.idea/misc.xml
generated
Normal file
4
BiogasControllerApp-V2.3/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
BiogasControllerApp-V2.3/.idea/modules.xml
generated
Normal file
8
BiogasControllerApp-V2.3/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ENATECH.iml" filepath="$PROJECT_DIR$/.idea/ENATECH.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
BIN
BiogasControllerApp-V2.3/BiogasControllerAppLogo.png
Normal file
BIN
BiogasControllerApp-V2.3/BiogasControllerAppLogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
672
BiogasControllerApp-V2.3/bin/gui/gui.kv
Normal file
672
BiogasControllerApp-V2.3/bin/gui/gui.kv
Normal file
@@ -0,0 +1,672 @@
|
||||
RootScreen:
|
||||
HomeScreen:
|
||||
ReadoutScreen:
|
||||
ReadData:
|
||||
ProgramTemp:
|
||||
Program:
|
||||
Credits:
|
||||
Modify:
|
||||
|
||||
<QuitPU>:
|
||||
title: "BiogasControllerApp"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Are you sure you want to leave?"
|
||||
font_size: 20
|
||||
GridLayout:
|
||||
cols:2
|
||||
Button:
|
||||
text: "Yes"
|
||||
font_size: 15
|
||||
on_release:
|
||||
root.quitapp()
|
||||
app.stop()
|
||||
Button:
|
||||
text: "No"
|
||||
font_size: 15
|
||||
on_press:
|
||||
root.dismiss()
|
||||
|
||||
<NoConnection>:
|
||||
title: "WARNING!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Unable to open Serial Port"
|
||||
font_size: 20
|
||||
GridLayout:
|
||||
cols:2
|
||||
Button:
|
||||
text: "Details"
|
||||
on_release:
|
||||
root.details()
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<ConnectionFail>:
|
||||
title: "WARNING!"
|
||||
font_size: 50
|
||||
size_hint: 0.7, 0.6
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Unable to communicate"
|
||||
font_size: 20
|
||||
Label:
|
||||
text: "Possible ways to resolve this problem:\n- Try again\n- Restart the PIC16F877 or reset the program\n- Check the cable / connect one"
|
||||
font_size: 14
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<DetailInfo>:
|
||||
on_open: self.update_details = root.infos()
|
||||
title: "DETAILS"
|
||||
font_size: 50
|
||||
size_hint: 1, 0.7
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Unable to open Serial Port"
|
||||
font_size: 20
|
||||
Label:
|
||||
id: errormessage
|
||||
text: root.infos()
|
||||
font_size: 13
|
||||
Label:
|
||||
text: root.error_tips()
|
||||
font_size: 13
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<Modeswitch>:
|
||||
title: "NOTICE!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Mode Switched!"
|
||||
font_size: 30
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<SaveConf>:
|
||||
title: "NOTICE!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "SAVED!"
|
||||
font_size: 30
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<Connecting_PU>:
|
||||
title: "NOTICE!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Establishing connection with PIC16F877"
|
||||
font_size: 18
|
||||
Label:
|
||||
text: "This Process may take a while..."
|
||||
font_size: 15
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<MissingFieldsError>:
|
||||
title: "WARNING!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Missing Information!"
|
||||
font_size: 18
|
||||
Label:
|
||||
text: "Check your entry"
|
||||
font_size: 15
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
<Disconnecting_PU>:
|
||||
title: "NOTICE!"
|
||||
font_size: 50
|
||||
size_hint: 0.5, 0.4
|
||||
auto_dismiss: False
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "Connection with PIC16F877 terminated"
|
||||
font_size: 18
|
||||
Label:
|
||||
text: "The connection to the Microcontroller\nhas been terminated successfully"
|
||||
font_size: 15
|
||||
Button:
|
||||
text:"Ok"
|
||||
on_release:
|
||||
root.dismiss()
|
||||
|
||||
######################################
|
||||
# SCREENS
|
||||
######################################
|
||||
<HomeScreen>:
|
||||
name: "HomeS"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
GridLayout:
|
||||
cols:1
|
||||
Label:
|
||||
text: "BiogasanlageControllerApp"
|
||||
font_size: 50
|
||||
color: (0, 113, 0, 1)
|
||||
bold:True
|
||||
italic:True
|
||||
FloatLayout:
|
||||
GridLayout:
|
||||
cols: 2
|
||||
size_hint: 0.8, 0.8
|
||||
pos_hint: {"x": 0.1, "y": 0.1}
|
||||
Button:
|
||||
text: "Start"
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
font_size: 30
|
||||
on_release:
|
||||
root.tryconnection()
|
||||
Button:
|
||||
text: "Quit"
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
font_size: 30
|
||||
on_release:
|
||||
root.exitapp()
|
||||
Label:
|
||||
text: root.reset()
|
||||
id: app_version
|
||||
font_size: 13
|
||||
pos_hint: {"y": -0.45, "x":0.05}
|
||||
Button:
|
||||
text: "Settings"
|
||||
font_size: 13
|
||||
size_hint: 0.07, 0.06
|
||||
pos_hint: {"x":0.01, "y":0.01}
|
||||
background_color: (50, 0, 0, 0.2)
|
||||
on_release:
|
||||
app.root.current = "Settings"
|
||||
root.manager.transition.direction = "down"
|
||||
|
||||
<ReadoutScreen>:
|
||||
on_pre_enter: self.reset_screen = root.resscreen()
|
||||
name: "Readout"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
GridLayout:
|
||||
FloatLayout:
|
||||
Label:
|
||||
pos_hint: {"y":0.4}
|
||||
text: "READOUT"
|
||||
font_size: 40
|
||||
color: (0, 113, 0, 1)
|
||||
bold: True
|
||||
GridLayout:
|
||||
cols:4
|
||||
size_hint: 0.8, 0.3
|
||||
pos_hint: {"x":0.1, "y":0.4}
|
||||
Label:
|
||||
text: "SENSOR 1: "
|
||||
font_size: 20
|
||||
Label:
|
||||
id: sonde1
|
||||
text: ""
|
||||
Label:
|
||||
text: "SENSOR 2: "
|
||||
font_size: 20
|
||||
Label:
|
||||
id: sonde2
|
||||
text: ""
|
||||
Label:
|
||||
text: "SENSOR 3: "
|
||||
font_size: 20
|
||||
Label:
|
||||
id: sonde3
|
||||
text: ""
|
||||
Label:
|
||||
text: "SENSOR 4: "
|
||||
font_size: 20
|
||||
Label:
|
||||
id: sonde4
|
||||
text: ""
|
||||
Button:
|
||||
text: "Start communication"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x": 0.5, "y": 0.05}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.start_com()
|
||||
Button:
|
||||
text: "End communication"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x": 0.7, "y": 0.05}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.end_com()
|
||||
Button:
|
||||
text: "Back"
|
||||
size_hint: 0.3, 0.1
|
||||
pos_hint: {"x":0.05, "y":0.05}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.leave_screen()
|
||||
app.root.current = "HomeS"
|
||||
root.manager.transition.direction = "left"
|
||||
ToggleButton:
|
||||
id: mode_sel
|
||||
size_hint: 0.15, 0.1
|
||||
pos_hint: {"x":0.1, "y":0.2}
|
||||
text: "Normal Mode" if self.state == "normal" else "Fast Mode"
|
||||
on_text: root.switch_mode(mode_sel.text)
|
||||
background_color: (255,0,0,0.6) if self.state == "normal" else (0,0,255,0.6)
|
||||
Button:
|
||||
text: "Read Data"
|
||||
size_hint: 0.15, 0.1
|
||||
pos_hint: {"x":0.3, "y":0.2}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.leave_screen()
|
||||
app.root.current = "RD"
|
||||
root.manager.transition.direction = "down"
|
||||
Button:
|
||||
text: "Temperature"
|
||||
size_hint: 0.15, 0.1
|
||||
pos_hint: {"x":0.5, "y":0.2}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.leave_screen()
|
||||
app.root.current = "PT"
|
||||
root.manager.transition.direction = "down"
|
||||
Button:
|
||||
text: "Change all Data"
|
||||
size_hint: 0.15, 0.1
|
||||
pos_hint: {"x":0.7, "y":0.2}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.leave_screen()
|
||||
app.root.current = "PR"
|
||||
root.manager.transition.direction = "down"
|
||||
Label:
|
||||
id: frequency
|
||||
text: "Frequency will appear here"
|
||||
font_size: 10
|
||||
pos_hint: {"x":0.4, "y": 0.3}
|
||||
|
||||
<ReadData>:
|
||||
name: "RD"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
GridLayout:
|
||||
FloatLayout:
|
||||
Label:
|
||||
text: "Read Data"
|
||||
font_size: 40
|
||||
color: (0, 113, 0, 1)
|
||||
bold: True
|
||||
pos_hint: {"y":0.4}
|
||||
Button:
|
||||
text: "Start Readout"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.4, "y":0.1}
|
||||
on_release:
|
||||
root.read_data()
|
||||
Button:
|
||||
text: "Back"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.1, "y":0.1}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
app.root.current = "Readout"
|
||||
root.manager.transition.direction = "up"
|
||||
GridLayout:
|
||||
cols:4
|
||||
size_hint: 0.8, 0.4
|
||||
pos_hint: {"x":0.1, "y":0.3}
|
||||
Label:
|
||||
text: "Sonde 1"
|
||||
font_size: 20
|
||||
Label:
|
||||
id: inf_sonde1
|
||||
text: ""
|
||||
Label:
|
||||
text: "Sonde 2"
|
||||
font_size: 20
|
||||
Label:
|
||||
id: inf_sonde2
|
||||
text: ""
|
||||
Label:
|
||||
text: "Sonde 3"
|
||||
font_size: 20
|
||||
Label:
|
||||
id: inf_sonde3
|
||||
text: ""
|
||||
Label:
|
||||
text: "Sonde 4"
|
||||
font_size: 20
|
||||
Label:
|
||||
id: inf_sonde4
|
||||
text: ""
|
||||
|
||||
<ProgramTemp>:
|
||||
on_pre_enter: self.check_config = root.read_config()
|
||||
name: "PT"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
FloatLayout:
|
||||
Label:
|
||||
text: "Change Temperature"
|
||||
pos_hint: {"y":0.4}
|
||||
font_size: 40
|
||||
color: (0, 113, 0, 1)
|
||||
bold: True
|
||||
GridLayout:
|
||||
size_hint: 0.8, 0.4
|
||||
pos_hint: {"x": 0.1, "y":0.3}
|
||||
cols:2
|
||||
Label:
|
||||
text: "Temperature Sensor 1: "
|
||||
TextInput:
|
||||
id: temp_s1
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Temperature Sensor 2: "
|
||||
TextInput:
|
||||
id: temp_s2
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Temperature Sensor 3: "
|
||||
TextInput:
|
||||
id: temp_s3
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Temperature Sensor 4: "
|
||||
TextInput:
|
||||
id: temp_s4
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Button:
|
||||
text: "Back"
|
||||
size_hint: 0.1, 0.1
|
||||
pos_hint: {"x":0.1, "y":0.1}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
app.root.current = "Readout"
|
||||
root.manager.transition.direction = "up"
|
||||
ToggleButton:
|
||||
id: prsel
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.35, "y": 0.1}
|
||||
text: "Full\nreprogramming" if self.state == "normal" else "Partial\nreprogramming"
|
||||
on_release: root.change_mode()
|
||||
background_color: (255,0,0,0.6) if self.state == "normal" else (0,0,255,0.6)
|
||||
Button:
|
||||
text: "Save"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.6, "y":0.1}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.send_data()
|
||||
|
||||
<Program>:
|
||||
name: "PR"
|
||||
on_pre_enter: self.check_config = root.read_config()
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
FloatLayout:
|
||||
Label:
|
||||
text: "Change all Data"
|
||||
font_size: 40
|
||||
color: (0, 113, 0, 1)
|
||||
bold: True
|
||||
pos_hint: {"y":0.4}
|
||||
GridLayout:
|
||||
size_hint: 0.8, 0.5
|
||||
pos_hint: {"x":0.1, "y":0.2}
|
||||
cols: 4
|
||||
Label:
|
||||
text: "Sensor 1, a:"
|
||||
TextInput:
|
||||
id: s1_a
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 1, b:"
|
||||
TextInput:
|
||||
id: s1_b
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 1, c:"
|
||||
TextInput:
|
||||
id: s1_c
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 1, Temp:"
|
||||
TextInput:
|
||||
id: s1_t
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 2, a:"
|
||||
TextInput:
|
||||
id: s2_a
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 2, b:"
|
||||
TextInput:
|
||||
id: s2_b
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 2, c:"
|
||||
TextInput:
|
||||
id: s2_c
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 2, Temp:"
|
||||
TextInput:
|
||||
id: s2_t
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 3, a:"
|
||||
TextInput:
|
||||
id: s3_a
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 3, b:"
|
||||
TextInput:
|
||||
id: s3_b
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 3, c:"
|
||||
TextInput:
|
||||
id: s3_c
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 3, Temp:"
|
||||
TextInput:
|
||||
id: s3_t
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 4, a:"
|
||||
TextInput:
|
||||
id: s4_a
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 4, b:"
|
||||
TextInput:
|
||||
id: s4_b
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 4, c:"
|
||||
TextInput:
|
||||
id: s4_c
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Label:
|
||||
text: "Sensor 4, Temp:"
|
||||
TextInput:
|
||||
id: s4_t
|
||||
multiline: False
|
||||
input_filter: "float"
|
||||
Button:
|
||||
text: "Back"
|
||||
size_hint: 0.1, 0.1
|
||||
pos_hint: {"x":0.1, "y":0.1}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
app.root.current = "Readout"
|
||||
root.manager.transition.direction = "up"
|
||||
ToggleButton:
|
||||
id: prsel
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.35, "y": 0.1}
|
||||
text: "Full\nreprogramming" if self.state == "normal" else "Partial\nreprogramming"
|
||||
on_release: root.change_mode()
|
||||
background_color: (255,0,0,0.6) if self.state == "normal" else (0,0,255,0.6)
|
||||
Button:
|
||||
text: "Save"
|
||||
size_hint: 0.2, 0.1
|
||||
pos_hint: {"x":0.6, "y":0.1}
|
||||
background_color: (255, 0, 0, 0.6)
|
||||
on_release:
|
||||
root.send_data()
|
||||
|
||||
|
||||
<Credits>:
|
||||
name: "Credits"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
FloatLayout:
|
||||
Button:
|
||||
text: "back"
|
||||
size_hint: 0.4, 0.2
|
||||
pos_hint: {"x":0.3, "y":0.1}
|
||||
on_release:
|
||||
app.root.current = "Settings"
|
||||
root.manager.transition.direction = "right"
|
||||
GridLayout:
|
||||
cols:1
|
||||
pos_hint:{"x":0.05, "y":0.35}
|
||||
size_hint: 0.9, 0.5
|
||||
Label:
|
||||
text: "This is a rework of the BiogasControllerApp V1, that was originally programmed by S. Reichmuth."
|
||||
Label:
|
||||
text: "Written by: Janis Hutz\nDesigned by: Janis Hutz\nDesign language: Kivy"
|
||||
|
||||
<Modify>:
|
||||
on_pre_enter: self.config = root.read_config()
|
||||
name: "Settings"
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: (50,50,50,0.2)
|
||||
Rectangle:
|
||||
size: self.size
|
||||
pos: self.pos
|
||||
GridLayout:
|
||||
cols: 1
|
||||
Label:
|
||||
text: "Settings"
|
||||
font_size: 40
|
||||
color: (0, 113, 0, 1)
|
||||
bold: True
|
||||
FloatLayout:
|
||||
GridLayout:
|
||||
pos_hint: {"x":0.05, "y":0.05}
|
||||
size_hint: 0.9, 0.9
|
||||
cols: 4
|
||||
Button:
|
||||
text: "Back"
|
||||
background_color: (255,0,0,0.6)
|
||||
on_release:
|
||||
app.root.current = "HomeS"
|
||||
root.manager.transition.direction = "up"
|
||||
Button:
|
||||
text: "Report a\nBug"
|
||||
background_color: (255,0,0,0.6)
|
||||
on_release:
|
||||
root.issue_reporting()
|
||||
ToggleButton:
|
||||
id: prsel
|
||||
text: "Full\nreprogramming" if self.state == "normal" else "Partial\nreprogramming"
|
||||
on_release: root.change_programming()
|
||||
background_color: (255,0,0,0.6) if self.state == "normal" else (0,0,255,0.6)
|
||||
Button:
|
||||
text: "Credits"
|
||||
background_color: (255,0,0,0.6)
|
||||
on_release:
|
||||
app.root.current = "Credits"
|
||||
root.manager.transition.direction = "left"
|
||||
96
BiogasControllerApp-V2.3/bin/lib/communication.py
Normal file
96
BiogasControllerApp-V2.3/bin/lib/communication.py
Normal file
@@ -0,0 +1,96 @@
|
||||
import bin.lib.lib
|
||||
com = bin.lib.lib.Com()
|
||||
|
||||
|
||||
class Communication:
|
||||
def __init__(self):
|
||||
self.__x = 0
|
||||
self.__data_recieve = 0
|
||||
self.__output = ""
|
||||
|
||||
def change_temp(self, data, special_port):
|
||||
com.connect(19200, special_port)
|
||||
com.send("PT")
|
||||
self.go = 0
|
||||
while True:
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "P":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "T":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.go = 1
|
||||
break
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
if self.go == 1:
|
||||
self.data = data
|
||||
while len(self.data) > 0:
|
||||
self.__data_recieve = com.receive(3)
|
||||
if self.__data_recieve != "":
|
||||
com.send_float(float(self.data.pop(0)))
|
||||
else:
|
||||
print("error")
|
||||
break
|
||||
else:
|
||||
print("Error")
|
||||
com.quitcom()
|
||||
|
||||
def change_all(self, data, special_port):
|
||||
com.connect(19200, special_port)
|
||||
com.send("PR")
|
||||
self.go = 0
|
||||
while True:
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "P":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "R":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.go = 1
|
||||
break
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
if self.go == 1:
|
||||
self.data = data
|
||||
while len(self.data) > 0:
|
||||
self.__data_recieve = com.receive(3)
|
||||
if self.__data_recieve != "":
|
||||
com.send_float(float(self.data.pop(0)))
|
||||
else:
|
||||
print("error")
|
||||
break
|
||||
else:
|
||||
print("Error")
|
||||
com.quitcom()
|
||||
|
||||
|
||||
class SwitchMode:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def enable_fastmode(self, special_port):
|
||||
com.connect(19200, special_port)
|
||||
com.send("FM")
|
||||
com.quitcom()
|
||||
|
||||
def disable_fastmode(self, special_port):
|
||||
com.connect(19200, special_port)
|
||||
com.send("NM")
|
||||
com.quitcom()
|
||||
22
BiogasControllerApp-V2.3/bin/lib/comport_search.py
Normal file
22
BiogasControllerApp-V2.3/bin/lib/comport_search.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import serial.tools.list_ports
|
||||
|
||||
|
||||
class ComportService:
|
||||
def __init__(self):
|
||||
self.__comport = []
|
||||
self.__import = []
|
||||
self.__working = []
|
||||
|
||||
def get_comport(self, special_port):
|
||||
self.__comport = [comport.device for comport in serial.tools.list_ports.comports()]
|
||||
self.__pos = 0
|
||||
if special_port != "":
|
||||
self.__working = special_port
|
||||
else:
|
||||
while self.__working == []:
|
||||
self.__com_name = serial.tools.list_ports.comports()[self.__pos]
|
||||
if "USB-Serial Controller" or "Prolific USB-Serial Controller" in self.__com_name:
|
||||
self.__working = self.__comport.pop(self.__pos)
|
||||
else:
|
||||
self.__pos += 1
|
||||
return self.__working
|
||||
122
BiogasControllerApp-V2.3/bin/lib/csv_parsers.py
Normal file
122
BiogasControllerApp-V2.3/bin/lib/csv_parsers.py
Normal file
@@ -0,0 +1,122 @@
|
||||
"""@package docstring
|
||||
This is a simplification of the csv module"""
|
||||
|
||||
import csv
|
||||
|
||||
|
||||
class CsvRead:
|
||||
"""This is a class that reads csv files and depending on the module selected does do different things with it"""
|
||||
def __init__(self):
|
||||
self.__imp = ""
|
||||
self.__raw = ""
|
||||
self.__raw_list = ""
|
||||
|
||||
def importing(self, path):
|
||||
"""Returns a list of the imported csv-file, requires path, either direct system path or relative path"""
|
||||
self.__imp = open(path)
|
||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||
self.__raw_list = list(self.__raw)
|
||||
self.__imp.close()
|
||||
return self.__raw_list
|
||||
|
||||
|
||||
class CsvWrite:
|
||||
"""This is a class that modifies csv files"""
|
||||
def __init__(self):
|
||||
self.__impl = []
|
||||
self.__strpop = []
|
||||
self.__removed = []
|
||||
self.__removing = 0
|
||||
self.__change = 0
|
||||
self.__appending = 0
|
||||
self.__imp = []
|
||||
self.__raw = []
|
||||
|
||||
def rem_str(self, path, row):
|
||||
"""Opens the csv-file in write mode which is specified as an argument either as direct or relative path"""
|
||||
self.__imp = open(path)
|
||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||
self.__impl = list(self.__raw)
|
||||
self.__removed = self.__impl.pop(row + 1)
|
||||
with open(path, "w") as removedata:
|
||||
self.__removing = csv.writer(removedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__removing.writerow(self.__impl.pop(0))
|
||||
while len(self.__impl) > 0:
|
||||
with open(path, "a") as removedata:
|
||||
self.__removing = csv.writer(removedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__removing.writerow(self.__impl.pop(0))
|
||||
self.__imp.close()
|
||||
removedata.close()
|
||||
|
||||
|
||||
def chg_str(self, path, row, pos, new_value):
|
||||
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
||||
self.__imp = open(path)
|
||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||
self.__impl = list(self.__raw)
|
||||
self.__strpop = self.__impl.pop(row)
|
||||
self.__strpop.pop(pos)
|
||||
self.__strpop.insert(pos, new_value)
|
||||
self.__impl.insert(row, self.__strpop)
|
||||
with open(path, "w") as changedata:
|
||||
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__change.writerow(self.__impl.pop(0))
|
||||
while len(self.__impl) > 0:
|
||||
with open(path, "a") as changedata:
|
||||
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__removing.writerow(self.__impl.pop(0))
|
||||
self.__imp.close()
|
||||
changedata.close()
|
||||
|
||||
def chg_str_rem(self, path, row, pos):
|
||||
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
||||
self.__imp = open(path)
|
||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||
self.__impl = list(self.__raw)
|
||||
self.__strpop = self.__impl.pop(row)
|
||||
self.__strpop.pop(pos)
|
||||
self.__strpop.pop(pos)
|
||||
self.__impl.insert(row, self.__strpop)
|
||||
with open(path, "w") as changedata:
|
||||
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__change.writerow(self.__impl.pop(0))
|
||||
while len(self.__impl) > 0:
|
||||
with open(path, "a") as changedata:
|
||||
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__removing.writerow(self.__impl.pop(0))
|
||||
self.__imp.close()
|
||||
changedata.close()
|
||||
|
||||
def chg_str_add(self, path, row, new_value1, new_value2):
|
||||
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
|
||||
self.__imp = open(path)
|
||||
self.__raw = csv.reader(self.__imp, delimiter=',')
|
||||
self.__impl = list(self.__raw)
|
||||
self.__strpop = self.__impl.pop(row)
|
||||
self.__strpop.append(new_value1)
|
||||
self.__strpop.append(new_value2)
|
||||
self.__impl.insert(row, self.__strpop)
|
||||
with open(path, "w") as changedata:
|
||||
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__change.writerow(self.__impl.pop(0))
|
||||
while len(self.__impl) > 0:
|
||||
with open(path, "a") as changedata:
|
||||
self.__removing = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__removing.writerow(self.__impl.pop(0))
|
||||
self.__imp.close()
|
||||
changedata.close()
|
||||
|
||||
def app_str(self, path, value):
|
||||
"""Opens the csv-file in append mode and writes given input. CsvWrite.app_str(path, value).
|
||||
Path can be specified both as direct or relative. value is a list. Will return an error if type of value is
|
||||
not a list."""
|
||||
with open(path, "a") as appenddata:
|
||||
self.__appending = csv.writer(appenddata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__appending.writerow(value)
|
||||
appenddata.close()
|
||||
|
||||
def write_str(self, path, value):
|
||||
with open(path, "w") as writedata:
|
||||
self.__change = csv.writer(writedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
||||
self.__change.writerow(value)
|
||||
writedata.close()
|
||||
73
BiogasControllerApp-V2.3/bin/lib/lib.py
Normal file
73
BiogasControllerApp-V2.3/bin/lib/lib.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import serial
|
||||
import struct
|
||||
import bin.lib.comport_search
|
||||
"""@package docstring
|
||||
This package can communicate with a microcontroller"""
|
||||
|
||||
coms = bin.lib.comport_search.ComportService()
|
||||
|
||||
|
||||
class Com:
|
||||
def __init__(self):
|
||||
self.xr = ""
|
||||
self.output = ""
|
||||
self.str_input = ""
|
||||
self.str_get_input = ""
|
||||
self.xs = ""
|
||||
self.__comport = '/dev/ttyUSB0'
|
||||
|
||||
def connect(self, baudrate, special_port):
|
||||
try:
|
||||
self.__comport = coms.get_comport(special_port)
|
||||
except:
|
||||
pass
|
||||
self.ser = serial.Serial(self.__comport, baudrate=baudrate, timeout=5)
|
||||
|
||||
def quitcom(self):
|
||||
try:
|
||||
self.ser.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def receive(self, amount_bytes):
|
||||
self.xr = self.ser.read(amount_bytes)
|
||||
return self.xr
|
||||
|
||||
def decode_ascii(self, value):
|
||||
try:
|
||||
self.output = value.decode()
|
||||
except:
|
||||
self.output = "Error"
|
||||
return self.output
|
||||
|
||||
def check_value(self, value_check, checked_value):
|
||||
if value_check == checked_value:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def decode_int(self, value):
|
||||
self.i = int(value, base=16)
|
||||
return self.i
|
||||
|
||||
def decode_float(self, value):
|
||||
self.fs = str(value, 'ascii') + '00'
|
||||
self.f = struct.unpack('>f', bytes.fromhex(self.fs))
|
||||
return str(self.f[0])
|
||||
|
||||
def decode_float_2(self, value):
|
||||
self.fs = str(value, 'ascii') + '0000'
|
||||
self.f = struct.unpack('>f', bytes.fromhex(self.fs))
|
||||
return str(self.f[0])
|
||||
|
||||
def get_input(self):
|
||||
self.str_get_input = input("please enter a character to send: ")
|
||||
return self.str_get_input
|
||||
|
||||
def send(self, str_input):
|
||||
self.xs = str_input.encode()
|
||||
self.ser.write(self.xs)
|
||||
|
||||
def send_float(self, float_input):
|
||||
ba = bytearray(struct.pack('>f', float_input))
|
||||
self.ser.write(ba[0:3])
|
||||
873
BiogasControllerApp-V2.3/biogascontrollerapp.py
Normal file
873
BiogasControllerApp-V2.3/biogascontrollerapp.py
Normal file
@@ -0,0 +1,873 @@
|
||||
import os
|
||||
import configparser
|
||||
|
||||
import serial
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('./config/settings.ini')
|
||||
co = config['Dev Settings']['verbose']
|
||||
if co == "True":
|
||||
pass
|
||||
else:
|
||||
os.environ["KIVY_NO_CONSOLELOG"] = "1"
|
||||
|
||||
import threading
|
||||
import platform
|
||||
import webbrowser
|
||||
from kivy.uix.screenmanager import Screen, ScreenManager
|
||||
from kivy.core.window import Window
|
||||
from kivy.uix.popup import Popup
|
||||
from kivy.app import App
|
||||
from kivy.lang import Builder
|
||||
from kivy.clock import mainthread, Clock
|
||||
import bin.lib.lib
|
||||
import bin.lib.communication
|
||||
import bin.lib.comport_search
|
||||
import bin.lib.csv_parsers
|
||||
import logging
|
||||
import datetime
|
||||
import time
|
||||
|
||||
version_app = f"{config['Info']['version']}{config['Info']['subVersion']}"
|
||||
|
||||
################################################################
|
||||
# LOGGER SETUP
|
||||
##################
|
||||
logging.basicConfig(level=logging.DEBUG, filename="./log/main_log.log", filemode="w")
|
||||
logs = f"./log/{datetime.datetime.now()}-log-main.log"
|
||||
logger = logging.getLogger(__name__)
|
||||
handler = logging.FileHandler(logs)
|
||||
formatter = logging.Formatter("%(levelname)s - %(asctime)s - %(name)s: %(message)s -- %(lineno)d")
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
|
||||
logger.setLevel(config['Dev Settings']['log_level'])
|
||||
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']
|
||||
cvr = bin.lib.csv_parsers.CsvRead()
|
||||
cvw = bin.lib.csv_parsers.CsvWrite()
|
||||
com = bin.lib.lib.Com()
|
||||
|
||||
|
||||
#################################################################
|
||||
# Settings Handler
|
||||
#########################
|
||||
class SettingsHandler:
|
||||
def __init__(self):
|
||||
self.ports = None
|
||||
self.window_sizeh = 600
|
||||
self.window_sizew = 800
|
||||
|
||||
def settingshandler(self):
|
||||
self.ports = config['Port Settings']['specificPort']
|
||||
self.window_sizeh = config['UI Config']['sizeH']
|
||||
self.window_sizew = config['UI Config']['sizeW']
|
||||
Window.size = (int(self.window_sizew), int(self.window_sizeh))
|
||||
|
||||
|
||||
#################################################################
|
||||
|
||||
|
||||
logger.info("Started modules")
|
||||
|
||||
|
||||
##################################################################
|
||||
# Popups
|
||||
##################################################################
|
||||
|
||||
|
||||
class QuitPU(Popup):
|
||||
def quitapp(self):
|
||||
com.quitcom()
|
||||
logger.debug("App stopped")
|
||||
|
||||
|
||||
class NoConnection(Popup):
|
||||
def details(self):
|
||||
self.detailsinfo = DetailInfo()
|
||||
self.detailsinfo.open()
|
||||
|
||||
|
||||
class DetailInfo(Popup):
|
||||
update_details = ""
|
||||
def infos(self):
|
||||
self.err = ""
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
com.quitcom()
|
||||
except Exception as err:
|
||||
self.err += "Errormessage:\n"
|
||||
self.err += str(err)
|
||||
self.err += "\n-------------------------------------------------------------------------------------------------------------------------------------------------------------\n"
|
||||
return str(self.err)
|
||||
|
||||
def error_tips(self):
|
||||
self.err_tip = ""
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
com.quitcom()
|
||||
except Exception as err:
|
||||
self.err_tip += "Possible way to resolve the issue: \n\n"
|
||||
if str(err)[0:10] == "[Errno 13]":
|
||||
if platform.system() == "Linux":
|
||||
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":
|
||||
self.err_tip += "Give permission to access the cable"
|
||||
elif platform.system() == "Windows":
|
||||
self.err_tip += "Try a different cable or install another driver"
|
||||
else:
|
||||
self.err_tip += "Unknown OS"
|
||||
elif str(err)[0:10] == "[Errno 2] ":
|
||||
if platform.system() == "Linux":
|
||||
self.err_tip += "Connect a cable, open a terminal and type in: sudo chmod 777 /dev/ttyUSB0"
|
||||
elif platform.system() == "Macintosh":
|
||||
self.err_tip += "Give permission to access the cable"
|
||||
elif platform.system() == "Windows":
|
||||
self.err_tip += "Try a different cable or install another driver"
|
||||
else:
|
||||
self.err_tip += "Unknown OS"
|
||||
elif str(err)[0:34] == "could not open port '/dev/ttyUSB0'":
|
||||
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(special_port)}'":
|
||||
self.err_tip += "Try using a different cable or close all monitoring software (like MSI Afterburner)"
|
||||
else:
|
||||
self.err_tip += "Special Error, consult the manual of Serial"
|
||||
return str(self.err_tip)
|
||||
|
||||
|
||||
class Modeswitch(Popup):
|
||||
pass
|
||||
|
||||
|
||||
class Connecting_PU(Popup):
|
||||
pass
|
||||
|
||||
|
||||
class Disconnecting_PU(Popup):
|
||||
pass
|
||||
|
||||
|
||||
class MissingFieldsError(Popup):
|
||||
pass
|
||||
|
||||
|
||||
class ConnectionFail(Popup):
|
||||
pass
|
||||
|
||||
|
||||
class SaveConf(Popup):
|
||||
pass
|
||||
|
||||
|
||||
####################################################################
|
||||
# SCREENS
|
||||
####################################################################
|
||||
class HomeScreen(Screen):
|
||||
def reset(self):
|
||||
logger.info("HomeScreen initialised")
|
||||
SettingsHandler().settingshandler()
|
||||
self.connected = 1
|
||||
self.info = f"You are currently running Version {version_app} - If you encounter a bug, please report it!"
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
com.quitcom()
|
||||
except Exception as e:
|
||||
self.connected = 0
|
||||
logger.error(e)
|
||||
return self.info
|
||||
|
||||
def tryconnection(self):
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
com.quitcom()
|
||||
self.connected = 1
|
||||
self.manager.current = "Readout"
|
||||
self.manager.transition.direction = "right"
|
||||
except Exception as ex:
|
||||
if config['Dev Settings']['disableConnectionCheck'] == "True":
|
||||
self.connected = 1
|
||||
self.manager.current = "Readout"
|
||||
self.manager.transition.direction = "right"
|
||||
else:
|
||||
self.connected = 0
|
||||
logger.error(f"COM_error: {ex}")
|
||||
self.open_popup()
|
||||
|
||||
def open_popup(self):
|
||||
self.popups = NoConnection()
|
||||
self.popups.open()
|
||||
|
||||
def exitapp(self):
|
||||
self.pup = QuitPU()
|
||||
self.pup.open()
|
||||
|
||||
|
||||
class ReadoutScreen(Screen):
|
||||
go = 1
|
||||
|
||||
def start_com(self):
|
||||
self.comstart(1)
|
||||
logger.info("Trying to start COM")
|
||||
|
||||
def comstart(self, pu_on):
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.error(f"COM_error: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.debug("COM start success")
|
||||
self.parent.current = "Readout"
|
||||
if pu_on == 1:
|
||||
self.openstartpu()
|
||||
else:
|
||||
pass
|
||||
self.communication = threading.Thread(name="communication", target=self.start_coms)
|
||||
self.communication.start()
|
||||
else:
|
||||
self.openconnectionfailpu()
|
||||
|
||||
def end_com(self):
|
||||
self.stopcom(1)
|
||||
|
||||
def stopcom(self, pu_on):
|
||||
self.go = 0
|
||||
try:
|
||||
self.communication.join()
|
||||
except Exception as e:
|
||||
logger.warning(f"COM_Close_Error: {e}")
|
||||
if pu_on == 1:
|
||||
self.openendpu()
|
||||
else:
|
||||
pass
|
||||
|
||||
def start_coms(self):
|
||||
self.check = 1
|
||||
self.__level = 0
|
||||
self.__distance = 0
|
||||
self.__x = ""
|
||||
self.__begin = time.time()
|
||||
self.go = 1
|
||||
logger.info("Starting COM_Hook")
|
||||
while self.__x != "\n":
|
||||
if time.time() - self.__begin > 5:
|
||||
self.go = 0
|
||||
break
|
||||
else:
|
||||
self.__x = com.decode_ascii(com.receive(1))
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("COM_Hook 1 success")
|
||||
while self.__level < 3:
|
||||
self.__x = com.decode_ascii(com.receive(1))
|
||||
if self.__x == " ":
|
||||
if self.__distance == 4:
|
||||
self.__level += 1
|
||||
else:
|
||||
pass
|
||||
self.__distance = 0
|
||||
else:
|
||||
if self.__distance > 4:
|
||||
self.__level = 0
|
||||
self.__distance = 0
|
||||
else:
|
||||
self.__distance += 1
|
||||
self.check = 1
|
||||
logger.info("COM_Hook successful")
|
||||
com.receive(5)
|
||||
else:
|
||||
self.check = 0
|
||||
|
||||
while self.go == 1:
|
||||
self.__starttime = time.time()
|
||||
self.__output = ""
|
||||
self.__data_recieve = com.receive(68)
|
||||
self.__output += "Tadc: "
|
||||
self.__output += str(com.decode_int(self.__data_recieve[0:4]))
|
||||
self.__output += "\nTemperatur: "
|
||||
self.__output += com.decode_float(self.__data_recieve[5:11])
|
||||
self.__output += f"\nDuty-Cycle: {(float(com.decode_float_2(self.__data_recieve[48:52])) / 65535) * 100}%"
|
||||
self.change_screen(1, self.__output)
|
||||
self.__output = "Tadc: "
|
||||
self.__output += str(com.decode_int(self.__data_recieve[12:16]))
|
||||
self.__output += "\nTemperatur: "
|
||||
self.__output += com.decode_float(self.__data_recieve[17:23])
|
||||
self.__output += f"\nDuty-Cycle: {(float(com.decode_float_2(self.__data_recieve[53:57])) / 65535) * 100}%"
|
||||
self.change_screen(2, self.__output)
|
||||
self.__output = "Tadc: "
|
||||
self.__output += str(com.decode_int(self.__data_recieve[24:28]))
|
||||
self.__output += "\nTemperatur: "
|
||||
self.__output += com.decode_float(self.__data_recieve[29:35])
|
||||
self.__output += f"\nDuty-Cycle: {(float(com.decode_float_2(self.__data_recieve[58:62])) / 65535) * 100}%"
|
||||
self.change_screen(3, self.__output)
|
||||
self.__output = "Tadc: "
|
||||
self.__output += str(com.decode_int(self.__data_recieve[36:40]))
|
||||
self.__output += "\nTemperatur: "
|
||||
self.__output += com.decode_float(self.__data_recieve[41:47])
|
||||
self.__output += "\nDuty-Cycle: "
|
||||
self.__output += f"\nDuty-Cycle: {(float(com.decode_float_2(self.__data_recieve[63:67])) / 65535) * 100}%"
|
||||
self.change_screen(4, self.__output)
|
||||
self.change_screen(5, f"F={1 / (time.time() - self.__starttime)}")
|
||||
self.change_screen(6, "")
|
||||
com.quitcom()
|
||||
|
||||
def switch_mode(self, text):
|
||||
self.go = 0
|
||||
try:
|
||||
self.communication.join()
|
||||
com.quitcom()
|
||||
self.com_ok = 1
|
||||
logger.info("Mode_Switch successful")
|
||||
except Exception as e:
|
||||
if e == serial.SerialException:
|
||||
logger.info("No running process found, continuing")
|
||||
else:
|
||||
logger.fatal(f"FATAL ERROR OCCURED, APP WILL LEAVE NOW: {e}")
|
||||
self.com_ok = 0
|
||||
|
||||
if self.com_ok == 1:
|
||||
if text == "Normal Mode":
|
||||
bin.lib.communication.SwitchMode().disable_fastmode(special_port)
|
||||
else:
|
||||
bin.lib.communication.SwitchMode().enable_fastmode(special_port)
|
||||
logger.info("Switched mode, restarting COM")
|
||||
self.openpupups()
|
||||
self.comstart(0)
|
||||
logger.info("COM restarted successfully")
|
||||
else:
|
||||
self.check = 1
|
||||
self.ids.mode_sel.state = "normal"
|
||||
self.openconnectionfailpu()
|
||||
|
||||
@mainthread
|
||||
def change_screen(self, pos, value):
|
||||
if pos == 1:
|
||||
self.ids.sonde1.text = value
|
||||
elif pos == 2:
|
||||
self.ids.sonde2.text = value
|
||||
elif pos == 3:
|
||||
self.ids.sonde3.text = value
|
||||
elif pos == 4:
|
||||
self.ids.sonde4.text = value
|
||||
elif pos == 6:
|
||||
logger.error("COM_fail")
|
||||
self.openconnectionfailpu()
|
||||
else:
|
||||
self.ids.frequency.text = value
|
||||
|
||||
def openpupups(self):
|
||||
self.popup = Modeswitch()
|
||||
self.popup.open()
|
||||
|
||||
def openendpu(self):
|
||||
self.pu = Disconnecting_PU()
|
||||
self.pu.open()
|
||||
|
||||
def openstartpu(self):
|
||||
self.pup = Connecting_PU()
|
||||
self.pup.open()
|
||||
|
||||
def openconnectionfailpu(self):
|
||||
if self.check == 0:
|
||||
self.cfpu = ConnectionFail()
|
||||
self.cfpu.open()
|
||||
else:
|
||||
pass
|
||||
|
||||
def leave_screen(self):
|
||||
logger.info("Stopping COM")
|
||||
self.stopcom(0)
|
||||
|
||||
def resscreen(self):
|
||||
logger.info("Screen reset")
|
||||
self.ids.sonde1.text = ""
|
||||
self.ids.sonde2.text = ""
|
||||
self.ids.sonde3.text = ""
|
||||
self.ids.sonde4.text = ""
|
||||
self.ids.frequency.text = ""
|
||||
|
||||
|
||||
class Program(Screen):
|
||||
def read_config(self):
|
||||
logger.debug("Reading config")
|
||||
self.config_imp = []
|
||||
self.__export = []
|
||||
self.config_imp = cvr.importing("./config/config.csv")
|
||||
self.__export = self.config_imp.pop(0)
|
||||
self.__extracted = self.__export.pop(0)
|
||||
logger.debug(f"config {self.__extracted}")
|
||||
if self.__extracted == "1":
|
||||
self.ids.prsel.state = "normal"
|
||||
self.ids.s1_a.text = ""
|
||||
self.ids.s1_b.text = ""
|
||||
self.ids.s1_c.text = ""
|
||||
self.ids.s1_t.text = ""
|
||||
self.ids.s2_a.text = ""
|
||||
self.ids.s2_b.text = ""
|
||||
self.ids.s2_c.text = ""
|
||||
self.ids.s2_t.text = ""
|
||||
self.ids.s3_a.text = ""
|
||||
self.ids.s3_b.text = ""
|
||||
self.ids.s3_c.text = ""
|
||||
self.ids.s3_t.text = ""
|
||||
self.ids.s4_a.text = ""
|
||||
self.ids.s4_b.text = ""
|
||||
self.ids.s4_c.text = ""
|
||||
self.ids.s4_t.text = ""
|
||||
self.__mode = 1
|
||||
else:
|
||||
self.ids.prsel.state = "down"
|
||||
Clock.schedule_once(self.read_data, 1)
|
||||
self.__mode = 2
|
||||
|
||||
def change_mode(self):
|
||||
logger.info("Changing mode")
|
||||
logger.debug(f"mode was: {self.__mode}")
|
||||
if self.__mode == 1:
|
||||
logger.debug("Sending instruction to read info")
|
||||
Clock.schedule_once(self.read_data, 1)
|
||||
self.__mode = 2
|
||||
else:
|
||||
self.ids.s1_a.text = ""
|
||||
self.ids.s1_b.text = ""
|
||||
self.ids.s1_c.text = ""
|
||||
self.ids.s1_t.text = ""
|
||||
self.ids.s2_a.text = ""
|
||||
self.ids.s2_b.text = ""
|
||||
self.ids.s2_c.text = ""
|
||||
self.ids.s2_t.text = ""
|
||||
self.ids.s3_a.text = ""
|
||||
self.ids.s3_b.text = ""
|
||||
self.ids.s3_c.text = ""
|
||||
self.ids.s3_t.text = ""
|
||||
self.ids.s4_a.text = ""
|
||||
self.ids.s4_b.text = ""
|
||||
self.ids.s4_c.text = ""
|
||||
self.ids.s4_t.text = ""
|
||||
self.__mode = 1
|
||||
|
||||
def read_data(self, dt):
|
||||
logger.debug("Starting to read data from the microcontroller")
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.error(f"COM_error: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("Sending instructions")
|
||||
com.send("RD")
|
||||
self.__pos = 1
|
||||
self.__beginning = time.time()
|
||||
logger.info("Awaiting confirmation from the microcontroller for hook")
|
||||
while True:
|
||||
if time.time() - self.__beginning < 5:
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "R":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "D":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.go = 1
|
||||
logger.info("Hook successful")
|
||||
break
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
self.go = 0
|
||||
logger.error("Microcontroller not available, stopping connection")
|
||||
break
|
||||
if self.go == 1:
|
||||
for i in range(4):
|
||||
self.__x = com.receive(28)
|
||||
self.__a = str(com.decode_float(self.__x[0:6]))
|
||||
self.__b = str(com.decode_float(self.__x[7:13]))
|
||||
self.__c = str(com.decode_float(self.__x[14:20]))
|
||||
self.__temp = str(com.decode_float(self.__x[21:27]))
|
||||
if self.__pos == 1:
|
||||
self.ids.s1_a.text = self.__a
|
||||
self.ids.s1_b.text = self.__b
|
||||
self.ids.s1_c.text = self.__c
|
||||
self.ids.s1_t.text = self.__temp
|
||||
elif self.__pos == 2:
|
||||
self.ids.s2_a.text = self.__a
|
||||
self.ids.s2_b.text = self.__b
|
||||
self.ids.s2_c.text = self.__c
|
||||
self.ids.s2_t.text = self.__temp
|
||||
elif self.__pos == 3:
|
||||
self.ids.s3_a.text = self.__a
|
||||
self.ids.s3_b.text = self.__b
|
||||
self.ids.s3_c.text = self.__c
|
||||
self.ids.s3_t.text = self.__temp
|
||||
elif self.__pos == 4:
|
||||
self.ids.s4_a.text = self.__a
|
||||
self.ids.s4_b.text = self.__b
|
||||
self.ids.s4_c.text = self.__c
|
||||
self.ids.s4_t.text = self.__temp
|
||||
self.__pos += 1
|
||||
logger.info("Recieved info from microcontroller")
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
com.quitcom()
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
|
||||
def create_com(self):
|
||||
self.coms = bin.lib.communication.Communication()
|
||||
|
||||
def send_data(self):
|
||||
try:
|
||||
self.create_com()
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.critical(f"TRANSMISSION_Error: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("Preparing data to be sent")
|
||||
self.__transmit = []
|
||||
if self.ids.s1_a.text != "" and self.ids.s1_b.text != "" and self.ids.s1_c.text != "" and self.ids.s1_t.text != "" and self.ids.s2_a.text != "" and self.ids.s2_b.text != "" and self.ids.s2_c.text != "" and self.ids.s2_t.text != "" and self.ids.s3_a.text != "" and self.ids.s3_b.text != "" and self.ids.s3_c.text != "" and self.ids.s3_t.text != "" and self.ids.s4_a.text != "" and self.ids.s4_b.text != "" and self.ids.s4_c.text != "" and self.ids.s4_t.text != "":
|
||||
self.__transmit.append(self.ids.s1_a.text)
|
||||
self.__transmit.append(self.ids.s1_b.text)
|
||||
self.__transmit.append(self.ids.s1_c.text)
|
||||
self.__transmit.append(self.ids.s1_t.text)
|
||||
self.__transmit.append(self.ids.s2_a.text)
|
||||
self.__transmit.append(self.ids.s2_b.text)
|
||||
self.__transmit.append(self.ids.s2_c.text)
|
||||
self.__transmit.append(self.ids.s2_t.text)
|
||||
self.__transmit.append(self.ids.s3_a.text)
|
||||
self.__transmit.append(self.ids.s3_b.text)
|
||||
self.__transmit.append(self.ids.s3_c.text)
|
||||
self.__transmit.append(self.ids.s3_t.text)
|
||||
self.__transmit.append(self.ids.s4_a.text)
|
||||
self.__transmit.append(self.ids.s4_b.text)
|
||||
self.__transmit.append(self.ids.s4_c.text)
|
||||
self.__transmit.append(self.ids.s4_t.text)
|
||||
logger.debug("trying to send...")
|
||||
try:
|
||||
self.coms.change_all(self.__transmit, special_port)
|
||||
logger.info("Transmission successful")
|
||||
logger.debug("purging fields...")
|
||||
self.ids.s1_a.text = ""
|
||||
self.ids.s1_b.text = ""
|
||||
self.ids.s1_c.text = ""
|
||||
self.ids.s1_t.text = ""
|
||||
self.ids.s2_a.text = ""
|
||||
self.ids.s2_b.text = ""
|
||||
self.ids.s2_c.text = ""
|
||||
self.ids.s2_t.text = ""
|
||||
self.ids.s3_a.text = ""
|
||||
self.ids.s3_b.text = ""
|
||||
self.ids.s3_c.text = ""
|
||||
self.ids.s3_t.text = ""
|
||||
self.ids.s4_a.text = ""
|
||||
self.ids.s4_b.text = ""
|
||||
self.ids.s4_c.text = ""
|
||||
self.ids.s4_t.text = ""
|
||||
self.openconfpu()
|
||||
except Exception as e:
|
||||
self.open_confail_pu()
|
||||
logger.critical(f"TRANSMITION_Error: {e}")
|
||||
else:
|
||||
self.openerrorpu()
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
|
||||
def openerrorpu(self):
|
||||
self.pu = MissingFieldsError()
|
||||
self.pu.open()
|
||||
|
||||
def open_confail_pu(self):
|
||||
self.cfpu = ConnectionFail()
|
||||
self.cfpu.open()
|
||||
|
||||
def openconfpu(self):
|
||||
self.confpus = SaveConf()
|
||||
self.confpus.open()
|
||||
|
||||
|
||||
class ProgramTemp(Screen):
|
||||
def read_config(self):
|
||||
logger.debug("Reading config")
|
||||
self.config_imp = []
|
||||
self.__export = []
|
||||
self.config_imp = cvr.importing("./config/config.csv")
|
||||
self.__export = self.config_imp.pop(0)
|
||||
self.__extracted = self.__export.pop(0)
|
||||
logger.debug(f"Mode set is: {self.__extracted}")
|
||||
if self.__extracted == "1":
|
||||
self.ids.prsel.state = "normal"
|
||||
self.ids.temp_s1.text = ""
|
||||
self.ids.temp_s2.text = ""
|
||||
self.ids.temp_s3.text = ""
|
||||
self.ids.temp_s4.text = ""
|
||||
self.__mode = 1
|
||||
else:
|
||||
self.ids.prsel.state = "down"
|
||||
Clock.schedule_once(self.read_data, 1)
|
||||
self.__mode = 2
|
||||
|
||||
def change_mode(self):
|
||||
logger.info("Changing mode")
|
||||
logger.debug(f"Mode was: {self.__mode}")
|
||||
if self.__mode == 1:
|
||||
logger.info("starting sub-thread")
|
||||
Clock.schedule_once(self.read_data, 1)
|
||||
self.__mode = 2
|
||||
else:
|
||||
logger.info("clearing screen")
|
||||
self.ids.temp_s1.text = ""
|
||||
self.ids.temp_s2.text = ""
|
||||
self.ids.temp_s3.text = ""
|
||||
self.ids.temp_s4.text = ""
|
||||
self.__mode = 1
|
||||
|
||||
def read_data(self, dt):
|
||||
logger.info("Trying to establish connection...")
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.error(f"COM_Error: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("Sending instructions to microcontroller...")
|
||||
com.send("RD")
|
||||
self.__pos = 1
|
||||
self.__beginning = time.time()
|
||||
self.go = 1
|
||||
logger.info("Awaiting confirmation from the microcontroller for hook")
|
||||
while True:
|
||||
if time.time() - self.__beginning < 5:
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "R":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "D":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.go = 1
|
||||
logger.info("Hook successful")
|
||||
break
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
self.go = 0
|
||||
logger.error("Microcontroller not available, stopping connection")
|
||||
break
|
||||
if self.go == 1:
|
||||
logger.info("Receiving data...")
|
||||
for i in range(4):
|
||||
self.__x = com.receive(28)
|
||||
self.__output = str(com.decode_float(self.__x[21:27]))
|
||||
if self.__pos == 1:
|
||||
self.ids.temp_s1.text = self.__output
|
||||
elif self.__pos == 2:
|
||||
self.ids.temp_s2.text = self.__output
|
||||
elif self.__pos == 3:
|
||||
self.ids.temp_s3.text = self.__output
|
||||
elif self.__pos == 4:
|
||||
self.ids.temp_s4.text = self.__output
|
||||
self.__pos += 1
|
||||
logger.info("Recieved data")
|
||||
com.quitcom()
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
|
||||
def create_com(self):
|
||||
self.coms = bin.lib.communication.Communication()
|
||||
|
||||
def send_data(self):
|
||||
try:
|
||||
self.create_com()
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.critical(f"COM_Error: Microcontroller unavailable: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("Preparing transmission...")
|
||||
self.__transmit = []
|
||||
if self.ids.temp_s1.text != "" and self.ids.temp_s2.text != "" and self.ids.temp_s3.text != "" and self.ids.temp_s4.text != "":
|
||||
self.__transmit.append(self.ids.temp_s1.text)
|
||||
self.__transmit.append(self.ids.temp_s2.text)
|
||||
self.__transmit.append(self.ids.temp_s3.text)
|
||||
self.__transmit.append(self.ids.temp_s4.text)
|
||||
logger.debug("Transmitting...")
|
||||
self.coms.change_temp(self.__transmit, special_port)
|
||||
self.ids.temp_s1.text = ""
|
||||
self.ids.temp_s2.text = ""
|
||||
self.ids.temp_s3.text = ""
|
||||
self.ids.temp_s4.text = ""
|
||||
self.openconfpu()
|
||||
else:
|
||||
self.openerrorpu()
|
||||
logger.debug("Missing fields")
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
|
||||
def openerrorpu(self):
|
||||
self.pu = MissingFieldsError()
|
||||
self.pu.open()
|
||||
|
||||
def openconfpu(self):
|
||||
self.confpu = SaveConf()
|
||||
self.confpu.open()
|
||||
|
||||
def open_confail_pu(self):
|
||||
self.cfpu = ConnectionFail()
|
||||
self.cfpu.open()
|
||||
|
||||
|
||||
class ReadData(Screen):
|
||||
def read_data(self):
|
||||
logger.info("Trying to connect to the microcontroller")
|
||||
try:
|
||||
com.connect(19200, special_port)
|
||||
self.go = 1
|
||||
except Exception as e:
|
||||
self.go = 0
|
||||
logger.error(f"COM_Error: {e}")
|
||||
|
||||
if self.go == 1:
|
||||
logger.info("Sending instructions to the microcontroller...")
|
||||
com.send("RD")
|
||||
self.__pos = 1
|
||||
self.__beginning = time.time()
|
||||
self.go = 1
|
||||
logger.info("Awaiting confirmation from the microcontroller for hook")
|
||||
while True:
|
||||
if time.time() - self.__beginning < 5:
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "R":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "D":
|
||||
self.__data_recieve = com.decode_ascii(com.receive(1))
|
||||
if self.__data_recieve == "\n":
|
||||
self.go = 1
|
||||
logger.info("Hook successful")
|
||||
break
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
self.go = 0
|
||||
logger.error("Microcontroller not available, stopping connection")
|
||||
break
|
||||
if self.go == 1:
|
||||
logger.info("Receiving data")
|
||||
for i in range(4):
|
||||
self.__x = com.receive(28)
|
||||
self.__output = "a: "
|
||||
self.__output += str(com.decode_float(self.__x[0:6]))
|
||||
self.__output += f"\nb: {str(com.decode_float(self.__x[7:13]))}"
|
||||
self.__output += f"\nc: {str(com.decode_float(self.__x[14:20]))}"
|
||||
self.__output += f"\nTemp: {str(com.decode_float(self.__x[21:27]))}"
|
||||
if self.__pos == 1:
|
||||
self.ids.inf_sonde1.text = self.__output
|
||||
elif self.__pos == 2:
|
||||
self.ids.inf_sonde2.text = self.__output
|
||||
elif self.__pos == 3:
|
||||
self.ids.inf_sonde3.text = self.__output
|
||||
elif self.__pos == 4:
|
||||
self.ids.inf_sonde4.text = self.__output
|
||||
self.__pos += 1
|
||||
logger.info("Received data")
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
com.quitcom()
|
||||
else:
|
||||
self.open_confail_pu()
|
||||
|
||||
def open_confail_pu(self):
|
||||
self.cfpu = ConnectionFail()
|
||||
self.cfpu.open()
|
||||
|
||||
|
||||
class Credits(Screen):
|
||||
pass
|
||||
|
||||
|
||||
class Modify(Screen):
|
||||
def read_config(self):
|
||||
logger.debug("Reading config")
|
||||
self.config_imp = []
|
||||
self.__export = []
|
||||
self.config_imp = cvr.importing("./config/config.csv")
|
||||
self.__export = self.config_imp.pop(0)
|
||||
self.__extracted = self.__export.pop(0)
|
||||
logger.debug(f"Mode at: {self.__extracted}")
|
||||
if self.__extracted == "1":
|
||||
self.ids.prsel.state = "normal"
|
||||
else:
|
||||
self.ids.prsel.state = "down"
|
||||
|
||||
def issue_reporting(self):
|
||||
logger.info("Clicked error reporting button")
|
||||
webbrowser.open("https://github.com/simplePCBuilding/BiogasControllerApp/issues", new=2)
|
||||
|
||||
def change_programming(self):
|
||||
logger.info("Switching programming mode")
|
||||
self.csv_import = []
|
||||
self.csv_import = cvr.importing("./config/config.csv")
|
||||
self.csv_import.pop(0)
|
||||
if self.ids.prsel.text == "Full\nreprogramming":
|
||||
self.csv_import.insert(0, 1)
|
||||
else:
|
||||
self.csv_import.insert(0, 2)
|
||||
logger.debug(f"Mode now: {self.csv_import}")
|
||||
cvw.write_str("./config/config.csv", self.csv_import)
|
||||
|
||||
|
||||
########################################################
|
||||
# Screenmanager
|
||||
########################################################
|
||||
|
||||
|
||||
class RootScreen(ScreenManager):
|
||||
pass
|
||||
|
||||
|
||||
class BiogasControllerApp(App):
|
||||
def build(self):
|
||||
self.icon = "./BiogasControllerAppLogo.png"
|
||||
self.title = "BiogasControllerApp"
|
||||
return Builder.load_file("./bin/gui/gui.kv")
|
||||
|
||||
|
||||
logger.info("Init finished, starting UI")
|
||||
|
||||
if __name__ == "__main__":
|
||||
bga = BiogasControllerApp()
|
||||
bga.run()
|
||||
1
BiogasControllerApp-V2.3/config/config.csv
Normal file
1
BiogasControllerApp-V2.3/config/config.csv
Normal file
@@ -0,0 +1 @@
|
||||
2
|
||||
|
16
BiogasControllerApp-V2.3/config/settings.ini
Normal file
16
BiogasControllerApp-V2.3/config/settings.ini
Normal file
@@ -0,0 +1,16 @@
|
||||
[Port Settings]
|
||||
specificPort = None
|
||||
|
||||
[UI Config]
|
||||
sizeH = 600
|
||||
sizeW = 800
|
||||
|
||||
[Dev Settings]
|
||||
# Settings generally aimed towards the devs of this software!
|
||||
verbose = False
|
||||
log_level = DEBUG
|
||||
disableConnectionCheck = False
|
||||
|
||||
[Info]
|
||||
version = V2.3.0
|
||||
subVersion =
|
||||
5
BiogasControllerApp-V2.3/log/logging.md
Normal file
5
BiogasControllerApp-V2.3/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