Ejemplo n.º 1
0
 def update_telemetry(self, telemetry_data):
     if (self.view_type == ViewTypes.ARDUINO):
         #tlv = ArduinoHelper.create_tlv(telemetry_data)
         tlv_lcd = ArduinoHelper.create_lcd_tlv(telemetry_data)
         tlv_led = ArduinoHelper.create_led_tlv(telemetry_data)
         #print("".join("%02x" % b for b in tlv.serialize()))
         self.serial.write(tlv_lcd.serialize())
         self.serial.write(tlv_led.serialize())
         print("------------SPEED-------------")
         print("           " + str(int(Convert.speed_to_kph(telemetry_data.speed))) + " KPH")
     elif (self.view_type == ViewTypes.GPIO):
         print("------------GEAR-------------")
         print("            " + str(telemetry_data.current_gear))
         print("------------------------------")
         self.gpio.update_all(telemetry_data)
     elif (self.view_type == ViewTypes.CONSOLE):
         os.system('cls' if os.name=='nt' else 'clear')
         print("------------------------------")
         print("-------------RPM--------------")
         print("            " + str(telemetry_data.rpm))
         aux = int((telemetry_data.rpm / telemetry_data.max_rpm) * 10)
         string_rpm = "----["
         for i in range(0,aux):
             string_rpm += '**'
         for i in range(aux, 10):
             string_rpm += '  '
         string_rpm += "]----"
         print(string_rpm)
         print("------------SPEED-------------")
         print("           " + str(int(Convert.speed_to_kph(telemetry_data.speed))) + " KPH")
         print("------------GEAR-------------")
         print("            " + str(telemetry_data.current_gear))
         print("------------------------------")
Ejemplo n.º 2
0
def create_lcd_tlv(telemetry_data):
    return TLV.TLVNode(TLV.TAGList.LCD, (str(int(Convert.speed_to_kph(telemetry_data.speed))) + " kph").encode("ascii"))