小孔按键重置

This commit is contained in:
cdy 2017-01-09 14:51:48 +08:00
parent 4b9c92e02d
commit 082568f6de
2 changed files with 22 additions and 8 deletions

View File

@ -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秒

View File

@ -13,7 +13,7 @@
class IOK027X
{
public:
List<Pin> LedPins;
List<Pin> LedPins;
List<OutputPort*> Leds;
byte LedsShow; // LED 显示状态开关 0 刚启动时候的20秒 1 使能 2 失能
@ -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);