]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/mlx90614/pd.py
Use the new Decoder.register() API
[libsigrokdecode.git] / decoders / mlx90614 / pd.py
index 1ee88d78509bad088f36254e1c4ab5b778beb350..f0bed5c653a801a86f3d220cd8fcb46de69c11b1 100644 (file)
@@ -1,5 +1,5 @@
 ##
-## This file is part of the sigrok project.
+## This file is part of the libsigrokdecode project.
 ##
 ## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
 ##
@@ -36,16 +36,16 @@ class Decoder(srd.Decoder):
     options = {}
     annotations = [
         ['Celsius', 'Temperature in degrees Celsius'],
-        ['Kelvin', 'Temperature in degrees Kelvin'],
+        ['Kelvin', 'Temperature in Kelvin'],
     ]
 
     def __init__(self, **kwargs):
         self.state = 'IGNORE START REPEAT'
         self.data = []
 
-    def start(self, metadata):
-        # self.out_proto = self.add(srd.OUTPUT_PROTO, 'mlx90614')
-        self.out_ann = self.add(srd.OUTPUT_ANN, 'mlx90614')
+    def start(self):
+        # self.out_proto = self.register(srd.OUTPUT_PYTHON)
+        self.out_ann = self.register(srd.OUTPUT_ANN)
 
     def report(self):
         pass
@@ -79,9 +79,9 @@ class Decoder(srd.Decoder):
                 kelvin = (self.data[0] | (self.data[1] << 8)) * 0.02
                 celsius = kelvin - 273.15
                 self.putx([0, ['Temperature: %3.2f °C' % celsius]])
-                self.putx([1, ['Temperature: %3.2f °K' % kelvin]])
+                self.putx([1, ['Temperature: %3.2f K' % kelvin]])
                 self.state = 'IGNORE START REPEAT'
                 self.data = []
         else:
-            raise Exception('Invalid state: %d' % self.state)
+            raise Exception('Invalid state: %s' % self.state)