feat(itho-wpu): support for all datatypes supported by the service tool
* 0x0: integer (1 byte) * 0x1: 1 decimal float (1 byte) * 0x2: 2 decimal float (1 byte) * 0xc: integer (1 byte) * 0xf: integer/2 (1 byte) * 0x10: 0 decimal unsigned integer (2 bytes) * 0x11: 1 decimal unsigned float (2 bytes) * 0x12: 2 decimal unsigned float (2 bytes) * 0x13: 3 decimal unsigned float (2 bytes) * 0x14: 4 decimal unsigned float (2 bytes) * 0x20: 0 decimal unsigned integer (4 bytes) * 0x21: 1 decimal unsigned float (4 bytes) * 0x22: 2 decimal unsigned float (4 bytes) * 0x23: 3 decimal unsigned float (4 bytes) * 0x24: 4 decimal unsigned float (4 bytes) * 0x25: 5 decimal unsigned float (4 bytes) * 0x5b: unsigned integer (2 bytes) * 0x6c: integer (max 1) (1 byte) * 0x80: 0 decimal signed integer (1 byte) * 0x81: 1 decimal signed float (1 byte) * 0x82: 2 decimal signed float (1 byte) * 0x8f: 3 decimal signed float (1 byte) * 0x90: 0 decimal signed integer (2 bytes) * 0x91: 1 decimal signed float (2 bytes) * 0x92: 2 decimal signed float (2 bytes) * 0xa0: 0 decimal signed integer (4 bytes) * 0xa1: 1 decimal signed float (4 bytes) * 0xa2: 2 decimal signed float (4 bytes) * 0xa3: 3 decimal signed float (4 bytes) * 0xa4: 4 decimal signed float (4 bytes) * 0xa5: 5 decimal signed float (4 bytes)
This commit is contained in:
		
							parent
							
								
									370209603b
								
							
						
					
					
						commit
						c41b700f13
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -132,17 +132,18 @@ class IthoWPU:
 | 
			
		|||
        datalog = []
 | 
			
		||||
        index = 0
 | 
			
		||||
        for dl, dt in zip(datalabel, self.datatype[5:-1]):
 | 
			
		||||
            dt = int(dt, 0)
 | 
			
		||||
            description = dl["title"].title()
 | 
			
		||||
            if dl["unit"] is not None:
 | 
			
		||||
                description = f"{description} ({dl['unit']})"
 | 
			
		||||
            description = f"{description} ({dl['name'].lower()})"
 | 
			
		||||
            datalog.append(Field(index, int(dt, 0), dl["name"].lower(), description))
 | 
			
		||||
            datalog.append(Field(index, dt, dl["name"].lower(), description))
 | 
			
		||||
 | 
			
		||||
            if dt in ["0x0", "0xc"]:
 | 
			
		||||
            if dt in [0x0, 0x1, 0x2, 0xC, 0xF, 0x6C, 0x80, 0x81, 0x82, 0x8F]:
 | 
			
		||||
                index = index + 1
 | 
			
		||||
            elif dt in ["0x10", "0x12", "0x90", "0x92"]:
 | 
			
		||||
            elif dt in [0x10, 0x11, 0x12, 0x13, 0x14, 0x51, 0x90, 0x91, 0x92]:
 | 
			
		||||
                index = index + 2
 | 
			
		||||
            elif dt in ["0x20"]:
 | 
			
		||||
            elif dt in [0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5]:
 | 
			
		||||
                index = index + 4
 | 
			
		||||
            else:
 | 
			
		||||
                logger.error(f"Unknown data type for label {dl['name']}: {dt}")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue