From 9435312846923fef25dddcd6908670febef3d3b5 Mon Sep 17 00:00:00 2001 From: Dawid SQ6EMM Date: Thu, 14 Dec 2023 10:27:32 +0100 Subject: [PATCH] decode was completely not working --- python/mopp/src/mopp/__init__.py | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/python/mopp/src/mopp/__init__.py b/python/mopp/src/mopp/__init__.py index bb0a325..d80c8ee 100644 --- a/python/mopp/src/mopp/__init__.py +++ b/python/mopp/src/mopp/__init__.py @@ -55,23 +55,22 @@ def decode(buffer): outcode = "" outchars = "" for el in buffer: - if el == "01": - outcode += "." - elif el == "10": - outcode += "-" - elif el == "00": - - for letter, code in morse.items(): - if code == outcode: - outchars += letter - outcode = "" - elif el =="11": - for letter, code in morse.items(): - if code == outcode: - outchars += letter - outcode = "" - outchars = outchars + " " - return outchars + if el == "01": + outcode += "." + elif el == "10": + outcode += "-" + elif el == "00": + for letter, code in morse.items(): + if code == outcode: + outchars += letter + outcode = "" + elif el == "11": + for letter, code in morse.items(): + if code == outcode: + outchars += letter + outcode = "" + outchars = outchars + " " + return outchars #make own zfill for uPython @@ -244,4 +243,5 @@ def return_duration_json(self, message): data['durations'].append(-self.eow_duration) updated_json_string = json.dumps(data, indent=2) - return updated_json_string \ No newline at end of file + return updated_json_string +