This commit is contained in:
2019-07-05 08:54:50 +02:00
parent c582ba15d5
commit 8ac7d96ef3
7 changed files with 42 additions and 60 deletions

View File

@ -4,7 +4,7 @@
* @version 1.0 * @version 1.0
*/ */
#include "ansi.h"
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#include "SlsQt2DHist.h" #include "SlsQt2DHist.h"
@ -89,8 +89,8 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
} }
void SlsQt2DHist::SetMinMax(double zmin,double zmax){ void SlsQt2DHist::SetMinMax(double zmin,double zmax){
cprintf(GREEN, "zmin:%f zmax:%f\n", zmin, zmax); /* if(zmin<zmax){ edited out to test*/
if(zmin<zmax){ if(zmax != -1){
z_min=zmin; z_min=zmin;
z_max=zmax; z_max=zmax;
}else{ }else{

View File

@ -3,7 +3,7 @@
* @author Ian Johnson * @author Ian Johnson
* @version 1.0 * @version 1.0
*/ */
#include "ansi.h"
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <qlist.h> #include <qlist.h>
@ -235,34 +235,19 @@ void SlsQt2DPlot::Update() {
const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis); const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis);
rightAxis->setColorMap(zInterval, myColourMap(isLog)); rightAxis->setColorMap(zInterval, myColourMap(isLog));
#endif #endif
if (!zoomer->zoomRectIndex()) if (!zoomer->zoomRectIndex())
UnZoom(); UnZoom();
#if QWT_VERSION < 0x060000 #if QWT_VERSION < 0x060000
setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(), setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(),
d_spectrogram->data().range().maxValue()); d_spectrogram->data().range().maxValue());
#else #else
//cprintf(MAGENTA, "zmin:%f zmax:%f\n", zInterval.minValue(), zInterval.maxValue());
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue()); setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue());
#ifdef VERYVERBOSE
std::cout << "axis scale set\n";
#endif
plotLayout()->setAlignCanvasToScales(true); plotLayout()->setAlignCanvasToScales(true);
#ifdef VERYVERBOSE
std::cout << "layout\n";
#endif
#endif
#ifdef VERYVERBOSE
std::cout << "going to replot\n";
#endif #endif
replot(); replot();
#ifdef VERYVERBOSE
std::cout << "done\n";
#endif
} }
void SlsQt2DPlot::showContour(bool on) { void SlsQt2DPlot::showContour(bool on) {

View File

@ -2,7 +2,7 @@
#include "logger.h" #include "logger.h"
#include <iostream> #include <iostream>
#include "ansi.h"
#include <qtoolbutton.h> #include <qtoolbutton.h>
#include <qgroupbox.h> #include <qgroupbox.h>
#include <qgridlayout.h> #include <qgridlayout.h>
@ -84,12 +84,10 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
if(isLog) { if(isLog) {
the_plot->SetZMinimumToFirstGreaterThanZero(); the_plot->SetZMinimumToFirstGreaterThanZero();
} }
cprintf(BLUE, "zmin:%f zmax:%f\n", zmin, zmax);
// set zmin and zmax // set zmin and zmax
if (isZmin || isZmax) { if (isZmin || isZmax) {
zmin = (isZmin ? min : the_plot->GetZMinimum()); zmin = (isZmin ? min : the_plot->GetZMinimum());
zmax = (isZmax ? max : the_plot->GetZMaximum()); zmax = (isZmax ? max : the_plot->GetZMaximum());
cprintf(RED, "zmin:%f zmax:%f\n", zmin, zmax);
// if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now) // if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now)
// setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof) // setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof)
the_plot->SetZMinMax(zmin, zmax); the_plot->SetZMinMax(zmin, zmax);
@ -97,7 +95,6 @@ cprintf(BLUE, "zmin:%f zmax:%f\n", zmin, zmax);
zmin = 0; zmin = 0;
zmax = -1; zmax = -1;
} }
the_plot->Update(); the_plot->Update();
} }

View File

@ -2023,7 +2023,7 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
value = 0; value = 0;
} }
if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) { if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read tl value. Value read:%d\n", value); FILE_LOG(logERROR, ("Could not read tl value. Value read:%d\n", value));
value = 0; value = 0;
} }
} else { } else {
@ -2032,7 +2032,7 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
value = 0; value = 0;
} }
if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) { if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read bl value. Value read:%d\n", value); FILE_LOG(logERROR, ("Could not read bl value. Value read:%d\n", value));
value = 0; value = 0;
} }
} }
@ -2050,7 +2050,7 @@ uint32_t Feb_Control_ReadRegister(uint32_t offset) {
} }
printf("Read top right addr: 0x%08x\n", value); printf("Read top right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) { if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1); FILE_LOG(logERROR, (RED,"Could not read value. Value read:%d\n", value1));
value1 = 0; value1 = 0;
} }
printf("Read top left addr: 0x%08x\n", value1); printf("Read top left addr: 0x%08x\n", value1);
@ -2063,7 +2063,7 @@ uint32_t Feb_Control_ReadRegister(uint32_t offset) {
} }
printf("Read bottom right addr: 0x%08x\n", value); printf("Read bottom right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) { if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1); FILE_LOG(logERROR, (RED,"Could not read value. Value read:%d\n", value1));
value1 = 0; value1 = 0;
} }
printf("Read bottom left addr: 0x%08x\n", value1); printf("Read bottom left addr: 0x%08x\n", value1);

