Moved temperature readout into Osci thread
This commit is contained in:
@@ -424,6 +424,7 @@ void *OsciThread::Entry()
|
||||
DRSBoard *b;
|
||||
TIMESTAMP ts;
|
||||
bool skip_event;
|
||||
time_t lastTempRead = 0;
|
||||
|
||||
n = m = 0;
|
||||
autoTriggered = false;
|
||||
@@ -471,7 +472,7 @@ void *OsciThread::Entry()
|
||||
*p++ = (unsigned short)b->GetBoardSerialNumber();
|
||||
}
|
||||
|
||||
// restart boards in invertd order (master last)
|
||||
// restart boards in inverted order (master last)
|
||||
for (index = m_osci->GetDRS()->GetNumberOfBoards()-1 ; index>=0 ; index--) {
|
||||
b = m_osci->GetBoard(index);
|
||||
if (!m_osci->IsMultiBoard() && m_osci->GetCurrentBoard() != b)
|
||||
@@ -537,7 +538,18 @@ void *OsciThread::Entry()
|
||||
wxThread::Sleep(10);
|
||||
m_active = false;
|
||||
}
|
||||
|
||||
|
||||
// read temperature once every second
|
||||
time_t now;
|
||||
time(&now);
|
||||
if (now > lastTempRead) {
|
||||
lastTempRead = now;
|
||||
for (int i=0 ; i<m_osci->GetDRS()->GetNumberOfBoards() ; i++) {
|
||||
b = m_osci->GetBoard(i);
|
||||
b->ReadTemperature();
|
||||
}
|
||||
}
|
||||
|
||||
} while (!m_stopThread);
|
||||
|
||||
m_finished = true;
|
||||
|
||||
@@ -534,6 +534,7 @@ protected:
|
||||
int fTcalPhase;
|
||||
int fTcalSource;
|
||||
int fRefclk;
|
||||
double fTemperature;
|
||||
|
||||
unsigned char fWaveforms[kNumberOfChipsMax * kNumberOfChannelsMax * 2 * kNumberOfBins];
|
||||
|
||||
@@ -741,7 +742,8 @@ public:
|
||||
int GetTcalSource() { return fTcalSource; }
|
||||
int SetCalibVoltage(double value);
|
||||
int SetCalibTiming(int t1, int t2);
|
||||
double GetTemperature();
|
||||
double GetTemperature() { return fTemperature; };
|
||||
int ReadTemperature();
|
||||
int Is2048ModeCapable();
|
||||
int GetTriggerBus();
|
||||
unsigned int GetScaler(int channel);
|
||||
|
||||
@@ -500,6 +500,7 @@ DRSBoard::DRSBoard(MUSB_INTERFACE * musb_interface, int usb_slot)
|
||||
, fNumberOfTimeData(0)
|
||||
, fDebug(0)
|
||||
, fTriggerStartBin(0)
|
||||
, fTemperature(0)
|
||||
{
|
||||
if (musb_interface->usb_type == 1)
|
||||
fTransport = TR_USB;
|
||||
@@ -4501,19 +4502,19 @@ int DRSBoard::FinishClearCycle()
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
double DRSBoard::GetTemperature()
|
||||
int DRSBoard::ReadTemperature()
|
||||
{
|
||||
// Read Out Temperature Sensor
|
||||
unsigned char buffer[2];
|
||||
unsigned short d;
|
||||
double temperature;
|
||||
|
||||
Read(T_STATUS, buffer, REG_TEMPERATURE, 2);
|
||||
int status = Read(T_STATUS, buffer, REG_TEMPERATURE, sizeof(buffer));
|
||||
|
||||
d = (static_cast < unsigned int >(buffer[1]) << 8) +buffer[0];
|
||||
temperature = ((d >> 3) & 0x0FFF) * 0.0625;
|
||||
this->fTemperature = ((d >> 3) & 0x0FFF) * 0.0625;
|
||||
|
||||
return temperature;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
@@ -581,7 +581,7 @@ int musb_read(MUSB_INTERFACE *musb_interface, int endpoint, void *buf, int count
|
||||
libusb_bulk_transfer(musb_interface->dev, endpoint | 0x80, (unsigned char*)buf, count, &n_read, timeout);
|
||||
/* errors should be handled in upper layer ....
|
||||
if (n_read <= 0) {
|
||||
fprintf(stderr, "musb_read: requested %d, read %d, errno %d (%s)\n", count, n_read, status, strerror(status));
|
||||
fprintf(stderr, "musb_read: requested %d, read %d, errno %d (%s)\n", count, n_read, status, libusb_strerror(status));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user