Commit ad900b23 authored by Thomas Edwards's avatar Thomas Edwards
Browse files

Fixed some logic, appears to be a working solution. Still lots of debug prints

parent 523e8f24
......@@ -417,7 +417,8 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Degbugging monitoring info
// --------------------------------------------------------------
std::cerr << "-----------------------------------" << std::endl;
std::cerr << "No. Rec: " << tofilter1.size() << " | ";
std::cerr << "Latest timestamp: " << tofilter1.back()->get_sec() << "." << tofilter1.back()->get_msec() << " | ";
// std::cerr << "No. Rec: " << tofilter1.size() << " | ";
// std::cerr << "Elapsed time: ";
// long long check_time_diff = (((time_block_info.back().start.tv_sec - time_block_info.front().start.tv_sec) * 1e9) + (time_block_info.back().start.tv_nsec - time_block_info.front().start.tv_nsec));
// std::cerr << check_time_diff << " | ";
......@@ -446,9 +447,10 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
int points_to_drop = 0;
// Check if we have (8*(blocks) +/- 1) data in the filter que
time_block_check = 8*(total_blocks);
std::cerr << "Filter blocks and data check: " << tofilter1.size() << " " << time_block_check << std::endl;
while (((tofilter1.size() < (time_block_check + 1)) || (tofilter1.size() > (time_block_check - 1))) && (check_filters >= 1)) {
std::cerr << "Run the filter! " << std::endl;
bool run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1);
std::cerr << "Data in que: " << tofilter1.size() << " | blocks*8: " << time_block_check << " | Run the filter?: " << run_the_filter << std::endl;
while (run_the_filter) {
// std::cerr << "Run the filter! " << std::endl;
// Try to just run as normal
try {
filter1_win = &filter1_wins.at(tofilter1.size());
......@@ -459,7 +461,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Use the time_block_check information to assume if we are over or under
// this is just the +/- part, so we can expand or reduce the filter to match
int filter_jitter = time_block_check - tofilter1.size();
std::cerr << "Filter Jitter: " << filter_jitter << std::endl;
std::cerr << "OOR err, Filter Jitter: " << filter_jitter << std::endl;
// // DEBUG: Test the vector copy constructor
// std::vector <data_obs*> test_vec;
......@@ -488,6 +490,8 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
time_block_check = 8*(total_blocks);
check_filters = total_blocks/16;
std::cerr << "Filter blocks and data check (after filter): " << tofilter1.size() << " " << time_block_check << std::endl;
run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1);
// // Drop the oldest block information
// time_block_info.erase(time_block_info.begin());
// filter1_blocks_info.erase(filter1_blocks_info.begin());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment