mirror of
				https://github.com/liberatedsystems/Sideband_CE.git
				synced 2024-09-03 04:13:27 +02:00 
			
		
		
		
	Fixed telemeter rendering
This commit is contained in:
		
							parent
							
								
									66243b3bfb
								
							
						
					
					
						commit
						45822e5aec
					
				@ -30,6 +30,7 @@ class Telemeter():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          if name != None:
 | 
					          if name != None:
 | 
				
			||||||
            s.data = s.unpack(p[sid])
 | 
					            s.data = s.unpack(p[sid])
 | 
				
			||||||
 | 
					            s.synthesized = True
 | 
				
			||||||
            s.active = True
 | 
					            s.active = True
 | 
				
			||||||
            t.sensors[name] = s
 | 
					            t.sensors[name] = s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -182,6 +183,7 @@ class Sensor():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  @property
 | 
					  @property
 | 
				
			||||||
  def data(self):
 | 
					  def data(self):
 | 
				
			||||||
 | 
					    if not self.synthesized:
 | 
				
			||||||
      if self._data == None or (self._stale_time != None and time.time() > self.last_update+self._stale_time):
 | 
					      if self._data == None or (self._stale_time != None and time.time() > self.last_update+self._stale_time):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
          self.update_data()
 | 
					          self.update_data()
 | 
				
			||||||
@ -270,11 +272,14 @@ class Time(Sensor):
 | 
				
			|||||||
      return None
 | 
					      return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def render(self, relative_to=None):
 | 
					  def render(self, relative_to=None):
 | 
				
			||||||
 | 
					    if self.data != None:
 | 
				
			||||||
      rendered = {
 | 
					      rendered = {
 | 
				
			||||||
        "icon": "clock-time-ten-outline",
 | 
					        "icon": "clock-time-ten-outline",
 | 
				
			||||||
        "name": "Timestamp",
 | 
					        "name": "Timestamp",
 | 
				
			||||||
        "values": { "UTC": self.data["utc"] },
 | 
					        "values": { "UTC": self.data["utc"] },
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					      rendered = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return rendered
 | 
					    return rendered
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -559,10 +564,6 @@ class Pressure(Sensor):
 | 
				
			|||||||
        if self.data["mbar"] != None:
 | 
					        if self.data["mbar"] != None:
 | 
				
			||||||
          delta = round(rs.data["mbar"] - self.data["mbar"], 1)
 | 
					          delta = round(rs.data["mbar"] - self.data["mbar"], 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO: Remove
 | 
					 | 
				
			||||||
    # RNS.log("OVERRIDING DELTA", RNS.LOG_WARNING)
 | 
					 | 
				
			||||||
    # delta = round(740.1 - self.data["mbar"], 1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rendered = {
 | 
					    rendered = {
 | 
				
			||||||
      "icon": "weather-cloudy",
 | 
					      "icon": "weather-cloudy",
 | 
				
			||||||
      "name": "Ambient Pressure",
 | 
					      "name": "Ambient Pressure",
 | 
				
			||||||
@ -1075,10 +1076,6 @@ class AmbientLight(Sensor):
 | 
				
			|||||||
        if self.data["lux"] != None:
 | 
					        if self.data["lux"] != None:
 | 
				
			||||||
          delta = round(rs.data["lux"] - self.data["lux"], 2)
 | 
					          delta = round(rs.data["lux"] - self.data["lux"], 2)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    # TODO: Remove
 | 
					 | 
				
			||||||
    # RNS.log("OVERRIDING DELTA", RNS.LOG_WARNING)
 | 
					 | 
				
			||||||
    # delta = round(2500 - self.data["lux"], 2)
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    rendered = {
 | 
					    rendered = {
 | 
				
			||||||
      "icon": "white-balance-sunny",
 | 
					      "icon": "white-balance-sunny",
 | 
				
			||||||
      "name": "Ambient Light",
 | 
					      "name": "Ambient Light",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user