mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-05 16:25:41 +08:00
display IP
This commit is contained in:
@@ -217,6 +217,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"dp_nav_full_screen", PERSISTENT},
|
||||
{"dp_alka", PERSISTENT},
|
||||
{"dp_device_reset_conf", CLEAR_ON_MANAGER_START},
|
||||
{"dp_device_ip_addr", PERSISTENT},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -106,6 +106,11 @@ void Sidebar::updateState(const UIState &s) {
|
||||
pandaStatus = {{tr("GPS"), tr("SEARCH")}, warning_color};
|
||||
}
|
||||
setProperty("pandaStatus", QVariant::fromValue(pandaStatus));
|
||||
// rick - update every 5 secs
|
||||
if (sm.frame % UI_FREQ*5 == 0) {
|
||||
QString ip_addr = QString::fromStdString(Params().get("dp_device_ip_addr"));
|
||||
setProperty("ipAddr", ip_addr);
|
||||
}
|
||||
}
|
||||
|
||||
void Sidebar::paintEvent(QPaintEvent *event) {
|
||||
@@ -136,6 +141,12 @@ void Sidebar::paintEvent(QPaintEvent *event) {
|
||||
const QRect r = QRect(50, 247, 100, 50);
|
||||
p.drawText(r, Qt::AlignCenter, net_type);
|
||||
|
||||
// IP
|
||||
p.setFont(InterFont(30));
|
||||
p.setPen(QColor(0xff, 0xff, 0xff));
|
||||
const QRect ip = QRect(40, 260, 230, 100);
|
||||
p.drawText(ip, Qt::AlignCenter, ipAddr);
|
||||
|
||||
// metrics
|
||||
drawMetric(p, temp_status.first, temp_status.second, 338);
|
||||
drawMetric(p, panda_status.first, panda_status.second, 496);
|
||||
|
||||
@@ -17,6 +17,7 @@ class Sidebar : public QFrame {
|
||||
Q_PROPERTY(ItemStatus tempStatus MEMBER temp_status NOTIFY valueChanged);
|
||||
Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged);
|
||||
Q_PROPERTY(int netStrength MEMBER net_strength NOTIFY valueChanged);
|
||||
Q_PROPERTY(QString ipAddr MEMBER ipAddr NOTIFY valueChanged);
|
||||
|
||||
public:
|
||||
explicit Sidebar(QWidget* parent = 0);
|
||||
|
||||
@@ -25,6 +25,8 @@ from openpilot.system.hardware.power_monitoring import PowerMonitoring
|
||||
from openpilot.system.hardware.fan_controller import TiciFanController
|
||||
from openpilot.system.version import terms_version, training_version
|
||||
|
||||
from openpilot.dp_ext.utils import get_ip_addr
|
||||
|
||||
ThermalStatus = log.DeviceState.ThermalStatus
|
||||
NetworkType = log.DeviceState.NetworkType
|
||||
NetworkStrength = log.DeviceState.NetworkStrength
|
||||
@@ -442,6 +444,12 @@ def hardware_thread(end_event, hw_queue) -> None:
|
||||
|
||||
params.put_bool_nonblocking("NetworkMetered", msg.deviceState.networkMetered)
|
||||
|
||||
# rick - update IP every 10s
|
||||
if count % int(10. / DT_HW) == 0:
|
||||
ip = get_ip_addr()
|
||||
ip = '' if ip is None else ip
|
||||
params.put('dp_device_ip_addr', ip)
|
||||
|
||||
count += 1
|
||||
should_start_prev = should_start
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ def manager_init() -> None:
|
||||
("dp_long_personality_btn", "0"),
|
||||
("dp_nav_full_screen", "0"),
|
||||
("dp_alka", "0"),
|
||||
("dp_device_ip_addr", ""),
|
||||
]
|
||||
if not PC:
|
||||
default_params.append(("LastUpdateTime", datetime.datetime.now(datetime.UTC).replace(tzinfo=None).isoformat().encode('utf8')))
|
||||
|
||||
Reference in New Issue
Block a user