From c022eee3eeb1b9f4d22fc954c01075267cdafd3e Mon Sep 17 00:00:00 2001 From: Stefan Mertl Date: Wed, 31 Jan 2018 16:51:01 +0100 Subject: [PATCH] Added a thread to output the status on the LCD. --- software/c++/ruwaicom/include/root.h | 1 + software/c++/ruwaicom/src/root.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/software/c++/ruwaicom/include/root.h b/software/c++/ruwaicom/include/root.h index 609830e..91b42d9 100644 --- a/software/c++/ruwaicom/include/root.h +++ b/software/c++/ruwaicom/include/root.h @@ -107,6 +107,7 @@ class Root { bool check_arduino_stack(void); pga_gain_t translate_pga_gain(double gain); adc_sps_t translate_adc_sps(uint16_t sps); + void lcd_status(void); }; template diff --git a/software/c++/ruwaicom/src/root.cpp b/software/c++/ruwaicom/src/root.cpp index f7701cf..3fa35e0 100644 --- a/software/c++/ruwaicom/src/root.cpp +++ b/software/c++/ruwaicom/src/root.cpp @@ -479,6 +479,9 @@ Root::run(void) { syslog(LOG_ERR, "[ERROR][root] No confirmation of the record mode configuration."); } + + //std::thread t_lcd_status([&] (Root* this) {this->lcd_status();}, this); + std::thread t_lcd_status(&Root::lcd_status, this); t_read_and_parse.join(); @@ -711,3 +714,19 @@ Root::translate_adc_sps(uint16_t sps) } return ret; } + + +void +Root::lcd_status(void) +{ + char time_string[27]; + timestamp_t last_timestamp; + + while (true) + { + last_timestamp = recorder->get_last_timestamp(); + ms_hptime2isotimestr(last_timestamp.time, time_string, true); + display->print(time_string, ""); + std::this_thread::sleep_for(std::chrono::seconds(5)); + } +} -- 2.11.4.GIT