mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 04:58:17 +08:00
add:增加mqtt配置
add:device report add:增加未配置mqtt 服务器地址/端口时不尝试连接mqtt服务器 add:udp接收数据后json处理
This commit is contained in:
29
TC1/main.h
29
TC1/main.h
@@ -4,16 +4,18 @@
|
||||
#include "mico.h"
|
||||
#include "MiCOKit_EXT.h"
|
||||
|
||||
#define ZTC1_NAME "zTC1"
|
||||
#define USER_CONFIG_VERSION 1
|
||||
#define TYPE 1
|
||||
#define TYPE_NAME "zTC1"
|
||||
|
||||
#define ZTC1_NAME "zTC1_%02X%02X"
|
||||
|
||||
#define USER_CONFIG_VERSION 1
|
||||
#define SETTING_MQTT_STRING_LENGTH_MAX 32 //<2F><><EFBFBD><EFBFBD> 4 <20>ֽڶ<D6BD><DAB6>롣
|
||||
|
||||
#define PLUG_NAME_LENGTH 32
|
||||
#define PLUG_NUM 6 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLUG_TIME_TASK_NUM 5 //ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD>鶨ʱ<E9B6A8><CAB1><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
#define Led MICO_GPIO_5
|
||||
#define Button MICO_GPIO_23
|
||||
|
||||
@@ -28,10 +30,8 @@
|
||||
#define Relay_5 MICO_GPIO_18
|
||||
#define Relay_NUM PLUG_NUM
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char hour; //Сʱ
|
||||
char minute; //<2F><><EFBFBD><EFBFBD>
|
||||
uint8_t repeat; //bit7:һ<><D2BB> bit6-0:<3A><><EFBFBD><EFBFBD>-<2D><>һ
|
||||
@@ -40,7 +40,8 @@ typedef struct {
|
||||
|
||||
} user_plug_task_config_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char name[PLUG_NAME_LENGTH];
|
||||
char idx;
|
||||
user_plug_task_config_t task[PLUG_TIME_TASK_NUM];
|
||||
@@ -48,13 +49,19 @@ typedef struct {
|
||||
} user_plug_config_t;
|
||||
|
||||
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char mqtt_ip[SETTING_MQTT_STRING_LENGTH_MAX]; //mqtt service ip
|
||||
int mqtt_port; //mqtt service port
|
||||
char mqtt_user[SETTING_MQTT_STRING_LENGTH_MAX]; //mqtt service user
|
||||
char mqtt_password[SETTING_MQTT_STRING_LENGTH_MAX]; //mqtt service user
|
||||
// char mqtt_device_id[SETTING_MQTT_STRING_LENGTH_MAX]; //mqtt service user device name
|
||||
|
||||
char version;
|
||||
char idx;
|
||||
user_plug_config_t plug[PLUG_NUM];
|
||||
} user_config_t;
|
||||
|
||||
|
||||
extern char rtc_init;
|
||||
|
||||
extern char strMac[12];
|
||||
|
||||
Reference in New Issue
Block a user