View File

@ -2203,11 +2203,11 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[],
return helpAcquire(HELP_ACTION); return helpAcquire(HELP_ACTION);
} }
if (!myDet->getNumberOfDetectors()) { if (!myDet->getNumberOfDetectors()) {
cprintf(RED, "Error: This shared memory has no detectors added. Aborting.\n"); FILE_LOG(logERROR) << "This shared memory has no detectors added. Aborting.";
return std::string("acquire failed"); return std::string("acquire failed");
} }
if (detPos >= 0) { if (detPos >= 0) {
cprintf(RED, "Error: Individual detectors not allowed for readout. Aborting.\n"); FILE_LOG(logERROR) << "Individual detectors not allowed for readout. Aborting.";
return std::string("acquire failed"); return std::string("acquire failed");
} }

View File

@ -190,7 +190,7 @@ public:
* @returns true or false for odd starting packet number * @returns true or false for odd starting packet number
*/ */
virtual bool SetOddStartingPacket(int index, char* packetData) { virtual bool SetOddStartingPacket(int index, char* packetData) {
cprintf(RED,"SetOddStartingPacket is a generic function that should be overloaded by a derived class\n"); FILE_LOG(logERROR) << "SetOddStartingPacket is a generic function that should be overloaded by a derived class";
return false; return false;
}; };
@ -204,7 +204,7 @@ public:
* @returns analog data bytes * @returns analog data bytes
*/ */
virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) { virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
cprintf(RED,"setImageSize is a generic function that should be overloaded by a derived class\n"); FILE_LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class";
return 0; return 0;
}; };
@ -213,7 +213,7 @@ public:
* @param number of interfaces * @param number of interfaces
*/ */
virtual void SetNumberofInterfaces(const int n) { virtual void SetNumberofInterfaces(const int n) {
cprintf(RED,"SetNumberofInterfaces is a generic function that should be overloaded by a derived class\n"); FILE_LOG(logERROR) << "SetNumberofInterfaces is a generic function that should be overloaded by a derived class";
} }
/** /**

View File

@ -204,17 +204,17 @@ public:
// get host info into res // get host info into res
int errcode = getaddrinfo (hostname, NULL, &hints, res); int errcode = getaddrinfo (hostname, NULL, &hints, res);
if (errcode != 0) { if (errcode != 0) {
cprintf (RED,"Error: Could not convert %s hostname to internet address (zmq):" FILE_LOG(logERROR) << "Error: Could not convert hostname " << hostname << " to internet address (zmq):"
"%s\n", hostname, gai_strerror(errcode)); << gai_strerror(errcode);
} else { } else {
if (*res == NULL) { if (*res == NULL) {
cprintf (RED,"Error: Could not convert %s hostname to internet address (zmq): " FILE_LOG(logERROR) << "Could not convert hostname " << hostname << " to internet address (zmq): "
"gettaddrinfo returned null\n", hostname); "gettaddrinfo returned null";
} else{ } else{
return 0; return 0;
} }
} }
cprintf(RED, "Error: Could not convert hostname to internet address\n"); FILE_LOG(logERROR) << "Could not convert hostname to internet address";
return 1; return 1;
}; };
@ -232,7 +232,7 @@ public:
freeaddrinfo(res); freeaddrinfo(res);
return 0; return 0;
} }
cprintf(RED, "Error: Could not convert internet address to ip string\n"); FILE_LOG(logERROR) << "Could not convert internet address to ip string";
return 1; return 1;
} }
@ -351,7 +351,7 @@ public:
int length = zmq_msg_recv (&message, sockfd.socketDescriptor, 0); int length = zmq_msg_recv (&message, sockfd.socketDescriptor, 0);
if (length == -1) { if (length == -1) {
PrintError (); PrintError ();
cprintf (BG_RED,"Error: Could not read header for socket %d\n",index); FILE_LOG(logERROR) << "Could not read header for socket " << index;
} }
#ifdef VERBOSE #ifdef VERBOSE
else else
@ -419,7 +419,7 @@ public:
Document& document, bool& dummy, uint32_t version) Document& document, bool& dummy, uint32_t version)
{ {
if ( document.Parse( buff, length).HasParseError() ) { if ( document.Parse( buff, length).HasParseError() ) {
cprintf( RED,"%d Could not parse. len:%d: Message:%s \n", index, length, buff ); FILE_LOG(logERROR) << index << " Could not parse. len:" << length << ": Message:" << buff;
fflush ( stdout ); fflush ( stdout );
// char* buf = (char*) zmq_msg_data (&message); // char* buf = (char*) zmq_msg_data (&message);
for ( int i= 0; i < length; ++i ) { for ( int i= 0; i < length; ++i ) {
@ -431,7 +431,7 @@ public:
} }
if (document["jsonversion"].GetUint() != version) { if (document["jsonversion"].GetUint() != version) {
cprintf( RED, "version mismatch. required %u, got %u\n", version, document["jsonversion"].GetUint()); FILE_LOG(logERROR) << "version mismatch. required " << version << ", got " << document["jsonversion"].GetUint();
return 0; return 0;
} }
@ -474,7 +474,7 @@ public:
} }
//incorrect size (larger) //incorrect size (larger)
else { else {
cprintf(RED,"Error: Received weird packet size %d for socket %d\n", length, index); FILE_LOG(logERROR) << "Received weird packet size " << length << " for socket " << index;
memset(buf,0xFF,size); memset(buf,0xFF,size);
} }
@ -490,52 +490,52 @@ public:
void PrintError () { void PrintError () {
switch (errno) { switch (errno) {
case EINVAL: case EINVAL:
cprintf(RED, "Error: The socket type/option or value/endpoint supplied is invalid (zmq)\n"); FILE_LOG(logERROR) << "The socket type/option or value/endpoint supplied is invalid (zmq)";
break; break;
case EAGAIN: case EAGAIN:
cprintf(RED, "Error: Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)\n"); FILE_LOG(logERROR) << "Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)";
break; break;
case ENOTSUP: case ENOTSUP:
cprintf(RED, "Error: The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)\n"); FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)";
break; break;
case EFSM: case EFSM:
cprintf(RED, "Error: The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)\n"); FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)";
break; break;
case EFAULT: case EFAULT:
cprintf(RED, "Error: The provided context/message is invalid (zmq)\n"); FILE_LOG(logERROR) << "The provided context/message is invalid (zmq)";
break; break;
case EMFILE: case EMFILE:
cprintf(RED, "Error: The limit on the total number of open ØMQ sockets has been reached (zmq)\n"); FILE_LOG(logERROR) << "The limit on the total number of open ØMQ sockets has been reached (zmq)";
break; break;
case EPROTONOSUPPORT: case EPROTONOSUPPORT:
cprintf(RED, "Error: The requested transport protocol is not supported (zmq)\n"); FILE_LOG(logERROR) << "The requested transport protocol is not supported (zmq)";
break; break;
case ENOCOMPATPROTO: case ENOCOMPATPROTO:
cprintf(RED, "Error: The requested transport protocol is not compatible with the socket type (zmq)\n"); FILE_LOG(logERROR) << "The requested transport protocol is not compatible with the socket type (zmq)";
break; break;
case EADDRINUSE: case EADDRINUSE:
cprintf(RED, "Error: The requested address is already in use (zmq)\n"); FILE_LOG(logERROR) << "The requested address is already in use (zmq)";
break; break;
case EADDRNOTAVAIL: case EADDRNOTAVAIL:
cprintf(RED, "Error: The requested address was not local (zmq)\n"); FILE_LOG(logERROR) << "The requested address was not local (zmq)";
break; break;
case ENODEV: case ENODEV:
cprintf(RED, "Error: The requested address specifies a nonexistent interface (zmq)\n"); FILE_LOG(logERROR) << "The requested address specifies a nonexistent interface (zmq)";
break; break;
case ETERM: case ETERM:
cprintf(RED, "Error: The ØMQ context associated with the specified socket was terminated (zmq)\n"); FILE_LOG(logERROR) << "The ØMQ context associated with the specified socket was terminated (zmq)";
break; break;
case ENOTSOCK: case ENOTSOCK:
cprintf(RED, "Error: The provided socket was invalid (zmq)\n"); FILE_LOG(logERROR) << "The provided socket was invalid (zmq)";
break; break;
case EINTR: case EINTR:
cprintf(RED, "Error: The operation was interrupted by delivery of a signal (zmq)\n"); FILE_LOG(logERROR) << "The operation was interrupted by delivery of a signal (zmq)";
break; break;
case EMTHREAD: case EMTHREAD:
cprintf(RED, "Error: No I/O thread is available to accomplish the task (zmq)\n"); FILE_LOG(logERROR) << "No I/O thread is available to accomplish the task (zmq)";
break; break;
default: default:
cprintf(RED, "Error: Unknown socket error (zmq)\n"); FILE_LOG(logERROR) << "Unknown socket error (zmq)";
break; break;
} }
}; };