From 50a8bbcdd6327a1b278a4d9310a949cebb2437db Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Fri, 21 Apr 2023 18:10:12 -0400 Subject: [PATCH] added ComboList at Register, added more methods in digitizer class. improving Scope --- ClassDigitizer.h | 23 +++ RegisterAddress.h | 354 +++++++++++++++++++++++++--------------------- Scope.cpp | 224 +++++++++++++++++++++++++---- Scope.h | 18 ++- 4 files changed, 426 insertions(+), 193 deletions(-) diff --git a/ClassDigitizer.h b/ClassDigitizer.h index 65c4e22..a07cb34 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -159,7 +159,30 @@ class Digitizer{ unsigned short DigiProbe1Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 20) & 0xF );} unsigned short DigiProbe2Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 26) & 0x7 );} + //====== DPP Algorithm Contol breakdown + unsigned short TrapReScaling(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 0) & 0x1F );} + unsigned short TraceDecimation(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 8) & 0x3 );} + unsigned short TraceDecimationGain(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 10) & 0x3 );} + unsigned short PeakMean(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 12) & 0x3 );} + unsigned short Polarity(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 16) & 0x1 );} + unsigned short TriggerMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x3 );} + unsigned short BaseLineAvg(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x7 );} + unsigned short DisableSelfTrigger(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 24) & 0x1 );} + unsigned short EnableRollOverFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 26) & 0x1 );} + unsigned short EnablePileUpFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 27) & 0x1 );} + //====== DPP Algorithm Contol 2 breakdown + unsigned short LocalShapeMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 0) & 0x7 );} + unsigned short LocalTrigValidMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 4) & 0x7 );} + unsigned short Extra2Option(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 8) & 0x3 );} + unsigned short VetoSource(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 14) & 0x3 );} + unsigned short TrigCounter(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 16) & 0x3 );} + unsigned short ActiveBaseLineCal(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 18) & 0x1 );} + unsigned short TagCorrelatedEvents(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 19) & 0x1 );} + unsigned short OptimizeBaseLineRestorer(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 29) & 0x1 );} + + //====== Acquistion Control vreakdown + }; diff --git a/RegisterAddress.h b/RegisterAddress.h index ffff3a5..67c5185 100644 --- a/RegisterAddress.h +++ b/RegisterAddress.h @@ -32,6 +32,7 @@ class Reg{ group = 0; maxValue = 0; partialStep = 0; + comboList.clear(); } Reg(std::string name, uint32_t address, RW type = RW::ReadWrite, bool group = false, unsigned int max = 0, int pStep = 0){ this->name = name; @@ -40,8 +41,19 @@ class Reg{ this->group = group; this->maxValue = max; this->partialStep = pStep; + comboList.clear(); }; + Reg(std::string name, uint32_t address, RW type = RW::ReadWrite, bool group = false, std::vector> list = {}){ + this->name = name; + this->address = address; + this->type = type; + this->group = group; + this->maxValue = 0; + this->partialStep = 0; + this->comboList = list; + } + ~Reg(){}; operator uint32_t () const {return this->address;} /// this allows Reg kaka("kaka", 0x1234) uint32_t haha = kaka; @@ -55,6 +67,8 @@ class Reg{ int GetPartialStep() const {return partialStep;} /// step = partialStep * ch2ns, -1 : step = 1 void Print() const ; + std::vector> GetComboList() const {return comboList;} + uint32_t ActualAddress(int ch = -1){ if( address == 0x8180 ) return (ch < 0 ? address : (address + 4*(ch/2))); if( address < 0x8000 ) return (ch < 0 ? (address + 0x7000) : (address + (ch << 8)) ); @@ -75,7 +89,7 @@ class Reg{ bool group; unsigned int maxValue ; int partialStep; - + std::vector> comboList; }; inline void Reg::Print() const{ @@ -125,181 +139,201 @@ inline uint32_t Reg::CalAddress(unsigned int index){ } - - const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, RW::ReadONLY); /// R + const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, RW::ReadONLY, false, {}); /// R ///========== Channel or Group - const Reg ChannelDummy32 ("ChannelDummy32" , 0x1024); /// R/W - const Reg InputDynamicRange ("InputDynamicRange" , 0x1028); /// R/W - const Reg ChannelPulseWidth ("ChannelPulseWidth" , 0x1070); /// R/W - const Reg ChannelTriggerThreshold ("ChannelTriggerThreshold" , 0x1080); /// R/W - const Reg CoupleSelfTriggerLogic_G ("CoupleSelfTriggerLogic_G" , 0x1084, RW::ReadWrite , 1); /// R/W - const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY); /// R - const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY); /// R - const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098); /// R/W - const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY); /// R - const Reg ChannelSelfTriggerRateMeter_R ("ChannelSelfTriggerRateMeter_R", 0x10EC, RW::ReadONLY); /// R + const Reg ChannelDummy32 ("ChannelDummy32" , 0x1024, RW::ReadWrite, false, {}); /// R/W + const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelPulseWidth ("ChannelPulseWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelTriggerThreshold ("ChannelTriggerThreshold" , 0x1080, RW::ReadWrite, false, {}); /// R/W + const Reg CoupleSelfTriggerLogic_G ("CoupleSelfTriggerLogic_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W + const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY, false, {}); /// R + const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY, false, {}); /// R + const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY, false, {}); /// R + const Reg ChannelSelfTriggerRateMeter_R ("ChannelSelfTriggerRateMeter_R", 0x10EC, RW::ReadONLY, false, {}); /// R ///========== Board - const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite); /// R/W - const Reg BufferOrganization ("BufferOrganization" , 0x800C, RW::ReadWrite); /// R/W - const Reg CustomSize ("CustomSize" , 0x8020, RW::ReadWrite); /// R/W - const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY); /// W - const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite); /// R/W - const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY); /// R - const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY); /// W - const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite); /// R/W - const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite); /// R/W - const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite); /// R/W - const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite); /// R/W - const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite); /// R/W - const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite); /// R/W - const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY); /// R - const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY); /// R - const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite); /// R/W - const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY); /// W - const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY); /// R - const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite); /// R/W - const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY); /// R - const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite); /// R/W - const Reg MemoryBufferAlmostFullLevel ("MemoryBufferAlmostFullLevel" , 0x816C, RW::ReadWrite); /// R/W - const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite); /// R/W - const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY); /// R - const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite); /// R/W - const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite); /// R/W - const Reg ChannelsShutdown_W ("ChannelsShutdown_W" , 0x81C0, RW::WriteONLY); /// W - const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite); /// R/W - const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite); /// R/W - const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY); /// R - const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite); /// R/W - const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite); /// R/W - const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite); /// R/W - const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite); /// R/W - const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite); /// R/W - const Reg MaxAggregatePerBlockTransfer ("MaxAggregatePerBlockTransfer" , 0xEF1C, RW::ReadWrite); /// R/W - const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite); /// R/W - const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY); /// W - const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY); /// W + const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W + const Reg BufferOrganization ("BufferOrganization" , 0x800C, RW::ReadWrite, false, {}); /// R/W + const Reg CustomSize ("CustomSize" , 0x8020, RW::ReadWrite, false, {}); /// R/W + const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W + const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W + const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R + const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W + const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W + const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite, false, {}); /// R/W + const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W + const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R + const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R + const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W + const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R + const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {}); /// R/W + const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R + const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W + const Reg MemoryBufferAlmostFullLevel ("MemoryBufferAlmostFullLevel" , 0x816C, RW::ReadWrite, false, {}); /// R/W + const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, {}); /// R/W + const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R + const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W + const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelsShutdown_W ("ChannelsShutdown_W" , 0x81C0, RW::WriteONLY, false, {}); /// W + const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, {}); /// R/W + const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W + const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R + const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W + const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W + const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W + const Reg MaxAggregatePerBlockTransfer ("MaxAggregatePerBlockTransfer" , 0xEF1C, RW::ReadWrite, false, {}); /// R/W + const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W + const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W ///====== Common for PHA and PSD namespace DPP { - const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, 1, 0x3FFF, 8); /// R/W - const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, 0, 1, -1); /// R/W - const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, 1, 0x3FF, -1); /// R/W - const Reg PreTrigger ("PreTrigger" , 0x1038, RW::ReadWrite, 0, 0xFF, 4); /// R/W - const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, 0, 0x3FFF, -1); /// R/W - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, 0, 0x3FF, 4); /// R/W - const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1080, RW::ReadWrite); /// R/W - const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY); /// R - const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY); /// R - const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, 0, 0xFFFF, -1); /// R/W - const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY); /// R - const Reg IndividualSoftwareTrigger_W ("IndividualSoftwareTrigger_W" , 0x10C0, RW::WriteONLY); /// W - const Reg VetoWidth ("VetoWidth" , 0x10D4, RW::ReadWrite); /// R/W + const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, true, 0x3FFF, 8); /// R/W + const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {{"2 Vpp", 0},{"0.5 Vpp", 1}}); /// R/W + const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, true, 0x3FF, -1); /// R/W + const Reg PreTrigger ("PreTrigger" , 0x1038, RW::ReadWrite, false, 0xFF, 4); /// R/W + const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W + const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1080, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY , false, {}); /// R + const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY , false, {}); /// R + const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, 0xFFFF, -1); /// R/W + const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY , false, {}); /// R + const Reg IndividualSoftwareTrigger_W ("IndividualSoftwareTrigger_W" , 0x10C0, RW::WriteONLY, false, {}); /// W + const Reg VetoWidth ("VetoWidth" , 0x10D4, RW::ReadWrite, false, {}); /// R/W /// I know there are many duplication, it is the design. - const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite ); /// R/W - const Reg AggregateOrganization ("AggregateOrganization" , 0x800C, RW::ReadWrite ); /// R/W - const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY ); /// W - const Reg ChannelShutdown_W ("ChannelShutdown_W" , 0x80BC, RW::WriteONLY ); /// W - const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite ); /// R/W - const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY ); /// R - const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY ); /// W - const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite ); /// R/W - const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite ); /// R/W - const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite ); /// R/W - const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite ); /// R/W - const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite ); /// R/W - const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY ); /// R - const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY ); /// R - const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite ); /// R/W - const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY ); /// W - const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY ); /// R - const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite ); /// R/W - const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY ); /// R - const Reg TimeBombDowncounter_R ("TimeBombDowncounter_R" , 0x8158, RW::ReadONLY ); /// R - const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite ); /// R/W - const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite ); /// R/W - const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY ); /// R - const Reg DisableExternalTrigger ("DisableExternalTrigger" , 0x817C, RW::ReadWrite ); /// R/W - const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite ); /// R/W - const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite ); /// R/W - const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite ); /// R/W - const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite ); /// R/W - const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY ); /// R - const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite ); /// R/W - const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite ); /// R/W - const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite ); /// R/W - const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite ); /// R/W - const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite ); /// R/W - const Reg MaxAggregatePerBlockTransfer("MaxAggregatePerBlockTransfer", 0xEF1C, RW::ReadWrite, 0, 0x3FF, -1); /// R/W - const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite ); /// R/W - const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY ); /// W - const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY ); /// W - const Reg ConfigurationReload_W ("ConfigurationReload_W" , 0xEF34, RW::WriteONLY ); /// W - const Reg ROMChecksum_R ("ROMChecksum_R" , 0xF000, RW::ReadONLY ); /// R - const Reg ROMChecksumByte2_R ("ROMChecksumByte2_R" , 0xF004, RW::ReadONLY ); /// R - const Reg ROMChecksumByte1_R ("ROMChecksumByte1_R" , 0xF008, RW::ReadONLY ); /// R - const Reg ROMChecksumByte0_R ("ROMChecksumByte0_R" , 0xF00C, RW::ReadONLY ); /// R - const Reg ROMConstantByte2_R ("ROMConstantByte2_R" , 0xF010, RW::ReadONLY ); /// R - const Reg ROMConstantByte1_R ("ROMConstantByte1_R" , 0xF014, RW::ReadONLY ); /// R - const Reg ROMConstantByte0_R ("ROMConstantByte0_R" , 0xF018, RW::ReadONLY ); /// R - const Reg ROM_C_Code_R ("ROM_C_Code_R" , 0xF01C, RW::ReadONLY ); /// R - const Reg ROM_R_Code_R ("ROM_R_Code_R" , 0xF020, RW::ReadONLY ); /// R - const Reg ROM_IEEE_OUI_Byte2_R ("ROM_IEEE_OUI_Byte2_R" , 0xF024, RW::ReadONLY ); /// R - const Reg ROM_IEEE_OUI_Byte1_R ("ROM_IEEE_OUI_Byte1_R" , 0xF028, RW::ReadONLY ); /// R - const Reg ROM_IEEE_OUI_Byte0_R ("ROM_IEEE_OUI_Byte0_R" , 0xF02C, RW::ReadONLY ); /// R - const Reg ROM_BoardVersion_R ("ROM_BoardVersion_R" , 0xF030, RW::ReadONLY ); /// R - const Reg ROM_BoardFromFactor_R ("ROM_BoardFromFactor_R" , 0xF034, RW::ReadONLY ); /// R - const Reg ROM_BoardIDByte1_R ("ROM_BoardIDByte1_R" , 0xF038, RW::ReadONLY ); /// R - const Reg ROM_BoardIDByte0_R ("ROM_BoardIDByte0_R" , 0xF03C, RW::ReadONLY ); /// R - const Reg ROM_PCB_rev_Byte3_R ("ROM_PCB_rev_Byte3_R" , 0xF040, RW::ReadONLY ); /// R - const Reg ROM_PCB_rev_Byte2_R ("ROM_PCB_rev_Byte2_R" , 0xF044, RW::ReadONLY ); /// R - const Reg ROM_PCB_rev_Byte1_R ("ROM_PCB_rev_Byte1_R" , 0xF048, RW::ReadONLY ); /// R - const Reg ROM_PCB_rev_Byte0_R ("ROM_PCB_rev_Byte0_R" , 0xF04C, RW::ReadONLY ); /// R - const Reg ROM_FlashType_R ("ROM_FlashType_R" , 0xF050, RW::ReadONLY ); /// R - const Reg ROM_BoardSerialNumByte1_R ("ROM_BoardSerialNumByte1_R" , 0xF080, RW::ReadONLY ); /// R - const Reg ROM_BoardSerialNumByte0_R ("ROM_BoardSerialNumByte0_R" , 0xF084, RW::ReadONLY ); /// R - const Reg ROM_VCXO_Type_R ("ROM_VCXO_Type_R" , 0xF088, RW::ReadONLY ); /// R - - const Reg TriggerValidationMask_G ("TriggerValidationMask_G" , 0x8180, RW::ReadWrite , 1); /// R/W, + const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W + const Reg AggregateOrganization ("AggregateOrganization" , 0x800C, RW::ReadWrite, false, {{"Not use", 0x0}, + {"Not use", 0x1}, + { "4", 0x2}, + { "8", 0x3}, + { "16", 0x4}, + { "32", 0x5}, + { "64", 0x6}, + { "128", 0x7}, + { "256", 0x8}, + { "512", 0x9}, + {"1024", 0xA}}); /// R/W + const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W + const Reg ChannelShutdown_W ("ChannelShutdown_W" , 0x80BC, RW::WriteONLY, false, {{"no shutdown", 0},{"shutdown", 1}}); /// W + const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W + const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R + const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W + const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W + const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W + const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R + const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R + const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W + const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R + const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {{"Trig. Maj. Mode", 0}, + {"Test mode", 1}, + {"Buffer occp. Mode", 3}, + {"Voltage Lvl Mode", 4}}); /// R/W + const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R + const Reg TimeBombDowncounter_R ("TimeBombDowncounter_R" , 0x8158, RW::ReadONLY , false, {}); /// R + const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W + const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, {}); /// R/W + const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R + const Reg DisableExternalTrigger ("DisableExternalTrigger" , 0x817C, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W + const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, {}); /// R/W + const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, {}); /// R/W + const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W + const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R + const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W + const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W + const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W + const Reg MaxAggregatePerBlockTransfer("MaxAggregatePerBlockTransfer", 0xEF1C, RW::ReadWrite, false, 0x3FF, -1); /// R/W + const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W + const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W + const Reg ConfigurationReload_W ("ConfigurationReload_W" , 0xEF34, RW::WriteONLY, false, {}); /// W + const Reg ROMChecksum_R ("ROMChecksum_R" , 0xF000, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte2_R ("ROMChecksumByte2_R" , 0xF004, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte1_R ("ROMChecksumByte1_R" , 0xF008, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte0_R ("ROMChecksumByte0_R" , 0xF00C, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte2_R ("ROMConstantByte2_R" , 0xF010, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte1_R ("ROMConstantByte1_R" , 0xF014, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte0_R ("ROMConstantByte0_R" , 0xF018, RW::ReadONLY , false, {}); /// R + const Reg ROM_C_Code_R ("ROM_C_Code_R" , 0xF01C, RW::ReadONLY , false, {}); /// R + const Reg ROM_R_Code_R ("ROM_R_Code_R" , 0xF020, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte2_R ("ROM_IEEE_OUI_Byte2_R" , 0xF024, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte1_R ("ROM_IEEE_OUI_Byte1_R" , 0xF028, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte0_R ("ROM_IEEE_OUI_Byte0_R" , 0xF02C, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardVersion_R ("ROM_BoardVersion_R" , 0xF030, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardFromFactor_R ("ROM_BoardFromFactor_R" , 0xF034, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardIDByte1_R ("ROM_BoardIDByte1_R" , 0xF038, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardIDByte0_R ("ROM_BoardIDByte0_R" , 0xF03C, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte3_R ("ROM_PCB_rev_Byte3_R" , 0xF040, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte2_R ("ROM_PCB_rev_Byte2_R" , 0xF044, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte1_R ("ROM_PCB_rev_Byte1_R" , 0xF048, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte0_R ("ROM_PCB_rev_Byte0_R" , 0xF04C, RW::ReadONLY , false, {}); /// R + const Reg ROM_FlashType_R ("ROM_FlashType_R" , 0xF050, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardSerialNumByte1_R ("ROM_BoardSerialNumByte1_R" , 0xF080, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardSerialNumByte0_R ("ROM_BoardSerialNumByte0_R" , 0xF084, RW::ReadONLY , false, {}); /// R + const Reg ROM_VCXO_Type_R ("ROM_VCXO_Type_R" , 0xF088, RW::ReadONLY , false, {}); /// R + + const Reg TriggerValidationMask_G ("TriggerValidationMask_G" , 0x8180, RW::ReadWrite, true, {}); /// R/W, namespace PHA { - const Reg DataFlush_W ("DataFlush_W" , 0x103C, RW::WriteONLY); /// W not sure - const Reg ChannelStopAcquisition ("ChannelStopAcquisition" , 0x1040, RW::ReadWrite); /// R/W not sure - const Reg RCCR2SmoothingFactor ("RCCR2SmoothingFactor" , 0x1054, RW::ReadWrite); /// R/W Trigger Filter smoothing, triggerSmoothingFactor - const Reg InputRiseTime ("InputRiseTime" , 0x1058, RW::ReadWrite, 0, 0xFF, 4); /// R/W OK - const Reg TrapezoidRiseTime ("TrapezoidRiseTime" , 0x105C, RW::ReadWrite, 0, 0xFFF, 4); /// R/W OK - const Reg TrapezoidFlatTop ("TrapezoidFlatTop" , 0x1060, RW::ReadWrite, 0, 0xFFF, 4); /// R/W OK - const Reg PeakingTime ("PeakingTime" , 0x1064, RW::ReadWrite, 0, 0xFFF, 4); /// R/W OK - const Reg DecayTime ("DecayTime" , 0x1068, RW::ReadWrite, 0, 0xFFFF, 4); /// R/W OK - const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, 0, 0x3FFF, -1); /// R/W OK - const Reg RiseTimeValidationWindow ("RiseTimeValidationWindow" , 0x1070, RW::ReadWrite, 0, 0x3FF, 1); /// R/W OK - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, 0, 0x3FF, 4); /// R/W OK - const Reg PeakHoldOff ("PeakHoldOff" , 0x1078, RW::ReadWrite, 0, 0x3FF, 4); /// R/W OK - const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1084, RW::ReadWrite, 0, 0x3FF, 4); /// R/W not sure - const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x10A0, RW::ReadWrite, 1); /// R/W OK - const Reg FineGain ("FineGain" , 0x10C4); /// R/W OK + const Reg DataFlush_W ("DataFlush_W" , 0x103C, RW::WriteONLY, false, {}); /// W not sure + const Reg ChannelStopAcquisition ("ChannelStopAcquisition" , 0x1040, RW::ReadWrite, false, {{"Run", 0}, {"Stop", 1}}); /// R/W not sure + const Reg RCCR2SmoothingFactor ("RCCR2SmoothingFactor" , 0x1054, RW::ReadWrite, false, {{ "Disabled", 0x0}, + { "2 sample", 0x1}, + { "4 sample", 0x2}, + { "8 sample", 0x4}, + { "16 sample", 0x8}, + { "32 sample", 0x10}, + { "64 sample", 0x20}, + {"128 sample", 0x3F} + }); /// R/W Trigger Filter smoothing, triggerSmoothingFactor + const Reg InputRiseTime ("InputRiseTime" , 0x1058, RW::ReadWrite, false, 0xFF, 4); /// R/W OK + const Reg TrapezoidRiseTime ("TrapezoidRiseTime" , 0x105C, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg TrapezoidFlatTop ("TrapezoidFlatTop" , 0x1060, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg PeakingTime ("PeakingTime" , 0x1064, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg DecayTime ("DecayTime" , 0x1068, RW::ReadWrite, false, 0xFFFF, 4); /// R/W OK + const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W OK + const Reg RiseTimeValidationWindow ("RiseTimeValidationWindow" , 0x1070, RW::ReadWrite, false, 0x3FF, 1); /// R/W OK + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK + const Reg PeakHoldOff ("PeakHoldOff" , 0x1078, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK + const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1084, RW::ReadWrite, false, 0x3FF, 4); /// R/W not sure + const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x10A0, RW::ReadWrite, true, {}); /// R/W OK + const Reg FineGain ("FineGain" , 0x10C4, RW::ReadWrite, false, {}); /// R/W OK } namespace PSD { - const Reg CFDSetting ("CFDSetting" , 0x103C); /// R/W - const Reg ForcedDataFlush_W ("ForcedDataFlush_W" , 0x1040, RW::WriteONLY); /// W - const Reg ChargeZeroSuppressionThreshold ("ChargeZeroSuppressionThreshold" , 0x1044); /// R/W - const Reg ShortGateWidth ("ShortGateWidth" , 0x1054); /// R/W - const Reg LongGateWidth ("LongGateWidth" , 0x1058); /// R/W - const Reg GateOffset ("GateOffset" , 0x105C); /// R/W - const Reg TriggerThreshold ("TriggerThreshold" , 0x1060); /// R/W - const Reg FixedBaseline ("FixedBaseline" , 0x1064); /// R/W - const Reg TriggerLatency ("TriggerLatency" , 0x106C); /// R/W - const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1070); /// R/W - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074); /// R/W - const Reg ThresholdForPSDCut ("ThresholdForPSDCut" , 0x1078); /// R/W - const Reg PurGapThreshold ("PurGapThreshold" , 0x107C); /// R/W - const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, 1); /// R/W - const Reg EarlyBaselineFreeze ("EarlyBaselineFreeze" , 0x10D8); /// R/W + const Reg CFDSetting ("CFDSetting" , 0x103C, RW::ReadWrite, false, {}); /// R/W + const Reg ForcedDataFlush_W ("ForcedDataFlush_W" , 0x1040, RW::WriteONLY, false, {}); /// W + const Reg ChargeZeroSuppressionThreshold ("ChargeZeroSuppressionThreshold" , 0x1044, RW::ReadWrite, false, {}); /// R/W + const Reg ShortGateWidth ("ShortGateWidth" , 0x1054, RW::ReadWrite, false, {}); /// R/W + const Reg LongGateWidth ("LongGateWidth" , 0x1058, RW::ReadWrite, false, {}); /// R/W + const Reg GateOffset ("GateOffset" , 0x105C, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerThreshold ("TriggerThreshold" , 0x1060, RW::ReadWrite, false, {}); /// R/W + const Reg FixedBaseline ("FixedBaseline" , 0x1064, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerLatency ("TriggerLatency" , 0x106C, RW::ReadWrite, false, {}); /// R/W + const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, {}); /// R/W + const Reg ThresholdForPSDCut ("ThresholdForPSDCut" , 0x1078, RW::ReadWrite, false, {}); /// R/W + const Reg PurGapThreshold ("PurGapThreshold" , 0x107C, RW::ReadWrite, false, {}); /// R/W + const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W + const Reg EarlyBaselineFreeze ("EarlyBaselineFreeze" , 0x10D8, RW::ReadWrite, true, {}); /// R/W } } }; // end of namepace Register diff --git a/Scope.cpp b/Scope.cpp index 0130986..6e0d10b 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -52,6 +52,28 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh updateTraceThread->SetWaitTimeinSec(0.5); connect(updateTraceThread, &TimingThread::timeUp, this, &Scope::UpdateScope); + + sbReordLength = nullptr; + sbPreTrigger = nullptr; + sbDCOffset = nullptr; + cbDynamicRange = nullptr; + cbPolarity = nullptr; + + ///---- PHA + sbInputRiseTime = nullptr; + sbTriggerHoldOff = nullptr; + sbThreshold = nullptr; + cbSmoothingFactor = nullptr; + + sbTrapRiseTime = nullptr; + sbTrapFlatTop = nullptr; + sbDecayTime = nullptr; + sbPeakingTime = nullptr; + sbPeakHoldOff = nullptr; + + cbPeakAvg = nullptr; + cbBaselineAvg = nullptr; + //*================================== UI int rowID = -1; @@ -86,11 +108,16 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh //---Setup SettingGroup CleanUpSettingsGroupBox(); + SetUpGeneralPanel(); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel(); if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDPanel(); }); + bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this); + layout->addWidget(bnReadSettingsFromBoard, rowID, 2); + connect(bnReadSettingsFromBoard, &QPushButton::clicked, this, &Scope::ReadSettingsFromBoard); + //================ Trace settings rowID ++; { @@ -100,6 +127,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh settingLayout = new QGridLayout(settingGroup); settingLayout->setSpacing(0); + SetUpGeneralPanel(); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel(); } @@ -198,6 +226,8 @@ void Scope::StartScope(){ bnScopeStart->setEnabled(false); bnScopeStop->setEnabled(true); + EnableControl(false); + } void Scope::StopScope(){ @@ -219,6 +249,8 @@ void Scope::StopScope(){ bnScopeStart->setEnabled(true); bnScopeStop->setEnabled(false); + EnableControl(true); + } void Scope::UpdateScope(){ @@ -264,13 +296,47 @@ void Scope::UpdateScope(){ //*======================================================= //*======================================================= -void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Register::Reg para){ +void Scope::SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col){ QLabel * lb = new QLabel(str, settingGroup); lb->setAlignment(Qt::AlignRight | Qt::AlignCenter); settingLayout->addWidget(lb, row, col); cb = new RComboBox(settingGroup); settingLayout->addWidget(cb, row, col + 1); + +} + +void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Register::Reg para){ + + SetUpComboBoxSimple(cb, str, row, col); + + for( int i = 0; i < (int) para.GetComboList().size(); i++){ + cb->addItem(QString::fromStdString(para.GetComboList()[i].first), para.GetComboList()[i].second); + } + + connect(cb, &RComboBox::currentIndexChanged, this , [=](){ + if( ! enableSignalSlot ) return; + + int ch = cbScopeCh->currentIndex(); + int value = cb->currentData().toInt(); + digiMTX[ID].lock(); + digi[ID]->WriteRegister(para, value, ch); + digiMTX[ID].unlock(); + + QString msg; + msg = QString::fromStdString(para.GetName()) ; + msg += "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + ",CH:" + (ch == -1 ? "All" : QString::number(ch)); + msg += " = " + cb->currentText(); + if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){ + SendLogMsg(msg + " | OK."); + cb->setStyleSheet(""); + }else{ + SendLogMsg(msg + " | Fail."); + cb->setStyleSheet("color:red;"); + } + + }); + } void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Register::Reg para){ @@ -306,21 +372,27 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re msg = QString::fromStdString(para.GetName()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + ",CH:" + (ch == -1 ? "All" : QString::number(ch)); msg += " = " + QString::number(sb->value()); - uint32_t value = sb->value() / ch2ns / para.GetPartialStep(); + uint32_t value = sb->value() / ch2ns / abs(para.GetPartialStep()); - if( para.GetName() == "RecordLength_G" || para.GetName() == "PreTrigger"){ + if( para == Register::DPP::RecordLength_G || para == Register::DPP::PreTrigger){ int factor = digi[ID]->IsDualTrace() ? 2 : 1; value = value * factor; } + if( para == Register::DPP::ChannelDCOffset ){ + value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF); + } + + msg += " | 0x" + QString::number(value, 16); + digiMTX[ID].lock(); digi[ID]->WriteRegister(para, value, ch); digiMTX[ID].unlock(); if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){ - SendLogMsg(msg + "|OK."); + SendLogMsg(msg + " | OK."); sb->setStyleSheet(""); }else{ - SendLogMsg(msg + "|Fail."); + SendLogMsg(msg + " | Fail."); sb->setStyleSheet("color:red;"); } }); @@ -339,42 +411,103 @@ void Scope::CleanUpSettingsGroupBox(){ } +void Scope::SetUpGeneralPanel(){ + + printf("--- %s \n", __func__); + + SetUpSpinBox(sbReordLength, "Record Length [ns]", 0, 0, Register::DPP::RecordLength_G); + SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns]", 0, 2, Register::DPP::PreTrigger); + SetUpSpinBox(sbDCOffset, "DC offset [%]", 0, 4, Register::DPP::ChannelDCOffset); + sbDCOffset->setDecimals(2); + SetUpComboBox(cbDynamicRange, "Dynamic Range", 0, 6, Register::DPP::InputDynamicRange); + + + SetUpComboBoxSimple(cbPolarity, "Polarity ", 1, 0); + cbPolarity->addItem("Positive", 0); + cbPolarity->addItem("Negative", 1); + + +} + void Scope::SetUpPHAPanel(){ + printf("--- %s \n", __func__); - SetUpSpinBox(sbReordLength, "Record Length [ns]", 0, 0, Register::DPP::RecordLength_G); - - SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns]", 0, 2, Register::DPP::PreTrigger); - - SetUpSpinBox(sbDCOffset, "DC offset [%]", 0, 4, Register::DPP::ChannelDCOffset); - sbDCOffset->setDecimals(2); - - SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns]", 1, 0, Register::DPP::PHA::InputRiseTime); - SetUpSpinBox(sbThreshold, "Threshold [LSB]", 1, 2, Register::DPP::PHA::TriggerThreshold); - SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns]", 1, 4, Register::DPP::PHA::TriggerHoldOffWidth); + SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns]", 2, 0, Register::DPP::PHA::InputRiseTime); + SetUpSpinBox(sbThreshold, "Threshold [LSB]", 2, 2, Register::DPP::PHA::TriggerThreshold); + SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns]", 2, 4, Register::DPP::PHA::TriggerHoldOffWidth); + SetUpComboBox(cbSmoothingFactor, "Smooth Factor", 2, 6, Register::DPP::PHA::RCCR2SmoothingFactor); - SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns]", 2, 0, Register::DPP::PHA::TrapezoidRiseTime); - SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns]", 2, 2, Register::DPP::PHA::TrapezoidFlatTop); - SetUpSpinBox(sbDecayTime, "Decay Time [ns]", 2, 4, Register::DPP::PHA::DecayTime); - SetUpSpinBox(sbPeakingTime, "Peaking Time [ns]", 2, 6, Register::DPP::PHA::PeakingTime); + SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns]", 3, 0, Register::DPP::PHA::TrapezoidRiseTime); + SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns]", 3, 2, Register::DPP::PHA::TrapezoidFlatTop); + SetUpSpinBox(sbDecayTime, "Decay Time [ns]", 3, 4, Register::DPP::PHA::DecayTime); + SetUpSpinBox(sbPeakingTime, "Peaking Time [ns]", 3, 6, Register::DPP::PHA::PeakingTime); + + SetUpSpinBox(sbPeakHoldOff, "Peak HoldOff [ns]", 4, 6, Register::DPP::PHA::PeakHoldOff); + + SetUpComboBoxSimple(cbPeakAvg, "Peak Avg.", 4, 4); + cbPeakAvg->addItem("1 sample", 0); + cbPeakAvg->addItem("4 sample", 1); + cbPeakAvg->addItem("16 sample", 2); + cbPeakAvg->addItem("64 sample", 3); + + SetUpComboBoxSimple(cbBaselineAvg, "Baseline Avg.", 4, 2); + cbBaselineAvg->addItem("Not evaluated", 0); + cbBaselineAvg->addItem("16 sample", 1); + cbBaselineAvg->addItem("64 sample", 2); + cbBaselineAvg->addItem("256 sample", 3); + cbBaselineAvg->addItem("1024 sample", 4); + cbBaselineAvg->addItem("4096 sample", 5); + cbBaselineAvg->addItem("16384 sample", 6); } void Scope::SetUpPSDPanel(){ - SetUpSpinBox(sbReordLength, "Record Length [ns]", 0, 0, Register::DPP::RecordLength_G); - SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns]", 0, 2, Register::DPP::PreTrigger); +} + +void Scope::EnableControl(bool enable){ + + if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ + + sbPreTrigger->setEnabled(enable); + sbTrapRiseTime->setEnabled(enable); + sbTrapFlatTop->setEnabled(enable); + sbDecayTime->setEnabled(enable); + + sbInputRiseTime->setEnabled(enable); + + } + } //*======================================================= //*======================================================= +void Scope::UpdateComobox(RComboBox * &cb, const Register::Reg para){ + int ch = cbScopeCh->currentIndex(); + + enableSignalSlot = false; + int haha = digi[ID]->GetSettingFromMemory(para, ch); + + for( int i = 0; i < cb->count(); i++){ + int kaka = cb->itemData(i).toInt(); + if( kaka == haha ){ + cb->setCurrentIndex(i); + break; + } + } + + enableSignalSlot = true; +} + void Scope::UpdateSpinBox(RSpinBox * &sb, const Register::Reg para){ int ch = cbScopeCh->currentIndex(); + enableSignalSlot = false; unsigned int haha = digi[ID]->GetSettingFromMemory(para, ch); if( para.GetPartialStep() > 0 ) sb->setValue(haha * para.GetPartialStep() * ch2ns); if( para.GetPartialStep() == -1 ) sb->setValue(haha); - + enableSignalSlot = true; } @@ -393,14 +526,47 @@ void Scope::UpdatePanelFromMomeory(){ haha = digi[ID]->GetSettingFromMemory(Register::DPP::ChannelDCOffset, ch); sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 ); - UpdateSpinBox(sbInputRiseTime, Register::DPP::PHA::InputRiseTime); - UpdateSpinBox(sbThreshold, Register::DPP::PHA::TriggerThreshold); - UpdateSpinBox(sbTriggerHoldOff, Register::DPP::PHA::TriggerHoldOffWidth); + UpdateComobox(cbDynamicRange, Register::DPP::InputDynamicRange); - UpdateSpinBox(sbTrapRiseTime, Register::DPP::PHA::TrapezoidRiseTime); - UpdateSpinBox(sbTrapFlatTop, Register::DPP::PHA::TrapezoidFlatTop); - UpdateSpinBox(sbDecayTime, Register::DPP::PHA::DecayTime); - UpdateSpinBox(sbPeakingTime, Register::DPP::PHA::PeakingTime); + if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ + UpdateSpinBox(sbInputRiseTime, Register::DPP::PHA::InputRiseTime); + UpdateSpinBox(sbThreshold, Register::DPP::PHA::TriggerThreshold); + UpdateSpinBox(sbTriggerHoldOff, Register::DPP::PHA::TriggerHoldOffWidth); + UpdateSpinBox(sbTrapRiseTime, Register::DPP::PHA::TrapezoidRiseTime); + UpdateSpinBox(sbTrapFlatTop, Register::DPP::PHA::TrapezoidFlatTop); + UpdateSpinBox(sbDecayTime, Register::DPP::PHA::DecayTime); + UpdateSpinBox(sbPeakingTime, Register::DPP::PHA::PeakingTime); + + UpdateComobox(cbSmoothingFactor, Register::DPP::PHA::RCCR2SmoothingFactor); + + } } + +void Scope::ReadSettingsFromBoard(){ + + int ch = cbScopeCh->currentIndex(); + + digi[ID]->ReadRegister(Register::DPP::RecordLength_G, ch); + digi[ID]->ReadRegister(Register::DPP::PreTrigger, ch); + digi[ID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); + digi[ID]->ReadRegister(Register::DPP::InputDynamicRange, ch); + + if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ + + digi[ID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::DecayTime, ch); + digi[ID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch); + + } + + UpdatePanelFromMomeory(); + +} + + diff --git a/Scope.h b/Scope.h index a3ccf57..ef64d2e 100644 --- a/Scope.h +++ b/Scope.h @@ -35,6 +35,7 @@ private slots: void StartScope(); void StopScope(); void UpdateScope(); + void ReadSettingsFromBoard(); signals: @@ -42,13 +43,18 @@ signals: private: + + void SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col); void SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Register::Reg para); void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Register::Reg para); void CleanUpSettingsGroupBox(); + void SetUpGeneralPanel(); void SetUpPHAPanel(); void SetUpPSDPanel(); + void EnableControl(bool enable); + void UpdateComobox(RComboBox * &cb, const Register::Reg para); void UpdateSpinBox(RSpinBox * &sb, const Register::Reg para); void UpdatePanelFromMomeory(); @@ -71,6 +77,7 @@ private: QPushButton * bnScopeStart; QPushButton * bnScopeStop; + QPushButton * bnReadSettingsFromBoard; QLineEdit * leTriggerRate; @@ -82,20 +89,23 @@ private: RSpinBox * sbPreTrigger; RSpinBox * sbDCOffset; - //RComboBox * cbDynamicRange; + RComboBox * cbDynamicRange; + + RComboBox * cbPolarity; /// PHA RSpinBox * sbInputRiseTime; RSpinBox * sbTriggerHoldOff; RSpinBox * sbThreshold; - //RComboBox * cbSmoothingFactor; + RComboBox * cbSmoothingFactor; RSpinBox * sbTrapRiseTime; RSpinBox * sbTrapFlatTop; RSpinBox * sbDecayTime; RSpinBox * sbPeakingTime; - - + RSpinBox * sbPeakHoldOff; + RComboBox * cbPeakAvg; + RComboBox * cbBaselineAvg; };