合并提交

This commit is contained in:
zogodo
2019-09-16 01:45:13 +08:00
parent 3065ffe5c7
commit a4bba1ffb3
17 changed files with 709 additions and 772 deletions

View File

@@ -31,35 +31,70 @@ bool relay_out( void )
return false;
}
char* get_socket_status()
{
sprintf(socket_status, "%d,%d,%d,%d,%d,%d\0",
user_config->plug[0].on,
user_config->plug[1].on,
user_config->plug[2].on,
user_config->plug[3].on,
user_config->plug[4].on,
user_config->plug[5].on);
return socket_status;
}
void set_socket_status(char* socket_status)
{
int ons[6] = { 0 };
sscanf(socket_status, "%d,%d,%d,%d,%d,%d,",
&ons[0], &ons[1], &ons[2], &ons[3], &ons[4], &ons[5]);
int i = 0;
for (i = 0; i < PLUG_NUM; i++)
{
user_relay_set(i, ons[i]);
}
}
/*user_relay_set
* <20><><EFBFBD>ü̵<C3BC><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* x:<3A><><EFBFBD><EFBFBD> 0-5
* y:<3A><><EFBFBD><EFBFBD> 0:<3A><> 1:<3A><>
* i:<3A><><EFBFBD><EFBFBD> 0-5
* on:<3A><><EFBFBD><EFBFBD> 0:<3A><> 1:<3A><>
*/
void user_relay_set(unsigned char x,unsigned char y )
void user_relay_set(unsigned char i, unsigned char on)
{
if (x >= PLUG_NUM ) return;
if (i >= PLUG_NUM) return;
if((y == 1) ? Relay_ON : Relay_OFF) MicoGpioOutputHigh( relay[x] );else MicoGpioOutputLow( relay[x] );
user_config->plug[x].on = y;
if ( relay_out( ) )
user_led_set( 1 );
if (on == Relay_ON)
{
MicoGpioOutputHigh(relay[i]);
}
else
user_led_set( 0 );
{
MicoGpioOutputLow(relay[i]);
}
user_config->plug[i].on = on;
if (relay_out())
{
user_led_set(1);
}
else
{
user_led_set(0);
}
}
/*
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м̵<D0BC><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* y:0:ȫ<><C8AB><EFBFBD><EFBFBD> 1:<3A><><EFBFBD>ݼ<EFBFBD>¼״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* y: 0:ȫ<><C8AB><EFBFBD><EFBFBD> 1:ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
*/
void user_relay_set_all( char y )
{
char i;
for ( i = 0; i < PLUG_NUM; i++ )
user_relay_set( i, y );
int i;
for (i = 0; i < PLUG_NUM; i++)
user_relay_set(i, y);
}
static void key_long_press( void )