def continuous_measure(time_intervals, checksum, communication_data): # this method needs its own sender class to not have to communicate with the main process communication_socket = communication_data['socket'] communication_ip = communication_data['ip'] communication_port = communication_data['port'] status_working(communication_socket, communication_ip, communication_port) results = rangefinder.get_all_distances() # while not any(result is not None for result in results): while not measurement_started(results): time.sleep(0.1) results = rangefinder.get_all_values() blink() counter = 1 for interval in time_intervals: time.sleep(interval) blink() results = ["%.3f" % result for result in rangefinder.get_all_distances()] results = [result.replace('.', ',') for result in results] to_send = [str(counter)] + list(results) + [checksum] send_values(to_send, communication_socket, communication_ip, communication_port) counter += 1 status_idle(communication_socket, communication_ip, communication_port)
def continuous_measure(time_intervals, checksum, communication_data): # this method needs its own sender class to not have to communicate with the main process communication_socket = communication_data['socket'] communication_ip = communication_data['ip'] communication_port = communication_data['port'] status_working(communication_socket, communication_ip, communication_port) results = rangefinder.get_all_distances() # while not any(result is not None for result in results): while not measurement_started(results): time.sleep(0.1) results = rangefinder.get_all_values() blink() counter = 1 for interval in time_intervals: time.sleep(interval) blink() results = [ "%.3f" % result for result in rangefinder.get_all_distances() ] results = [result.replace('.', ',') for result in results] to_send = [str(counter)] + list(results) + [checksum] send_values(to_send, communication_socket, communication_ip, communication_port) counter += 1 status_idle(communication_socket, communication_ip, communication_port)
def action_single(self, checksum): self.log('Starting single') blink() values = ["%.3f" % value for value in rangefinder.get_all_distances()] values = [value.replace('.', ',') for value in values] to_send = ['0'] + list(values) + [checksum] self.log('Sending values for single') send_values(to_send, self.socket, self.communication_ip, self.communication_port_send)
def action_single(self, checksum): self.log('Starting single') blink() values = ["%.3f" % value for value in rangefinder.get_all_distances()] values = [value.replace('.', ',') for value in values] to_send = ['0'] + list(values) + [checksum] self.log('Sending values for single') send_values(to_send, self.socket, self.communication_ip, self.communication_port_send)