2014-01-19 00:37:40 +01:00
|
|
|
#ifndef OVERCURRENTPROT_H_
|
|
|
|
#define OVERCURRENTPROT_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include "cmd.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define CURRENT_SHUTDOWN 5
|
|
|
|
#define CURRENT_ON 0
|
|
|
|
#define CURRENT_OFF 1
|
|
|
|
#define CURRENT_INTERRUPT 0
|
|
|
|
|
2014-03-16 17:35:10 +01:00
|
|
|
const unsigned long TURN_ON_DELAY = 5000; // ms
|
2014-01-19 00:37:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
class OverCurrentProt;
|
|
|
|
|
|
|
|
class OverCurrentProtCmd : public Cmd {
|
|
|
|
public:
|
|
|
|
OverCurrentProtCmd(OverCurrentProt *overCurrentProt);
|
|
|
|
virtual String getCmdName() { return "OCPC"; }
|
|
|
|
virtual String getHelp() { return "OCP cnt"; }
|
|
|
|
virtual String exec(String params);
|
|
|
|
private:
|
|
|
|
OverCurrentProt *m_overCurrentProt;
|
|
|
|
};
|
|
|
|
|
|
|
|
class OverCurrentResetCmd : public Cmd {
|
|
|
|
public:
|
|
|
|
OverCurrentResetCmd(OverCurrentProt *overCurrentProt);
|
|
|
|
virtual String getCmdName() { return "OCRST"; }
|
|
|
|
virtual String getHelp() { return "OCP rst"; }
|
|
|
|
virtual String exec(String params);
|
|
|
|
private:
|
|
|
|
OverCurrentProt *m_overCurrentProt;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OverCurrentProt {
|
|
|
|
public:
|
|
|
|
OverCurrentProt();
|
|
|
|
void begin(CmdServer *cmdServer);
|
|
|
|
void exec();
|
|
|
|
uint32_t getEventCnt() { return m_eventCnt; };
|
|
|
|
void resetEventCnt() { m_eventCnt = 0; };
|
|
|
|
private:
|
|
|
|
OverCurrentProtCmd m_overCurrentProtCmd;
|
|
|
|
OverCurrentResetCmd m_overCurrentResetCmd;
|
|
|
|
uint32_t m_eventCnt;
|
|
|
|
unsigned long m_timestamp;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* OVERCURRENTPROT_H_ */
|