X-Git-Url: https://git.ao2.it/SaveMySugar/python3-savemysugar.git/blobdiff_plain/88fce7811221c360966eb3af691a719930a2514d..297bb65e550d72eddf2cdd624ea96d18099941de:/src/measure_ring_distance.py?ds=sidebyside diff --git a/src/measure_ring_distance.py b/src/measure_ring_distance.py index 87f6da3..66e43d3 100755 --- a/src/measure_ring_distance.py +++ b/src/measure_ring_distance.py @@ -17,9 +17,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import time + from savemysugar.cumulative_average import cumulative_average from savemysugar.Modem import Modem -import time class Rings(object): @@ -46,12 +47,10 @@ def on_ring(): Rings.count - 1, distance) print() print("Other ring") - print("distance: %f" % distance) - print("min_distance: %f" % Rings.min_distance) - print("max_distance: %f" % Rings.max_distance) - print("average_distance: %f" % Rings.average_distance) - uncertainty = (Rings.max_distance - Rings.min_distance) / 2. - print("uncertainty: %f" % uncertainty) + print("Ring distance: %f" % distance) + print("Min ring distance: %f" % Rings.min_distance) + print("Max ring distance %f" % Rings.max_distance) + print("Average distance: %f" % Rings.average_distance) def measure_ring_distance(ingoing_port, outgoing_port, destination_number): @@ -59,7 +58,7 @@ def measure_ring_distance(ingoing_port, outgoing_port, destination_number): ingoing_modem.register_callback("RING", on_ring) outgoing_modem = Modem(outgoing_port) - outgoing_modem.send_command("ATDT" + destination_number) + outgoing_modem.send_command("ATDT" + destination_number + ";") try: ingoing_modem.get_response_loop()