Merge pull request #21 from PAMGuard/main

Work on bug fixes in CTD classifier
This commit is contained in:
Douglas Gillespie 2022-09-29 14:55:24 +01:00 committed by GitHub
commit f899d01a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 5 deletions

Binary file not shown.

View File

@ -228,10 +228,11 @@ public class SimpleCTClassifierPane extends SettingsPane<Chi2ThresholdParams> {
if (simpleChi2Classifier!=null && simpleChi2Classifier.getDataSelector()!=null) {
simpleChi2Classifier.getDataSelector().getDialogPaneFX().getParams(true);
}
if (this.currParams != null) {
currParams.uniqueID = this.currParams.uniqueID;
}
currParams.uniqueID = this.currParams.uniqueID;
return currParams=this.currParams;
return this.currParams=currParams;
}
@Override

View File

@ -32,6 +32,7 @@ public class SmruDaqDialogPanel {
JComboBox[] gains = new JComboBox[PamConstants.MAX_CHANNELS];
JComboBox[] filters = new JComboBox[PamConstants.MAX_CHANNELS];
JLabel libVersion;
private SmruDaqParameters smruDaqParameters;
@ -54,6 +55,12 @@ public class SmruDaqDialogPanel {
dialogPanel.setBorder(new TitledBorder("Daq card configuration"));
GridBagConstraints c = new PamGridBagContraints();
c.gridwidth = 3;
dialogPanel.add(new JLabel("Library version: ", JLabel.RIGHT), c);
c.gridx += c.gridwidth;
dialogPanel.add(libVersion = new JLabel("Unknown"));
c.gridx = 0;
c.gridy++;
c.gridwidth = 3;
PamDialog.addComponent(dialogPanel,new JLabel("Sample Rate ", SwingConstants.RIGHT),c);
c.gridx += c.gridwidth;
c.gridwidth = 3;
@ -169,6 +176,9 @@ public class SmruDaqDialogPanel {
}
public void setParams(SmruDaqParameters smruDaqParameters) {
libVersion.setText(smruDaqSystem.getJNILibInfo());
this.smruDaqParameters = smruDaqParameters.clone();
sampleRate.setSelectedIndex(smruDaqParameters.getSampleRateIndex());
for (int i = 0; i < SmruDaqParameters.NCHANNELS * nShownBoards; i++) {

View File

@ -20,7 +20,14 @@ public class SmruDaqJNI {
static public final int SMRU_RET_OK = 0;
/**
* Have rebuilt SAIL Daq interface in 2022, but in principle this was
* just a straight rebuild of the exact same JNI code. the main purpose was to check
* we could still rebuild it after all these years and it seems to work. No real
* need though to move on from the older and trusted version.
*/
private static final String SILIB = "SailDaqJNI";
// private static final String SILIB = "SailDaqV7";
/**
* this is the verbose level for the C code part.
@ -407,8 +414,8 @@ public class SmruDaqJNI {
}
catch (UnsatisfiedLinkError e)
{
smruDaqSystem.terminalPrint("SAIL DAQ Card lib '" + SILIB + "' cannot be loaded for the following reason:", 1);
smruDaqSystem.terminalPrint("Unsatisfied Link Error : " + e.getMessage(), 1);
System.out.println("SAIL DAQ Card lib '" + SILIB + "' cannot be loaded for the following reason:");
System.out.println("Unsatisfied Link Error : " + e.getMessage());
haveLibrary = false;
}
}
@ -840,5 +847,21 @@ public class SmruDaqJNI {
}
/**
* Get the dll library name.
* @return
*/
public String getLibrary() {
return SILIB;
}
/**
* Get the version of the dll library.
* @return
*/
public int getLibarayVersion() {
return libVersion;
}
}

View File

@ -87,6 +87,19 @@ public class SmruDaqSystem extends DaqSystem implements PamSettings {
}
}
public String getJNILibInfo() {
String lib = smruDaqJNI.getLibrary();
int libVer = smruDaqJNI.getLibarayVersion();
String verStr;
if (libVer < 0) {
verStr = String.format("%s not loaded", lib);
}
else {
verStr = String.format("%s.dll Version %d", lib, libVer);
}
return verStr;
}
@Override
public boolean canPlayBack(float sampleRate) {
return true;
@ -417,6 +430,15 @@ public class SmruDaqSystem extends DaqSystem implements PamSettings {
@Override
public void stopSystem(AcquisitionControl daqControl) {
if (keepRunning == false) {
/*
* it was never running, so no need to do this. From the GUI this isn't ever a problem
* but PAMDog can call stop a little over zealously, and there seems to be a problem
* with calling this when it's not running bunging up the cards. So basically without
* this PAMDog won't run properly with PAMDog
*/
return;
}
keepRunning = false;
try {
while(daqThreadRunning) {