mirror of
https://github.com/janishutz/BiogasControllerApp.git
synced 2025-11-25 05:44:23 +00:00
Fix up hooking process for main
This commit is contained in:
@@ -8,7 +8,7 @@ sizew = 800
|
|||||||
[Dev]
|
[Dev]
|
||||||
verbose = True
|
verbose = True
|
||||||
log_level = DEBUG
|
log_level = DEBUG
|
||||||
use_test_library = True
|
use_test_library = False
|
||||||
|
|
||||||
[Info]
|
[Info]
|
||||||
version = V2.3.0
|
version = V2.3.0
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class ReaderThread(threading.Thread):
|
|||||||
if self._com == None:
|
if self._com == None:
|
||||||
raise ArgumentError("Com object not passed in (do using set_com)")
|
raise ArgumentError("Com object not passed in (do using set_com)")
|
||||||
# Hook to output stream
|
# Hook to output stream
|
||||||
if self._instructions.hook("", ["\n", " ", " ", " "]):
|
if self._instructions.hook_main():
|
||||||
# We are now hooked to the stream (i.e. data is synced)
|
# We are now hooked to the stream (i.e. data is synced)
|
||||||
synced_queue.put(["HOOK"])
|
synced_queue.put(["HOOK"])
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class ReaderThread(threading.Thread):
|
|||||||
# This allows for short code
|
# This allows for short code
|
||||||
data.append(
|
data.append(
|
||||||
f"Tadc: {
|
f"Tadc: {
|
||||||
self._decoder.decode_float(received[12 * i:12 * i + 4])
|
self._decoder.decode_int(received[12 * i:12 * i + 4])
|
||||||
}\nTemperature: {
|
}\nTemperature: {
|
||||||
self._decoder.decode_float(received[12 * i + 5:12 * i + 11])
|
self._decoder.decode_float(received[12 * i + 5:12 * i + 11])
|
||||||
}\nDuty-Cycle: {
|
}\nDuty-Cycle: {
|
||||||
@@ -135,7 +135,7 @@ class MainScreen(Screen):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# End connection to micro-controller and set it back to normal mode
|
# End connection to micro-controller and set it back to normal mode
|
||||||
def end(self):
|
def end(self, set_msg: bool = True):
|
||||||
# Set micro-controller back to Normal Mode when ending communication
|
# Set micro-controller back to Normal Mode when ending communication
|
||||||
# to make sure temperature control will work
|
# to make sure temperature control will work
|
||||||
if self._has_connected:
|
if self._has_connected:
|
||||||
@@ -147,6 +147,7 @@ class MainScreen(Screen):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self._com.close()
|
self._com.close()
|
||||||
|
if set_msg:
|
||||||
self.ids.status.text = "Connection terminated"
|
self.ids.status.text = "Connection terminated"
|
||||||
print("Connection terminated")
|
print("Connection terminated")
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ class MainScreen(Screen):
|
|||||||
if len(update) == 1:
|
if len(update) == 1:
|
||||||
if update[0] == "ERR_HOOK":
|
if update[0] == "ERR_HOOK":
|
||||||
self.ids.status.text = "Hook failed"
|
self.ids.status.text = "Hook failed"
|
||||||
self.end()
|
self.end(False)
|
||||||
elif update[0] == "HOOK":
|
elif update[0] == "HOOK":
|
||||||
self.ids.status.text = "Connected to controller"
|
self.ids.status.text = "Connected to controller"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user