小孔按键重置
This commit is contained in:
parent
4b9c92e02d
commit
082568f6de
|
@ -279,7 +279,7 @@ void IOK027X::Union(Pin pin1, Pin pin2)
|
|||
Pin p[] = { pin1,pin2 };
|
||||
for (size_t i = 0; i < 2; i++)
|
||||
{
|
||||
if(p[i]==P0) continue;
|
||||
if (p[i] == P0) continue;
|
||||
|
||||
auto port = new InputPort(p[i]);
|
||||
port->Invert = true;
|
||||
|
@ -291,8 +291,22 @@ void IOK027X::Union(Pin pin1, Pin pin2)
|
|||
}
|
||||
}
|
||||
|
||||
static bool ledstat2 = false;
|
||||
static void RestPress(InputPort& port, bool down)
|
||||
{
|
||||
if (down) return;
|
||||
auto client = IOK027X::Current;
|
||||
client->Restore();
|
||||
}
|
||||
void IOK027X::SetRestore(Pin pin)
|
||||
{
|
||||
if (pin == P0) return;
|
||||
auto port = new InputPort(pin);
|
||||
port->Open();
|
||||
port->Press = RestPress;
|
||||
RestPort = port;
|
||||
}
|
||||
|
||||
static bool ledstat2 = false;
|
||||
void IOK027X::Restore()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
@ -304,7 +318,6 @@ void IOK027X::Restore()
|
|||
if (Client) Client->Reset("按键重置");
|
||||
|
||||
}
|
||||
|
||||
void IOK027X::FlushLed()
|
||||
{
|
||||
if (LedsShow == 0) // 启动时候20秒
|
||||
|
|
|
@ -29,16 +29,16 @@ public:
|
|||
|
||||
void* InitData(void* data, int size);
|
||||
void Register(int index, IDataPort& dp);
|
||||
|
||||
void SetRestore(Pin pin = PB4); //设置重置引脚
|
||||
void InitLeds();
|
||||
void FlushLed(); // 刷新led状态输出
|
||||
|
||||
byte LedStat(byte showmode);
|
||||
|
||||
ISocketHost* Create8266(Pin power=PB2);
|
||||
ISocketHost* Create8266(Pin power = PB2);
|
||||
|
||||
void InitClient();
|
||||
void InitNet(Pin power=PB2);
|
||||
void InitNet(Pin power = PB2);
|
||||
void InitAlarm();
|
||||
//双联开关
|
||||
void Union(Pin pin1, Pin pin2);
|
||||
|
@ -50,6 +50,7 @@ public:
|
|||
private:
|
||||
void* Data;
|
||||
int Size;
|
||||
InputPort* RestPort;
|
||||
|
||||
void OpenClient(ISocketHost& host);
|
||||
TokenController* AddControl(ISocketHost& host, const NetUri& uri, ushort localPort);
|
||||
|
|
Loading…
Reference in New Issue