Skip to content

Commit 17e5011

Browse files
committed
cleanup
1 parent 530fbdc commit 17e5011

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

components/gui/include/graph_window.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class GraphWindow : public Window {
1818
void add_data(const std::string &plot_name, int new_data);
1919
void remove_plot(const std::string &plot_name);
2020

21+
lv_obj_t *get_lv_obj(void) { return wrapper_; }
22+
23+
void invalidate() {
24+
if (wrapper_) {
25+
lv_obj_invalidate(wrapper_);
26+
}
27+
}
28+
2129
protected:
2230
lv_chart_series_t *create_plot(const std::string &plotName);
2331
lv_chart_series_t *get_plot(const std::string &plotName);

components/gui/include/text_window.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ class TextWindow : public Window {
1414
void clear_logs(void);
1515
void add_log(const std::string &log_text);
1616

17+
lv_obj_t *get_lv_obj(void) { return log_container_; }
18+
19+
void invalidate() {
20+
if (log_container_) {
21+
lv_obj_invalidate(log_container_);
22+
}
23+
}
24+
1725
private:
1826
std::string log_text_{""};
1927
lv_obj_t *log_container_{nullptr};

components/gui/src/graph_window.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void GraphWindow::clear_plots(void) {
118118
while (lv_spangroup_get_child(legend_, 0)) {
119119
lv_spangroup_delete_span(legend_, lv_spangroup_get_child(legend_, 0));
120120
}
121+
// invalidate
122+
invalidate();
121123
}
122124

123125
void GraphWindow::add_data(const std::string &plotName, int newData) {

components/gui/src/gui.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,16 @@ std::string Gui::pop_data() {
6060
void Gui::clear_info() {
6161
std::lock_guard<std::recursive_mutex> lk{mutex_};
6262
info_window_.clear_logs();
63-
// refresh the display
64-
lv_obj_invalidate(tabview_);
6563
}
6664

6765
void Gui::clear_plots() {
6866
std::lock_guard<std::recursive_mutex> lk{mutex_};
6967
plot_window_.clear_plots();
70-
// refresh the display
71-
lv_obj_invalidate(tabview_);
7268
}
7369

7470
void Gui::clear_logs() {
7571
std::lock_guard<std::recursive_mutex> lk{mutex_};
7672
log_window_.clear_logs();
77-
// refresh the display
78-
lv_obj_invalidate(tabview_);
7973
}
8074

8175
void Gui::add_info(const std::string &info) {

components/gui/src/text_window.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ void TextWindow::init(lv_obj_t *parent, size_t width, size_t height) {
1414
}
1515

1616
void TextWindow::clear_logs(void) {
17-
// clear all the logs off the page
18-
lv_obj_clean(log_container_);
17+
// set the string to the display
18+
lv_label_set_text(log_container_, "");
1919
// now empty the string
2020
log_text_.clear();
21+
// invalidate
22+
invalidate();
2123
}
2224

2325
void TextWindow::add_log(const std::string &log_text) {

0 commit comments

Comments
 (0)