2.50 MK3 neutron

This commit is contained in:
Luc Vandenbroucke 2026-01-07 14:16:45 +01:00
parent ac67020e16
commit 30bd1ca003
23 changed files with 885 additions and 685 deletions

View file

@ -187,11 +187,11 @@ void EpdBase::Epd2U::DecodeStatus()
eDosDose07Warning = eDosDose07Alarm;
eDosDose10Warning = AlarmDoseHP101G;
eDosDose10Alarm = AlarmRateHP102G;
eDosRate07Alarm = OtherAlarmRateHp07N | AlarmRateHP07N;
eDosRate07Alarm = OtherAlarmRateHp07N || AlarmRateHP07N;
eDosRate07Warning = eDosRate07Alarm;
eDosRate10Warning = OtherAlarmRateHp101G | AlarmRateHP101G;
eDosRate10Alarm = OtherAlarmRateHp102G | AlarmRateHP102G;
eDosBatteryWarning = OtherAlarmBatLow | OtherAlarmBatVolt;
eDosRate10Warning = OtherAlarmRateHp101G || AlarmRateHP101G;
eDosRate10Alarm = OtherAlarmRateHp102G || AlarmRateHP102G;
eDosBatteryWarning = OtherAlarmBatLow || OtherAlarmBatVolt;
if (!VersionOK) OtherAlarms &= 0x7f;
@ -201,6 +201,7 @@ void EpdBase::Epd2U::DecodeStatus()
hasAlarm = (eDosRateAlarm || eDosDoseAlarm);
hasFault = ((OtherAlarms & 0xf8) != 0) || ((OperatingStatus & 0x80) != 0) || (ErrorStatus != 0);
StatusDecoded = true;
}
/// <summary>
@ -228,6 +229,7 @@ WORD EpdBase::Epd2U::ReadStatus()
RealTime = UnixTimeNow();
CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
StatusDecoded = false;
if (port == 0) {
EpdClock = 123; ErrorStatus = 0;
};

View file

@ -37,6 +37,7 @@ namespace EpdBase
WORD AlarmStatus;
WORD OtherAlarms;
WORD EEPROMBadSectors;
WORD StatusDecoded;
WORD WriteConfig32 = 0;

View file

@ -82,8 +82,8 @@ extern "C"
int32_t EPDDLL_API EndWriteSensitivities_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadGains_R3(CommsHandle hComms, uint8_t sensIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadGains_R3(CommsHandle hComms, CompletionToken token, CalGain_t gains[], uint8_t length, uint8_t * numGains);
CompletionToken EPDDLL_API BeginWriteGains_R3(CommsHandle hComms, CalGain_t gains[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGains_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteGains(CommsHandle hComms, CalGain_t gains[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGains(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteNotCalibratedFlag_R3(CommsHandle hComms, uint8_t notCalibrated, CompletionCallback callback);
int32_t EPDDLL_API EndWriteNotCalibratedFlag_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteGainableFlag_R3(CommsHandle hComms, uint8_t gainable, CompletionCallback callback);

View file

@ -471,6 +471,10 @@ BYTE checkStatus(DoseAlarmFlags status, DoseAlarmFlags flag)
void Epd3Base::Epd3U::DecodeStatus()
{
if (StatusDecoded) {
return;
}
eDosDose07Warning = eDosDose07Alarm = eDosDose10Warning = eDosDose10Alarm = eDosRate07Warning = eDosRate07Alarm = eDosRate10Warning = eDosRate10Alarm = eDosBatteryWarning = eDosDoseAlarm = eDosRateAlarm = 0;
AlarmDoseHP07N = AlarmRateHP07N = AlarmDoseHP101G = AlarmDoseHP102G = AlarmRateHP101G = AlarmRateHP102G= 0;
hasAlarm = hasFault = false;
@ -531,6 +535,8 @@ void Epd3Base::Epd3U::DecodeStatus()
hasAlarm = eDosDoseAlarm || eDosRateAlarm;
hasFault = ((uint32_t)epd3status.FaultStatus & ~(uint32_t)FaultStatusFlags::ErrorLogged) != 0;
eDosBatteryWarning = OtherAlarmBatLow | OtherAlarmBatVolt;
StatusDecoded = true;
}
int Epd3Base::Epd3U::SetTime() //Only R3
@ -550,6 +556,7 @@ void WINAPI ReadStatusCompletion(CommsHandle hComms, CompletionToken token)
{
int rv = EndReadStatus(current->epdComsHandle, token, &current->epd3status);
rv = current->SetEndReturnValue(rv);
current->StatusDecoded = false;
current->IssueCount = current->epd3status.IssueCount;
current->OperatingStatus = current->epd3status.OperatingStatus;
current->AlarmStatus = current->epd3status.AlarmStatus;
@ -565,8 +572,10 @@ int Epd3Base::Epd3U::ReadStatusOnly()
int rv = 0;
ResetEvent(hCompletion);
SetFunctionReturnValue(eFunctions::ReadStatus, 0);
current->StatusDecoded = false;
token = BeginReadStatus(epdComsHandle, ReadStatusCompletion);
rv = CommitAndSetRV();
return rv;
}
/// <summary>
@ -611,7 +620,6 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
memset(&epd3status, 0, sizeof(StatusData_t));
int rv2;
/*step = 1;
SetFunctionReturnValue(eFunctions::EpdOnOff, 0);
@ -628,6 +636,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
if (!rv)
rv = EndReadStatus(epdComsHandle, token, &epd3status);
rv2 = SetEndReturnValue(rv);
current->StatusDecoded = false;
if (rv != 0)
goto error;
@ -663,8 +672,8 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
EpdID = EpdID32;
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
isNG = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
isBG = (EpdType == EpdTypes::Mk2BetaGamma) || (EpdType == EpdTypes::Mk3BetaGamma);
isNG = (EpdType == EpdTypes::Mk2Neutron) || (EpdType == EpdTypes::Mk3Neutron);
HardVersion = MarkNumber.Major;
HardVersionMinor = MarkNumber.Minor;
SoftVersion = VersionNumber.Major;
@ -784,20 +793,59 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
void Epd3Base::Epd3U::decodeSensitivities(int count) {
// Neutron
// An1Sens10N = 14,
// Fn1Sens10N = 15,
// Fn2Sens10N = 16,
//float Kx = 0;
K1 = K2 = K3 = K4 = K4 = K6 = 0.0F;
//SensitivityId sid = SensitivityId::Hg1Sens10G;
for (int ix = count - 1; ix >= 0; ix--) {
switch ((SensitivityId)sensitivities[ix].id)
{
case SensitivityId::Hg1Sens10G: K1 = sensitivities[ix].value * 100000; break;
case SensitivityId::Sg1Sens10G: K2 = sensitivities[ix].value * 100000; break;
case SensitivityId::Hg1Sens07G: K3 = sensitivities[ix].value * 100000; break; //Neutr=FN
case SensitivityId::Sg1Sens07G: K4 = sensitivities[ix].value * 100000; break; //Neutr=AN
case SensitivityId::Hg1Sens07G:
K3 = sensitivities[ix].value * 100000; break; //Neutr=FN
case SensitivityId::Sg1Sens07G:
K4 = sensitivities[ix].value * 100000; break; //Neutr=AN
case SensitivityId::Fb1Sens07B: K5 = sensitivities[ix].value * 100000; break;
case SensitivityId::Sg2Sens07B: K6 = sensitivities[ix].value * 100000; break;
default: break;
case SensitivityId::An1Sens10N:
K4 = sensitivities[ix].value * 100000; break;
case SensitivityId::Fn1Sens10N:
K3 = sensitivities[ix].value * 100000; break;
default:
// sid = (SensitivityId)sensitivities[ix].id;
//Kx = sensitivities[ix].value * 100000;
break;
}
}
}
void Epd3Base::Epd3U::decodeGains(int count) {
// Neutron
// An1Sens10N = 14,
// Fn1Sens10N = 15,
// Fn2Sens10N = 16,
//float Kx = 0;
GainAn = GainFn = 0.0F;
//SensitivityId sid = SensitivityId::Hg1Sens10G;
for (int ix = count - 1; ix >= 0; ix--) {
switch ((SensitivityId)gains[ix].id)
{
case SensitivityId::An1Sens10N:
GainAn = gains[ix].value ; break;
case SensitivityId::Fn1Sens10N:
GainFn = gains[ix].value ; break;
default:
break;
}
}
}
void Epd3Base::Epd3U::decodetotDoses(int count)
{
//doses
@ -970,6 +1018,8 @@ void Epd3Base::Epd3U::decodedTresholds(int numdTresholds)
case CounterType::Counter_Fb1: FB = dTresholds[ix].value; break;
case CounterType::Counter_An1: BC = dTresholds[ix].value; break; //AN-> BC
case CounterType::Counter_Fn2: FB = dTresholds[ix].value; break; //FN->FB
default:
break;
}
}
}
@ -980,16 +1030,31 @@ void Epd3Base::Epd3U::decodedTresholds(int numdTresholds)
/// <returns></returns>
WORD Epd3Base::Epd3U::ReadCal()
{
int r = 0;
int r = 0, r2=0;
Error = 0;
SetFunctionReturnValue(ReadSensitivities,0);
token = BeginReadSensitivities(epdComsHandle, nullptr, 0, nullptr);
r = CommitAndSetRV();
r2 = CommitAndSetRV();
//r = Commit3(epdComsHandle); SetCommitReturnValue(r);
r = EndReadSensitivities(epdComsHandle, token, sensitivities, MaxSensitivities, &numSensitivities);
r = SetEndReturnValue(r);
if (r != 0) goto error;
if (r != 0)
goto error;
decodeSensitivities(numSensitivities);
SetFunctionReturnValue(ReadGains, 0);
token = BeginReadGains(epdComsHandle, nullptr, 0, nullptr);
r2 = CommitAndSetRV();
//r = Commit3(epdComsHandle); SetCommitReturnValue(r);
r = EndReadGains(epdComsHandle, token, gains, MaxGains, &numGains);
decodeGains(numGains); //GainAn en GainFn
r = SetEndReturnValue(r);
if (r != 0)
goto error;
return r;
error:
Error = r;
return r;
@ -1306,7 +1371,8 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, (uint8_t)hp10tresholds.NumberThresholds, hp10tresholds.Thresholds, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmThresholds, token);
if (r != 0) goto error;
if (r != 0)
goto error;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
@ -1316,7 +1382,8 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmThresholds, token);
if (r != 0) goto error;
if (r != 0)
goto error;
SetFunctionReturnValue(eFunctions::WriteRateOffPercentage,0);
token = BeginWriteRateOffPercentage(epdComsHandle, RatePct, 2, nullptr);
@ -1426,12 +1493,14 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
r = 0;
if (!PrepareDone) {
r = PrepareForIssue();
if (r) goto error;
if (r)
goto error;
}
step = 1;
if (!isConnected) r = ReOpenDev();
if (r) goto error;
if (r)
goto error;
step = 4;
//EPDIssued
@ -1528,11 +1597,11 @@ WORD Epd3Base::Epd3U::WriteCal()
uint32_t r = 0;
if (port == 0) return 0;
if (K6 > 2000)
/*if (K6 > 2000)
{
r = 0;
return 0;
}
}*/
if (EpdType == EpdTypes::Mk2Neutron)
{
@ -1551,6 +1620,33 @@ WORD Epd3Base::Epd3U::WriteCal()
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteSensitivities_R2(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0)
goto error;
} else
if (EpdType == EpdTypes::Mk3Neutron)
{
//Password = 9;
//SetFunctionReturnValue(eFunctions::MfrLogin_R2, 0);
//token = BeginMfrLogin_R2(epdComsHandle, Password, nullptr);
//uint32_t r = CommitAndEnd2RV(EndMfrLogin_R2, token);
////Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r ) r = EndMfrLogin_R2(epdComsHandle, token); SetEndReturnValue(r);
//if (r != 0)
// goto error;
SetFunctionReturnValue(eFunctions::WriteAccessLevelAdmin, 0);
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, nullptr);
r = CommitAndEnd2RV(EndWriteAccessLevel, token);
SetFunctionReturnValue(eFunctions::WriteGains_R3, 0);
numGains = 2;
gains[0].id = (uint16_t) SensitivityId::An1Sens10N; //K4
gains[0].value = GainAn;
gains[1].id = (uint16_t)SensitivityId::Fn1Sens10N; //K3
gains[1].value = GainFn;
token = BeginWriteGains(epdComsHandle, gains, numGains, nullptr);
r = CommitAndEnd2RV(EndWriteGains, token);
if (r != 0)
goto error;
}
return r;
error:
@ -1610,22 +1706,31 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate)
DWORD wrv = 0;
int rv1 = -1, rv2 = -1;
OutputDebugStringW(L"**** IssueAndCheck start ****\n");
ResetStepReturnValues();
if (!isConnected) rv = ReOpenDev();
if (rv) goto error;
if (rv)
goto error;
step = 1;
OutputDebugStringW(L"**** IssueAndCheck step 1 settime ****\n");
rv = SetTime();
//synctime
OutputDebugStringW(L"**** Prepare ****\n");
OutputDebugStringW(L"**** Prepare IssueAndCheck ****\n");
step = 2;
rv = PrepareForIssue(); //Set epd on, clear doses and alarms
if (rv) goto error;
if (rv)
goto error;
if (!isConnected)
rv = ReOpenDev();
rv = ReadStatusOnly();
if (rv)
rv2=1;
wrv= WaitForSingleObject(hCompletion, 2000);
if (wrv == WAIT_OBJECT_0) rv = 0;
else if (wrv == WAIT_TIMEOUT) {
@ -1638,15 +1743,21 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate)
step = 3;
if (isNG) {
step = 1;
float kx = gain;
float kx = gain/100;
rv = ReadCal();
if (rv != 0 || K6 != 1310) { rv = 1; goto error; }
if (K3 != kx || K4 != kx)
if (rv != 0 ) { //K6 test op 1310 || K6 != 1310 ??
rv = 1;
goto error;
}
//K3 = Fn1Sens10N K4 = An1Sens10N
if (GainAn != kx || GainFn!= kx)
{
step = 2;
K3 = K4 = kx;
GainAn=GainFn = kx;
rv = WriteCal();
if (rv != 0) goto error;
if (rv != 0)
goto error;
}
}
@ -1658,13 +1769,16 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate)
rv = ReOpenDev();
rv = SetChirp(ChirpRate);
}
if (rv) goto error;
if (rv)
goto error;
OutputDebugStringW(L"**** step 5 issue ****\n");
step = 5;
rv = Issue(true); // data already loaded
EndCom(isConnected);
if (rv) goto error;
if (rv)
goto error;
return rv;
@ -1700,6 +1814,8 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteQuickAccessDisplays_R3,1);
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, numDisplays, nullptr);
r = CommitAndEnd2RV(EndWriteQuickAccessDisplays_R3, token);
if (r != 0)
Error = r;
}
if (!r) {
//Unmanaged%20HtmlFiles/_display_ids.html
@ -1737,6 +1853,8 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteDisplayEnables_R3,1);
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, nullptr);
r = CommitAndEnd2RV(EndWriteDisplayEnables_R3, token);
if (r != 0)
Error = r;
}
if (!r) {
uint8_t numMenus = 9;
@ -1755,11 +1873,16 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteDisplayEnablePermissions_R3,1);
token = BeginWriteDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, permissions, numDisplays, nullptr);
r = CommitAndEnd2RV(EndWriteDisplayEnablePermissions_R3, token);
if (r != 0)
Error = r;
}
if (!r) {
//AlarmConfiguration
uint8_t alarmConfigLen = 14;
alarmConfigIds = new AlarmConfig_t[14]{
if (isBG) {
const uint8_t alarmConfigLen = 14;
alarmConfigIds = new AlarmConfig_t[alarmConfigLen]{
{ (AlarmIds)6,0,0x0000,0x1884,60 },
{ (AlarmIds)8,0,0x0000,0x9884,60 },
{ (AlarmIds)5,0,0x0000,0x9CA4,60 },
@ -1780,6 +1903,7 @@ int Epd3Base::Epd3U::WriteConfig(void)
token = BeginWriteAlarmConfiguration_R3(epdComsHandle, alarmConfigIds, alarmConfigLen, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmConfiguration_R3, token);
}
}
//constexpr int maxbatch= 2;
//int s[maxbatch];
@ -1794,20 +1918,32 @@ int Epd3Base::Epd3U::WriteConfig(void)
token = BeginWriteOffModeDisplay_R3(epdComsHandle, dutyCycle, offModeDispId, nullptr);
r = CommitAndEnd2RV(EndWriteOffModeDisplay_R3, token);
if (r != 0)
Error = r;
uint8_t OnOfenabled = 0;
SetFunctionReturnValue(eFunctions::WriteSwitchOnFromButton_R3, 0);
token = BeginWriteSwitchOnFromButton_R3(epdComsHandle, OnOfenabled, nullptr);
r = CommitAndEnd2RV(EndWriteSwitchOnFromButton_R3, token);
if (r != 0)
Error = r;
SetFunctionReturnValue(eFunctions::WriteAccessLevelOpen, 0);
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Open,nullptr,0, nullptr);
r = CommitAndEnd2RV(EndWriteAccessLevel, token);
if (r != 0)
Error = r;
Sleep(200);
r = DisconnectAndConnect();
if (r != 0)
Error = r;
Error = r;
}
else
Error = r;
return r;
}

