Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwbobo2021 authored Sep 24, 2022
1 parent d49b63f commit 125df34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ MemberFuncPtr<typename T, float (T::*F)()>(T* pobj)
1. On Windows, segmentation fault will be produced when the thread created by `Frontend` exits. Use `Frontend::run()` instead of `Frontend::open()` (which creates a new thread for `Gtk::Application::run()`) on Windows, especially if you need to do necessary things after the window is closed by the user.
2. The record process can be interrupted by the environment, this causes missing of data and unsmooth curves on the graph. It works very well on XFCE, and is acceptable on GNOME and KDE, but the unsmooth effect can be significant on Windows that the delay can sometimes exceed 20 ms.
3. Limited by software timer accuracy, it is IMPOSSIBLE for `Recorder` to keep its data sampling frequency higher than 10 kHz (0.1 ms interval). The higher the frequency, the lower the stability.
4. `Recorder` is not capable of loading a block of data at once. In this case, it can still be used to show data: do not call `Recorder::start()`, but load data into each buffer manually, then call `Recorder::set_axis_x_range()` to refresh the graph. In case of the amount of data in the buffers are not equal, that of the buffer for the first variable makes sense. To avoid writing invalid non-zero data into the CSV file, call `CircularBuffer::erase()` for each buffer after calling `Recorder::clear()`.
5. It has not been migrated to `gtkmm-4.0`, partly because the repository of newest distributions of Debian and Ubuntu has not provided this version of the library.
4. `Recorder` is not capable of loading a block of data at once. In this case, it can still be used to show data: do not call `Recorder::start()`, but load data into each buffer manually, then call `Recorder::refresh_view()` to refresh the graph. In case of the amount of data in the buffers are not equal, that of the buffer for the first variable makes sense. To avoid writing invalid non-zero data into the CSV file, call `CircularBuffer::erase()` for each buffer after calling `Recorder::clear()`.
5. It has not been migrated to `gtkmm-4.0`, partly because newest distributions of Debian and Ubuntu has not provided this version of the library.
2 changes: 1 addition & 1 deletion recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void Recorder::refresh_loop()
if (this->redraw_interval > 200) check_time_interval = 200;
check_time_interval *= 1000; //us

this->set_axis_x_range();
this->refresh_view();
steady_clock::time_point t_last_refresh = steady_clock::now();

while (this->flag_recording) {
Expand Down
9 changes: 9 additions & 0 deletions recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ class Recorder: public Gtk::Box
bool open_csv(const std::string& file_path); //note: comments will not be loaded
bool save_csv(const std::string& file_path, const std::string& str_comment = Empty_Comment); //note: comment is unstandard

void refresh_view(); //call this function if data has been loaded into the buffers manually

bool set_interval(float new_interval); //interval of reading current values (ms). it sets index unit (multipier) to interval (s)
bool set_redraw_interval(unsigned int new_redraw_interval); //set manually if a slower redraw rate is required to reduce CPU usage

Expand Down Expand Up @@ -216,6 +218,8 @@ class Recorder: public Gtk::Box
void set_option_anti_alias(bool set); //font of x-axis, y-axis values are not influenced. default: false
};

using RecordView = Recorder;

inline bool Recorder::is_recording() const
{
return this->flag_recording;
Expand Down Expand Up @@ -304,6 +308,11 @@ inline AxisRange Recorder::axis_y_range(unsigned int index) const
return this->areas[index].get_range_y();
}

inline void Recorder::refresh_view()
{
this->set_axis_x_range();
}

inline bool Recorder::set_axis_x_range(unsigned int range_width)
{
AxisRange range(0, range_width);
Expand Down

0 comments on commit 125df34

Please sign in to comment.