47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
|
#ifndef DVT_XRAYCLASS_H
|
||
|
#define DVT_XRAYCLASS_H
|
||
|
|
||
|
|
||
|
#include "DVT_MainClass.h"
|
||
|
|
||
|
class XRay {
|
||
|
private:
|
||
|
DVT_State_t CurState;
|
||
|
int xray_time;
|
||
|
public:
|
||
|
XRay(int Time) {
|
||
|
if (Time <= XRayMaxTime && Time != 0)
|
||
|
this->xray_time = Time;
|
||
|
else
|
||
|
this->xray_time = XRayTime;
|
||
|
}
|
||
|
void Signal() {
|
||
|
if (!this->CurState.State) {
|
||
|
this->CurState.State = true;
|
||
|
this->CurState.Time = millis();
|
||
|
XRAY_SWITCH.SetState(this->CurState.State);
|
||
|
sysMSG("SYSTEM: XRAY Started");
|
||
|
}
|
||
|
}
|
||
|
void RunTime()
|
||
|
{
|
||
|
if (this->CurState.State && millis() >= this->CurState.Time + this->xray_time) {
|
||
|
this->CurState.State = false;
|
||
|
XRAY_SWITCH.SetState(this->CurState.State);
|
||
|
sysMSG("SYSTEM: XRAY Stopped");
|
||
|
}
|
||
|
}
|
||
|
void SetTime(int Time) {
|
||
|
if (Time <= XRayMaxTime && Time != 0)
|
||
|
this->xray_time = Time;
|
||
|
else
|
||
|
this->xray_time = XRayTime;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
XRay XRAY = XRay(XRayTime);
|
||
|
|
||
|
#endif
|