| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2,8 +2,6 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <QMouseEvent> | 
					 | 
					 | 
					 | 
					#include <QMouseEvent> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "selfdrive/common/util.h" | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "selfdrive/hardware/hw.h" | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "selfdrive/ui/qt/util.h" | 
					 | 
					 | 
					 | 
					#include "selfdrive/ui/qt/util.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void Sidebar::drawMetric(QPainter &p, const QString &label, const QString &val, QColor c, int y) { | 
					 | 
					 | 
					 | 
					void Sidebar::drawMetric(QPainter &p, const QString &label, const QString &val, QColor c, int y) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -59,42 +57,31 @@ void Sidebar::updateState(const UIState &s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  int strength = (int)deviceState.getNetworkStrength(); | 
					 | 
					 | 
					 | 
					  int strength = (int)deviceState.getNetworkStrength(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  setProperty("netStrength", strength > 0 ? strength + 1 : 0); | 
					 | 
					 | 
					 | 
					  setProperty("netStrength", strength > 0 ? strength + 1 : 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  ItemStatus connectstatus; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  auto last_ping = deviceState.getLastAthenaPingTime(); | 
					 | 
					 | 
					 | 
					  auto last_ping = deviceState.getLastAthenaPingTime(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (last_ping == 0) { | 
					 | 
					 | 
					 | 
					  if (last_ping == 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (params.getBool("PrimeRedirected")) { | 
					 | 
					 | 
					 | 
					    connectstatus = params.getBool("PrimeRedirected") ? ItemStatus{"NO\nPRIME", danger_color} : ItemStatus{"CONNECT\nOFFLINE", warning_color}; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      setProperty("connectStr", "NO\nPRIME"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      setProperty("connectStatus", danger_color); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else { | 
					 | 
					 | 
					 | 
					  } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      setProperty("connectStr", "CONNECT\nOFFLINE"); | 
					 | 
					 | 
					 | 
					    connectstatus = nanos_since_boot() - last_ping < 80e9 ? ItemStatus{"CONNECT\nONLINE", good_color} : ItemStatus{"CONNECT\nERROR", danger_color}; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      setProperty("connectStatus", warning_color); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    bool online = nanos_since_boot() - last_ping < 80e9; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    setProperty("connectStr",  (online ? "CONNECT\nONLINE" : "CONNECT\nERROR")); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    setProperty("connectStatus", online ? good_color : danger_color); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  setProperty("connectStatus", QVariant::fromValue(connectstatus)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QColor tempStatus = danger_color; | 
					 | 
					 | 
					 | 
					  QColor tempColor = danger_color; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  auto ts = deviceState.getThermalStatus(); | 
					 | 
					 | 
					 | 
					  auto ts = deviceState.getThermalStatus(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (ts == cereal::DeviceState::ThermalStatus::GREEN) { | 
					 | 
					 | 
					 | 
					  if (ts == cereal::DeviceState::ThermalStatus::GREEN) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    tempStatus = good_color; | 
					 | 
					 | 
					 | 
					    tempColor = good_color; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) { | 
					 | 
					 | 
					 | 
					  } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    tempStatus = warning_color; | 
					 | 
					 | 
					 | 
					    tempColor = warning_color; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  setProperty("tempStatus", tempStatus); | 
					 | 
					 | 
					 | 
					  setProperty("tempStatus", QVariant::fromValue(ItemStatus{QString("%1°C").arg((int)deviceState.getAmbientTempC()), tempColor})); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  setProperty("tempVal", (int)deviceState.getAmbientTempC()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QString pandaStr = "VEHICLE\nONLINE"; | 
					 | 
					 | 
					 | 
					  ItemStatus pandaStatus = {"VEHICLE\nONLINE", good_color}; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QColor pandaStatus = good_color; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (s.scene.pandaType == cereal::PandaState::PandaType::UNKNOWN) { | 
					 | 
					 | 
					 | 
					  if (s.scene.pandaType == cereal::PandaState::PandaType::UNKNOWN) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pandaStatus = danger_color; | 
					 | 
					 | 
					 | 
					    pandaStatus = {"NO\nPANDA", danger_color}; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pandaStr = "NO\nPANDA"; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if (s.scene.started && !sm["liveLocationKalman"].getLiveLocationKalman().getGpsOK()) { | 
					 | 
					 | 
					 | 
					  } else if (s.scene.started && !sm["liveLocationKalman"].getLiveLocationKalman().getGpsOK()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pandaStatus = warning_color; | 
					 | 
					 | 
					 | 
					    pandaStatus = {"GPS\nSEARCHING", warning_color}; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    pandaStr = "GPS\nSEARCHING"; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  setProperty("pandaStr", pandaStr); | 
					 | 
					 | 
					 | 
					  setProperty("pandaStatus", QVariant::fromValue(pandaStatus)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  setProperty("pandaStatus", pandaStatus); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void Sidebar::paintEvent(QPaintEvent *event) { | 
					 | 
					 | 
					 | 
					void Sidebar::paintEvent(QPaintEvent *event) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -125,7 +112,7 @@ void Sidebar::paintEvent(QPaintEvent *event) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  p.drawText(r, Qt::AlignCenter, net_type); | 
					 | 
					 | 
					 | 
					  p.drawText(r, Qt::AlignCenter, net_type); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // metrics
 | 
					 | 
					 | 
					 | 
					  // metrics
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  drawMetric(p, "TEMP", QString("%1°C").arg(temp_val), temp_status, 338); | 
					 | 
					 | 
					 | 
					  drawMetric(p, "TEMP", temp_status.first, temp_status.second, 338); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  drawMetric(p, panda_str, "", panda_status, 518); | 
					 | 
					 | 
					 | 
					  drawMetric(p, panda_status.first, "", panda_status.second, 518); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  drawMetric(p, connect_str, "", connect_status, 676); | 
					 | 
					 | 
					 | 
					  drawMetric(p, connect_status.first, "", connect_status.second, 676); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |