From ebbdb693afd5b8a7bb8f63058cf8edd78f1a6f98 Mon Sep 17 00:00:00 2001 From: Josh Siegle <jsiegle@users.noreply.github.com> Date: Tue, 23 Sep 2014 18:08:57 -0700 Subject: [PATCH] Change filter cutoff display Display filter cutoffs rounded to the nearest 0.1 Hz, rather than 1 Hz --- Source/Processors/Editors/RHD2000Editor.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp index f5a1da515..1c78e497a 100644 --- a/Source/Processors/Editors/RHD2000Editor.cpp +++ b/Source/Processors/Editors/RHD2000Editor.cpp @@ -23,6 +23,7 @@ #include "RHD2000Editor.h" #include "../../UI/EditorViewport.h" +#include <cmath> #include "ChannelSelector.h" @@ -271,7 +272,7 @@ void BandwidthInterface::labelTextChanged(Label* label) std::cout << "Setting Upper Bandwidth to " << requestedValue << std::endl; std::cout << "Actual Upper Bandwidth: " << actualUpperBandwidth << std::endl; - label->setText(String((roundFloatToInt)(actualUpperBandwidth)), dontSendNotification); + label->setText(String(round(actualUpperBandwidth*10.f)/10.f), dontSendNotification); } else @@ -291,9 +292,10 @@ void BandwidthInterface::labelTextChanged(Label* label) actualLowerBandwidth = board->setLowerBandwidth(requestedValue); - std::cout << "Setting Upper Bandwidth to " << requestedValue << std::endl; - std::cout << "Actual Upper Bandwidth: " << actualLowerBandwidth << std::endl; - label->setText(String(roundFloatToInt(actualLowerBandwidth)), dontSendNotification); + std::cout << "Setting Lower Bandwidth to " << requestedValue << std::endl; + std::cout << "Actual Lower Bandwidth: " << actualLowerBandwidth << std::endl; + + label->setText(String(round(actualLowerBandwidth*10.f)/10.f), dontSendNotification); } } else if (editor->acquisitionIsActive) @@ -311,15 +313,16 @@ void BandwidthInterface::labelTextChanged(Label* label) void BandwidthInterface::setLowerBandwidth(double value) { actualLowerBandwidth = board->setLowerBandwidth(value); - lowerBandwidthSelection->setText(String(roundFloatToInt(actualLowerBandwidth)), dontSendNotification); + lowerBandwidthSelection->setText(String(round(actualLowerBandwidth*10.f)/10.f), dontSendNotification); } void BandwidthInterface::setUpperBandwidth(double value) { actualUpperBandwidth = board->setUpperBandwidth(value); - upperBandwidthSelection->setText(String(roundFloatToInt(actualUpperBandwidth)), dontSendNotification); + upperBandwidthSelection->setText(String(round(actualUpperBandwidth*10.f)/10.f), dontSendNotification); } + double BandwidthInterface::getLowerBandwidth() { return actualLowerBandwidth; -- GitLab