mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-10-01 03:43:42 +08:00
user event flagging (#25517)
* setup home_btn in sidebar * create UserFlag msg * replay: show and skip to user flags * update translations * bump to cereal master * remove comment Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ const std::initializer_list<std::pair<std::string, std::string>> keyboard_shortc
|
||||
{"space", "Pause/Resume"},
|
||||
{"e", "Next Engagement"},
|
||||
{"d", "Next Disengagement"},
|
||||
{"t", "Next User Tag"}
|
||||
},
|
||||
{
|
||||
{"enter", "Enter seek request"},
|
||||
@@ -32,6 +33,7 @@ enum Color {
|
||||
Yellow,
|
||||
Green,
|
||||
Red,
|
||||
Cyan,
|
||||
BrightWhite,
|
||||
Engaged,
|
||||
Disengaged,
|
||||
@@ -70,6 +72,7 @@ ConsoleUI::ConsoleUI(Replay *replay, QObject *parent) : replay(replay), sm({"car
|
||||
init_pair(Color::Debug, 246, COLOR_BLACK); // #949494
|
||||
init_pair(Color::Yellow, 184, COLOR_BLACK);
|
||||
init_pair(Color::Red, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(Color::Cyan, COLOR_CYAN, COLOR_BLACK);
|
||||
init_pair(Color::BrightWhite, 15, COLOR_BLACK);
|
||||
init_pair(Color::Disengaged, COLOR_BLUE, COLOR_BLUE);
|
||||
init_pair(Color::Engaged, 28, 28);
|
||||
@@ -205,6 +208,7 @@ void ConsoleUI::displayTimelineDesc() {
|
||||
{Color::Green, " Info ", true},
|
||||
{Color::Yellow, " Warning ", true},
|
||||
{Color::Red, " Critical ", true},
|
||||
{Color::Cyan, " User Tag ", true},
|
||||
};
|
||||
for (auto [color, name, bold] : indicators) {
|
||||
add_str(w[Win::TimelineDesc], "__", color, bold);
|
||||
@@ -263,6 +267,8 @@ void ConsoleUI::updateTimeline() {
|
||||
if (type == TimelineType::Engaged) {
|
||||
mvwchgat(win, 1, start_pos, end_pos - start_pos + 1, A_COLOR, Color::Engaged, NULL);
|
||||
mvwchgat(win, 2, start_pos, end_pos - start_pos + 1, A_COLOR, Color::Engaged, NULL);
|
||||
} else if (type == TimelineType::UserFlag) {
|
||||
mvwchgat(win, 3, start_pos, end_pos - start_pos + 1, ACS_S3, Color::Cyan, NULL);
|
||||
} else {
|
||||
auto color_id = Color::Green;
|
||||
if (type != TimelineType::AlertInfo) {
|
||||
@@ -336,6 +342,8 @@ void ConsoleUI::handleKey(char c) {
|
||||
replay->seekToFlag(FindFlag::nextEngagement);
|
||||
} else if (c == 'd') {
|
||||
replay->seekToFlag(FindFlag::nextDisEngagement);
|
||||
} else if (c == 't') {
|
||||
replay->seekToFlag(FindFlag::nextUserFlag);
|
||||
} else if (c == 'm') {
|
||||
replay->seekTo(+60, true);
|
||||
} else if (c == 'M') {
|
||||
|
||||
@@ -149,6 +149,9 @@ void Replay::buildTimeline() {
|
||||
timeline.push_back({toSeconds(alert_begin), toSeconds(e->mono_time), alert_type});
|
||||
alert_begin = 0;
|
||||
}
|
||||
} else if (e->which == cereal::Event::Which::USER_FLAG) {
|
||||
std::lock_guard lk(timeline_lock);
|
||||
timeline.push_back({toSeconds(e->mono_time), toSeconds(e->mono_time), TimelineType::UserFlag});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,6 +166,10 @@ std::optional<uint64_t> Replay::find(FindFlag flag) {
|
||||
} else if (flag == FindFlag::nextDisEngagement && end_ts > cur_ts) {
|
||||
return end_ts;
|
||||
}
|
||||
} else if (type == TimelineType::UserFlag) {
|
||||
if (flag == FindFlag::nextUserFlag && start_ts > cur_ts) {
|
||||
return start_ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
@@ -360,7 +367,7 @@ void Replay::stream() {
|
||||
setCurrentSegment(toSeconds(cur_mono_time_) / 60);
|
||||
|
||||
// migration for pandaState -> pandaStates to keep UI working for old segments
|
||||
if (cur_which == cereal::Event::Which::PANDA_STATE_D_E_P_R_E_C_A_T_E_D &&
|
||||
if (cur_which == cereal::Event::Which::PANDA_STATE_D_E_P_R_E_C_A_T_E_D &&
|
||||
sockets_[cereal::Event::Which::PANDA_STATES] != nullptr) {
|
||||
MessageBuilder msg;
|
||||
auto ps = msg.initEvent().initPandaStates(1);
|
||||
|
||||
@@ -24,10 +24,11 @@ enum REPLAY_FLAGS {
|
||||
|
||||
enum class FindFlag {
|
||||
nextEngagement,
|
||||
nextDisEngagement
|
||||
nextDisEngagement,
|
||||
nextUserFlag,
|
||||
};
|
||||
|
||||
enum class TimelineType { None, Engaged, AlertInfo, AlertWarning, AlertCritical };
|
||||
enum class TimelineType { None, Engaged, AlertInfo, AlertWarning, AlertCritical, UserFlag };
|
||||
|
||||
class Replay : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Reference in New Issue
Block a user