View file

@ -11,6 +11,8 @@
#pragma unmanaged
#define MaxPeakRates 10
#define MaxSensitivities 10
#define MaxGains 10
#define MaxDoses 4
#define MaxCounts 6
#define MaxAlarmConfig 10
@ -22,7 +24,7 @@
namespace Epd3Base {
enum eFunctions {
ReadSensitivities, ReadDetectorThresholds, fReadDoses, ReadTotalDoses, ReadQualityData, ReadPeakRates, ClearTotalDose, ClearDose, ClearPeakRates, ClearFaultStatus, ClearLatchedAlarms, EpdOnOff, ReadAlarmConfiguration, ReadAlarmThresholds, WriteAlarmThresholds, WriteRateOffPercentage, DeissueEPD, SetBaselineCounters, WriteWearerId, ReadBaselineCounts, MfrLogin_R2, WriteSensitivities_R2
ReadSensitivities, ReadGains, ReadDetectorThresholds, fReadDoses, ReadTotalDoses, ReadQualityData, ReadPeakRates, ClearTotalDose, ClearDose, ClearPeakRates, ClearFaultStatus, ClearLatchedAlarms, EpdOnOff, ReadAlarmConfiguration, ReadAlarmThresholds, WriteAlarmThresholds, WriteRateOffPercentage, DeissueEPD, SetBaselineCounters, WriteWearerId, ReadBaselineCounts, MfrLogin_R2, WriteSensitivities_R2, WriteSensitivities_R3, WriteGains_R3
, WriteAccessLevelAdmin, WriteAccessLevelOpen
, WriteQuickAccessDisplays_R3, WriteDisplayEnables_R3, WriteDisplayEnablePermissions_R3, WriteAlarmConfiguration_R3, WriteOffModeDisplay_R3, WriteSwitchOnFromButton_R3
, WriteChirpSensitivity, WriteChirpEnable_R3
@ -158,6 +160,7 @@ namespace Epd3Base {
bool isMK3 = false;
bool hasAlarm = false;
bool hasFault = false;
bool StatusDecoded;
SYSTEMTIME tRealTime;
@ -207,6 +210,8 @@ namespace Epd3Base {
float K4;
float K5;
float K6;
float GainAn;
float GainFn;
uint32_t SG;
uint32_t BC;
uint32_t FB;
@ -244,10 +249,12 @@ namespace Epd3Base {
PeakRate_t peakRates[MaxPeakRates];
AlarmConfig_t alarmConfig[MaxAlarmConfig];
CalSensitivity_t sensitivities[MaxSensitivities];
CalGain_t gains[MaxGains];
Counter_t Counts[MaxCounts];
uint8_t countsRead;
uint32_t seconds;
uint8_t numDoses, numtotDoses, numRates, numSensitivities, numTresholds;
uint8_t numDoses, numtotDoses, numRates, numSensitivities, numTresholds, numGains;
uint16_t numAlarm;
uint32_t utc;
Mk3QualityData_t quality;
@ -293,6 +300,7 @@ namespace Epd3Base {
void encodeTreshold(Mk3AlarmThresholds_t* th);
void decodedTresholds(int numdTresholds);
void decodeSensitivities(int count);
void decodeGains(int count);
void decodetotDoses(int count);
void decodeDoses(int count);
void decodePeakRates(int count);

View file

@ -87,6 +87,11 @@ enum class SensitivityId
Fb2Sens07B = 11,
Sg2Sens07B = 12, // Mk2 BCSens07 (K6)
Sg3Sens07B = 13,
//Neutron
An1Sens10N = 14,
Fn1Sens10N = 15,
Fn2Sens10N = 16,
MaxSensitivity
};
#define MAX_SENSITIVITIES ((uint16_t)SensitivityId::MaxSensitivity)

View file

@ -248,6 +248,7 @@ int EpdBaseClr::Epd2::AfterGetStatus(Epd3Base::Epd3U* epd)
SoftVersion = epd->SoftVersion;
FunctionFlags = epd->FunctionFlags;
CountsClock = epd->EpdClock;
//hier nodig ?
DecodeStatus( epd); // zet hasAlarm
return 0;
}
@ -327,7 +328,8 @@ int EpdBaseClr::Epd2::AfterGetDoses(Epd3Base::Epd3U* epd)
BC = epd->SG;
FB = epd->FB;
HG = epd->HG;
NGgain = K3;
//NGgain = K3;
NGgain = epd->GainAn;
eDosDose07Warning = epd->eDosDose07Warning;
eDosDose07Alarm= epd->eDosDose07Alarm;
@ -595,7 +597,7 @@ int EpdBaseClr::Epd2::AfterReadTresholds(EpdBase::Epd2U* epd)
FB = epd->FB;
HG = epd->HG;
NGgain = K3;
NGgain = K3; //EPD2
return rv;
@ -641,7 +643,7 @@ int EpdBaseClr::Epd2::AfterReadTresholds(Epd3Base::Epd3U* epd)
FB = epd->FB;
HG = epd->HG;
NGgain = K3;
NGgain = epd->GainAn; //K3 vroeger
return rv;
}
/// <summary>
@ -943,14 +945,23 @@ error:
void EpdBaseClr::Epd2::WaitEpd()
{
int rv = 0; //start
int retriesLeft = readRetries;
System::Threading::CancellationToken^ token = tokenSource->Token;
do {
rv = ConnectAndStatus();
retriesLeft--;
} while (rv == 1);
/*if (token->IsCancellationRequested && rv != 2) {
rv = 2;
}*/
// error 1 is connect error ?
if (retriesLeft != readRetries - 1) {
}
if (rv == 0) {
if (_EpdRead != nullptr)
_EpdRead(this, gcnew EpdEventArgs(EpdID, EPDIssued, isBG, isMK3));
_EpdRead(this, gcnew EpdEventArgs(EpdID, EPDIssued, isBG, isMK3, retriesLeft));
}
else if (rv == 2 && _EpdTO != nullptr) {
_EpdTO(this, gcnew EpdTOEventArgs(0, 0)); // epd3->ConnectTries, epd3->ConnectTimerFired));

View file

@ -41,16 +41,17 @@ namespace EpdBaseClr {
{
public:
int deviceID;
bool isIssued, isBG, isMK3;
bool isIssued, isBG, isMK3, retriesLeft;
EpdEventArgs(int epdID, bool epdIssued, bool isBG, bool isMK3) : EventArgs()
EpdEventArgs(int epdID, bool epdIssued, bool isBG, bool isMK3, int retriesleft) : EventArgs()
{
this->deviceID = epdID;
this->isIssued = epdIssued;
this->isBG = isBG;
this->isMK3 = isMK3;
this->retriesLeft = retriesleft;
}
};

View file

@ -19,17 +19,22 @@ namespace TestEpdBaseClr
private static void EpdDevice_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
{
throw new NotImplementedException();
//throw new NotImplementedException();
System.Diagnostics.Debug.WriteLine("Epd TimeOut");
}
private static void EpdDevice_EpdError(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdErrorEventArgs e)
{
throw new NotImplementedException();
System.Diagnostics.Debug.WriteLine("Epd Error");
//throw new NotImplementedException();
}
private static void EpdDevice_EpdRead(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdEventArgs e)
{
throw new NotImplementedException();
//throw new NotImplementedException();
var i = epdDevice.EpdID;
System.Diagnostics.Debug.WriteLine("EpdID: " + i.ToString());
}
static void Main(string[] args)
@ -37,7 +42,7 @@ namespace TestEpdBaseClr
init();
epdDevice.Wait(10000,2);
Console.ReadKey();
Einde();
}

Binary file not shown.

View file

@ -6,6 +6,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
using cspl = LSWLib.CLog;
namespace eDosStation
{
@ -30,7 +31,10 @@ namespace eDosStation
System.IO.Directory.CreateDirectory(fn);
}
}
catch { rv = false; }
catch (System.Exception ex) {
splunkLog.WriteException("App", "TestOrCreateFolder", ex);
rv = false;
}
return rv;
}
@ -38,6 +42,7 @@ namespace eDosStation
public string eDosPort;
public string elatecPort, elatecFirmware;
public string RFIDReader;
public cspl splunkLog;
private void Application_Startup(object sender, StartupEventArgs e)
{
@ -46,6 +51,8 @@ namespace eDosStation
//moduleHandle = LoadLibraryEx(pth2, IntPtr.Zero, 0);
//moduleHandle = LoadLibraryEx(pth1, IntPtr.Zero, 0);
splunkLog = new cspl(Environment.MachineName, hourlyLog: true);
using (var h = new LSWDevices.LSWDevicesHelper())
{
eDosPort = h.eDosPort;
@ -60,7 +67,17 @@ namespace eDosStation
private void Application_Exit(object sender, ExitEventArgs e)
{
Environment.Exit(0);
splunkLog.KvClear();
splunkLog?.CloseSplunkLog();
Application.Current.Shutdown();
//try
//{
// Environment.Exit(0);
//}
//catch
//{
//}
}
}
}

View file

@ -2,6 +2,8 @@
using System;
using System.Data;
using System.Data.SqlClient;
using Telerik.Windows.Controls.GridView;
using cspl = LSWLib.CLog;
namespace eDosStation
{
@ -14,7 +16,7 @@ namespace eDosStation
public System.IO.StreamWriter stationLog;
public SqlConnection localConnection, centralConnection;
internal CLog splunkLog;
internal cspl splunkLog;
public System.Data.SqlClient.SqlCommand VisitInitCommand, VisitInfoCommand, VisitInitConfirmCommand;
public static SqlCommand VisitExitCommand;
public static SqlCommand NextIDCommand;
@ -140,8 +142,7 @@ namespace eDosStation
bool rv = checkCon(true);
MakeCommands();
if (localConnection.State == ConnectionState.Open)localConnection.Close();
splunkLog?.WriteSplunkLog(moduleName, taskName, CLog.iseverity.info);
}
catch (Exception ex)
{
@ -149,10 +150,12 @@ namespace eDosStation
System.Windows.MessageBox.Show($"Init error {ex.Message} con={currentConStr}");
stationLog.WriteLine($"Init error {ex.Message} con={currentConStr}");
}
stationLog?.WriteLine($"Datainterface.Init end {tnow()}");
//stationLog?.WriteLine($"Datainterface.Init end {tnow()}");
}
public DataInterface()
public DataInterface( cspl spl )
{
splunkLog = spl;
init();
}

View file

@ -5,7 +5,9 @@ using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Resources;
using System.Windows.Threading;
namespace eDosStation
@ -55,14 +57,18 @@ namespace eDosStation
}
private void Ep_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
{
string ermsg = "TIME OUT";
thisStation.splunkLog?.WriteSplunkLog("EntryBadge.Ep_EpdTO", null, LSWLib.CLog.iseverity.warning, lresultMessage: ermsg);
EntryState = eEntryState.epdtimeout;
System.Diagnostics.Debug.WriteLine("TIME OUT");
System.Diagnostics.Debug.WriteLine(ermsg);
Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
}
private void Ep_EpdError(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdErrorEventArgs e)
{
string ermsg = $"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}";
thisStation.splunkLog?.WriteSplunkLog("EntryBadge.Ep_EpdError", null, LSWLib.CLog.iseverity.err, lresultMessage: ermsg);
EntryState = eEntryState.epdError;
System.Diagnostics.Debug.WriteLine("ERROR ");
System.Diagnostics.Debug.WriteLine(ermsg);
Dispatcher.InvokeAsync(() => {
MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}");
Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
@ -328,7 +334,7 @@ namespace eDosStation
float gain = 100.0F;
float ChirpRate = 0F;
if (!CurTaskRow.IsFNGain_ANGainValueNull()) gain = (int)CurTaskRow.FNGain_ANGainValue;
if (!CurTaskRow.IsFNGain_ANGainValueNull()) gain = (float)CurTaskRow.FNGain_ANGainValue;
if (!CurTaskRow.IsChirpRateNull()) ChirpRate = (int)CurTaskRow.ChirpRate;
//doing stuff on EPD

View file

@ -183,16 +183,17 @@ namespace eDosStation
try
{
dataInterface = new DataInterface();
thisStation = new Station(dataInterface, string.Empty, curApp);
dataInterface.splunkLog = thisStation.splunkLog;
dataInterface = new DataInterface(curApp.splunkLog);
thisStation = new Station(dataInterface, string.Empty, curApp, curApp.splunkLog);
//dataInterface.splunkLog = thisStation.splunkLog;
}
catch (System.Exception ex)
{
curApp.splunkLog?.WriteException(className, "Window_Loaded", ex);
errMsg = $"Startup error {ex.Message} ";
MessageBox.Show(errMsg);
ok = false;
dataInterface.stationLog?.WriteLine($"Window_Loaded {ex.Message}");
//dataInterface.stationLog?.WriteLine($"Window_Loaded {ex.Message}");
}
if (ok && thisStation.Error > 0)
@ -266,14 +267,16 @@ namespace eDosStation
{
bgTimer?.Stop();
dataInterface.stationLog?.Close();
thisStation.splunkLog.KvClear();
thisStation.splunkLog?.CloseSplunkLog();
Application.Current.Shutdown();
try
{
Environment.Exit(0);
}
catch { }
//thisStation.splunkLog.KvClear();
//thisStation.splunkLog?.CloseSplunkLog();
//Application.Current.Shutdown();
//try
//{
// Environment.Exit(0);
//}
//catch { }
Close();
}
private void mReverseSync_Click(object sender, RoutedEventArgs e)

View file

@ -8,11 +8,11 @@ using System.Windows;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("eDosStation")]
[assembly: AssemblyDescription("MK2/MK3 epd station 2025 Isabelle Majkowski, Luc Praet, Luc Vandenbroucke, Karel Janssen")]
[assembly: AssemblyDescription("MK2/MK3 epd station 2026 Isabelle Majkowski, Luc Praet, Luc Vandenbroucke, Karel Janssen")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SCK CEN")]
[assembly: AssemblyProduct("eDosStation")]
[assembly: AssemblyCopyright("Copyright © 2019-2025 Luc Vandenbroucke, Karel Janssen")]
[assembly: AssemblyCopyright("Copyright © 2019-2026 Luc Vandenbroucke, Karel Janssen")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -70,5 +70,6 @@ using System.Windows;
//2.41 Maximized exit en Dose screen (Karel)
//2.42 User Info screen (kiosk)
//2.43 User Info screen + button EPD off
[assembly: AssemblyVersion("2.43.0.0")]
[assembly: AssemblyFileVersion("2.43.0.0")]
//2025-01-07 2.50 MK3 neutron
[assembly: AssemblyVersion("2.50.0.0")]
[assembly: AssemblyFileVersion("2.50.0.0")]

View file

@ -1 +1 @@
Wed 08/27/2025 15:14:29.82
Wed 01/07/2026 14:14:27.32

View file

@ -123,7 +123,7 @@ namespace eDosStation
if (ep.isNG) {
lNGain.Visibility = NGain.Visibility = Visibility.Visible;
NGain.Text = ep.NGgain.ToString();
NGain.Text = ep.NGgain.ToString("#.##");
} else {
lNGain.Visibility = NGain.Visibility = Visibility.Hidden;
}

View file

@ -80,12 +80,13 @@ namespace eDosStation
return beepMk3Map[useBeep];
else return beepMk3Map[0b00011010];
}
public Station(DataInterface mDataInterface, string Station, App curApp)
public Station(DataInterface mDataInterface, string Station, App curApp, spl1 spl)
{
const string module = "StationInit";
string step = null;
ReceivedPersid = null;
splunkLog = new spl1(Environment.MachineName,hourlyLog:true);
splunkLog = spl; // new spl1(Environment.MachineName,hourlyLog:true);
stationLog = null;
dataInterface = mDataInterface;
Error = 0;

View file

@ -91,8 +91,8 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="LSWLib, Version=4.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LSWLib2.4.1.2\lib\net48\LSWLib.dll</HintPath>
<Reference Include="LSWLib, Version=4.2.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LSWLib2.4.2.5\lib\net48\LSWLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />

View file

@ -2,7 +2,7 @@
<packages>
<package id="LSWDesfirePublic" version="1.3.9" targetFramework="net48" />
<package id="LSWDevicesLib" version="1.0.1" targetFramework="net48" />
<package id="LSWLib2" version="4.1.2" targetFramework="net48" />
<package id="LSWLib2" version="4.2.5" targetFramework="net48" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net48" developmentDependency="true" />
<package id="SharpDX" version="4.2.0" targetFramework="net48" />
<package id="SharpDX.D3DCompiler" version="4.2.0" targetFramework="net48" />

View file

@ -1,12 +1,12 @@
pause "eDosStation to Sqlsrv7 "
set src="D:\l\src\cs2024\eDosStation\eDosStation\bin\Release"
set src="D:\l\src\cs2025\eDosStation\eDosStation\bin\Release"
set C="%cd:"=%\eDosStation\bin\release"
if /I %src%==%C% (echo "Path OK ") else (echo "Path issue !")
Pause was ok ?
set dst="\\sqlsrv7\c$\Soft\eDos2023"
set dst="\\sqlsrv7\c$\Soft\eDos2026"
::set zip="eDosStation.tar"
::tar -cf %zip% -C %src% --exclude *.zip *.*
@ -16,7 +16,7 @@ set zip="eDosStation.zip"
xcopy %zip% %dst% /i /h /R /y
set src="D:\l\src\cs2024\eDosStation\eDosLocal"
set src="D:\l\src\cs2025\eDosStation\eDosLocal"
xcopy "%src:"=%\UpdateLocal.sql" %dst% /i /h /R /y

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LSWLib2" version="4.1.2" targetFramework="net48" />
<package id="LSWLib2" version="4.2.5" targetFramework="net48" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.50" targetFramework="net48" developmentDependency="true" />
</packages>

View file

@ -38,8 +38,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="LSWLib, Version=4.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LSWLib2.4.1.2\lib\net48\LSWLib.dll</HintPath>
<Reference Include="LSWLib, Version=4.2.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LSWLib2.4.2.5\lib\net48\LSWLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />