mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 13:08:13 +08:00
解決了好多警告。。。。
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include "httpd_priv.h"
|
#include "httpd_priv.h"
|
||||||
#include "app_httpd.h"
|
#include "app_httpd.h"
|
||||||
#include "user_gpio.h"
|
#include "user_gpio.h"
|
||||||
|
#include "user_wifi.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
@@ -70,12 +71,12 @@ static int http_get_socket_status(httpd_request_t *req)
|
|||||||
{
|
{
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
|
|
||||||
char* status = get_socket_status();
|
const unsigned char* status = get_socket_status();
|
||||||
|
|
||||||
err = httpd_send_all_header(req, HTTP_RES_200, strlen(status), HTTP_CONTENT_HTML_STR);
|
err = httpd_send_all_header(req, HTTP_RES_200, strlen(socket_status), HTTP_CONTENT_HTML_STR);
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
||||||
|
|
||||||
err = httpd_send_body(req->sock, socket_status, strlen(status));
|
err = httpd_send_body(req->sock, status, strlen(socket_status));
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -96,10 +97,10 @@ static int http_set_socket_status(httpd_request_t *req)
|
|||||||
|
|
||||||
char* status = "OK";
|
char* status = "OK";
|
||||||
|
|
||||||
err = httpd_send_all_header(req, HTTP_RES_200, strlen(status), HTTP_CONTENT_HTML_STR);
|
err = httpd_send_all_header(req, HTTP_RES_200, strlen(socket_status), HTTP_CONTENT_HTML_STR);
|
||||||
require_noerr_action(err, save_out, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
require_noerr_action(err, save_out, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
||||||
|
|
||||||
err = httpd_send_body(req->sock, status, strlen(status));
|
err = httpd_send_body(req->sock, (const unsigned char*)status, strlen(socket_status));
|
||||||
require_noerr_action(err, save_out, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
require_noerr_action(err, save_out, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
||||||
|
|
||||||
save_out:
|
save_out:
|
||||||
@@ -111,12 +112,12 @@ static int http_get_wifi_config(httpd_request_t *req)
|
|||||||
{
|
{
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
|
|
||||||
char* status = get_socket_status();
|
const unsigned char* status = get_socket_status();
|
||||||
|
|
||||||
err = httpd_send_all_header(req, HTTP_RES_200, strlen(status), HTTP_CONTENT_HTML_STR);
|
err = httpd_send_all_header(req, HTTP_RES_200, strlen(socket_status), HTTP_CONTENT_HTML_STR);
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
||||||
|
|
||||||
err = httpd_send_body(req->sock, socket_status, strlen(status));
|
err = httpd_send_body(req->sock, status, strlen(socket_status));
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -147,10 +148,10 @@ static int http_set_wifi_config(httpd_request_t *req)
|
|||||||
|
|
||||||
char* status = "OK";
|
char* status = "OK";
|
||||||
|
|
||||||
err = httpd_send_all_header(req, HTTP_RES_200, strlen(status), HTTP_CONTENT_HTML_STR);
|
err = httpd_send_all_header(req, HTTP_RES_200, strlen(socket_status), HTTP_CONTENT_HTML_STR);
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status headers."));
|
||||||
|
|
||||||
err = httpd_send_body(req->sock, status, strlen(status));
|
err = httpd_send_body(req->sock, (const unsigned char*)status, strlen(socket_status));
|
||||||
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http socket_status body."));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -158,8 +159,8 @@ exit:
|
|||||||
|
|
||||||
save_out:
|
save_out:
|
||||||
if (buf) free(buf);
|
if (buf) free(buf);
|
||||||
if (ssid_size) free(ssid_size);
|
if (wifi_ssid) free(wifi_ssid);
|
||||||
if (key_size) free(key_size);
|
if (wifi_key) free(wifi_key);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ static uint32_t offset = 0;
|
|||||||
|
|
||||||
static OSStatus onReceivedData(struct _HTTPHeader_t * httpHeader,
|
static OSStatus onReceivedData(struct _HTTPHeader_t * httpHeader,
|
||||||
uint32_t pos,
|
uint32_t pos,
|
||||||
char *data,
|
uint8_t *data,
|
||||||
size_t len,
|
size_t len,
|
||||||
void * userContext);
|
void * userContext);
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ static void ota_server_progress_set(OTA_STATE_E state)
|
|||||||
|
|
||||||
progress =(float) ota_server_context->download_state.download_begin_pos / ota_server_context->download_state.download_len;
|
progress =(float) ota_server_context->download_state.download_begin_pos / ota_server_context->download_state.download_len;
|
||||||
progress = progress*100;
|
progress = progress*100;
|
||||||
if( ota_server_context->ota_server_cb != NULL)
|
if(ota_server_context->ota_server_cb != NULL)
|
||||||
ota_server_context->ota_server_cb(state, progress);
|
ota_server_context->ota_server_cb(state, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ DELETE:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*one request may receive multi reply*/
|
/*one request may receive multi reply*/
|
||||||
static OSStatus onReceivedData(struct _HTTPHeader_t * inHeader, uint32_t inPos, char * inData,
|
static OSStatus onReceivedData(struct _HTTPHeader_t * inHeader, uint32_t inPos, uint8_t * inData,
|
||||||
size_t inLen, void * inUserContext)
|
size_t inLen, void * inUserContext)
|
||||||
{
|
{
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
@@ -373,7 +373,7 @@ static OSStatus onReceivedData(struct _HTTPHeader_t * inHeader, uint32_t inPos,
|
|||||||
Md5Update(&md5, inData, inLen);
|
Md5Update(&md5, inData, inLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
MicoFlashWrite(MICO_PARTITION_OTA_TEMP, &offset, (char *) inData, inLen);
|
MicoFlashWrite(MICO_PARTITION_OTA_TEMP, &offset, inData, inLen);
|
||||||
|
|
||||||
ota_server_progress_set(OTA_LOADING);
|
ota_server_progress_set(OTA_LOADING);
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void user_function_cmd_received(int udp_flag, char* pusrdata)
|
|||||||
//<2F><>ʼ<EFBFBD><CABC>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><>ʼ<EFBFBD><CABC>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
if ((p_name && cJSON_IsString(p_name) && strcmp(p_name->valuestring, sys_config->micoSystemConfig.name) == 0) //name
|
if ((p_name && cJSON_IsString(p_name) && strcmp(p_name->valuestring, sys_config->micoSystemConfig.name) == 0) //name
|
||||||
|| (p_mac && cJSON_IsString(p_mac) && strcmp(p_mac->valuestring, strMac) == 0) //mac
|
|| (p_mac && cJSON_IsString(p_mac) && strcmp(p_mac->valuestring, strMac) == 0) //mac
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
cJSON *json_send = cJSON_CreateObject();
|
cJSON *json_send = cJSON_CreateObject();
|
||||||
cJSON_AddStringToObject(json_send, "mac", strMac);
|
cJSON_AddStringToObject(json_send, "mac", strMac);
|
||||||
@@ -103,11 +103,11 @@ void user_function_cmd_received(int udp_flag, char* pusrdata)
|
|||||||
char *temp_buf = malloc(16);
|
char *temp_buf = malloc(16);
|
||||||
if (temp_buf != NULL)
|
if (temp_buf != NULL)
|
||||||
{
|
{
|
||||||
sprintf(temp_buf, "%d.%d", power / 10, power % 10);
|
sprintf(temp_buf, "%d.%d", (int)(power/10), (int)(power%10));
|
||||||
cJSON_AddStringToObject(json_send, "power", temp_buf);
|
cJSON_AddStringToObject(json_send, "power", temp_buf);
|
||||||
free(temp_buf);
|
free(temp_buf);
|
||||||
}
|
}
|
||||||
os_log("power:%d",power);
|
os_log("power:%d", (int)power);
|
||||||
}
|
}
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>setting-----------------------------------------------------------------
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>setting-----------------------------------------------------------------
|
||||||
cJSON *p_setting = cJSON_GetObjectItem(pJsonRoot, "setting");
|
cJSON *p_setting = cJSON_GetObjectItem(pJsonRoot, "setting");
|
||||||
@@ -311,7 +311,7 @@ bool json_plug_task_analysis(unsigned char x, unsigned char y, cJSON * pJsonRoot
|
|||||||
&& cJSON_IsNumber(p_plug_task_repeat)
|
&& cJSON_IsNumber(p_plug_task_repeat)
|
||||||
&& cJSON_IsNumber(p_plug_task_action)
|
&& cJSON_IsNumber(p_plug_task_action)
|
||||||
&& cJSON_IsNumber(p_plug_task_on)
|
&& cJSON_IsNumber(p_plug_task_on)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return_flag = true;
|
return_flag = true;
|
||||||
user_config->plug[x].task[y].hour = p_plug_task_hour->valueint;
|
user_config->plug[x].task[y].hour = p_plug_task_hour->valueint;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void user_led_set(char x)
|
|||||||
|
|
||||||
bool relay_out(void)
|
bool relay_out(void)
|
||||||
{
|
{
|
||||||
unsigned char i;
|
int i;
|
||||||
for (i = 0; i < PLUG_NUM; i++)
|
for (i = 0; i < PLUG_NUM; i++)
|
||||||
{
|
{
|
||||||
if (user_config->plug[i].on != 0)
|
if (user_config->plug[i].on != 0)
|
||||||
@@ -31,16 +31,16 @@ bool relay_out(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_socket_status()
|
const unsigned char* get_socket_status()
|
||||||
{
|
{
|
||||||
sprintf(socket_status, "%d,%d,%d,%d,%d,%d\0",
|
sprintf(socket_status, "%d,%d,%d,%d,%d,%d",
|
||||||
user_config->plug[0].on,
|
user_config->plug[0].on,
|
||||||
user_config->plug[1].on,
|
user_config->plug[1].on,
|
||||||
user_config->plug[2].on,
|
user_config->plug[2].on,
|
||||||
user_config->plug[3].on,
|
user_config->plug[3].on,
|
||||||
user_config->plug[4].on,
|
user_config->plug[4].on,
|
||||||
user_config->plug[5].on);
|
user_config->plug[5].on);
|
||||||
return socket_status;
|
return (const unsigned char*)socket_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_socket_status(char* socket_status)
|
void set_socket_status(char* socket_status)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ void key_init(void);
|
|||||||
void user_relay_set(unsigned char x,unsigned char y);
|
void user_relay_set(unsigned char x,unsigned char y);
|
||||||
void user_relay_set_all(char y);
|
void user_relay_set_all(char y);
|
||||||
bool relay_out(void);
|
bool relay_out(void);
|
||||||
char* get_socket_status();
|
const unsigned char* get_socket_status();
|
||||||
|
void set_socket_status(char* socket_status);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ Client c; // mqtt client object
|
|||||||
Network n; // socket network for mqtt client
|
Network n; // socket network for mqtt client
|
||||||
|
|
||||||
static mico_worker_thread_t mqtt_client_worker_thread; /* Worker thread to manage send/recv events */
|
static mico_worker_thread_t mqtt_client_worker_thread; /* Worker thread to manage send/recv events */
|
||||||
static mico_timed_event_t mqtt_client_send_event;
|
//static mico_timed_event_t mqtt_client_send_event;
|
||||||
|
|
||||||
char topic_state[MAX_MQTT_TOPIC_SIZE];
|
char topic_state[MAX_MQTT_TOPIC_SIZE];
|
||||||
char topic_set[MAX_MQTT_TOPIC_SIZE];
|
char topic_set[MAX_MQTT_TOPIC_SIZE];
|
||||||
@@ -264,7 +264,7 @@ void mqtt_client_thread(mico_thread_arg_t arg)
|
|||||||
{
|
{
|
||||||
OSStatus err = kUnknownErr;
|
OSStatus err = kUnknownErr;
|
||||||
|
|
||||||
int i, rc = -1;
|
int rc = -1;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
struct timeval t = { 0, MQTT_YIELD_TMIE * 1000 };
|
struct timeval t = { 0, MQTT_YIELD_TMIE * 1000 };
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ void mqtt_client_thread(mico_thread_arg_t arg)
|
|||||||
|
|
||||||
// send message to server
|
// send message to server
|
||||||
err = mqtt_msg_publish(&c, p_send_msg->topic, p_send_msg->qos, p_send_msg->retained,
|
err = mqtt_msg_publish(&c, p_send_msg->topic, p_send_msg->qos, p_send_msg->retained,
|
||||||
p_send_msg->data,
|
(const unsigned char*)p_send_msg->data,
|
||||||
p_send_msg->datalen);
|
p_send_msg->datalen);
|
||||||
|
|
||||||
require_noerr_string(err, MQTT_reconnect, "ERROR: MQTT publish data err");
|
require_noerr_string(err, MQTT_reconnect, "ERROR: MQTT publish data err");
|
||||||
@@ -513,8 +513,8 @@ OSStatus user_mqtt_send_plug_state(char plug_id)
|
|||||||
topic_buf = malloc(64); //
|
topic_buf = malloc(64); //
|
||||||
if (send_buf != NULL && topic_buf != NULL)
|
if (send_buf != NULL && topic_buf != NULL)
|
||||||
{
|
{
|
||||||
sprintf(topic_buf, "homeassistant/switch/%s/plug_%d/state", strMac, plug_id);
|
sprintf(topic_buf, "homeassistant/switch/%s/plug_%d/state", strMac, (int)plug_id);
|
||||||
sprintf(send_buf, "{\"mac\":\"%s\",\"plug_%d\":{\"on\":%d}}", strMac, plug_id, user_config->plug[plug_id].on);
|
sprintf(send_buf, "{\"mac\":\"%s\",\"plug_%d\":{\"on\":%d}}", strMac, plug_id, (int)user_config->plug[(int)plug_id].on);
|
||||||
user_mqtt_send_topic(topic_buf, send_buf, 1);
|
user_mqtt_send_topic(topic_buf, send_buf, 1);
|
||||||
}
|
}
|
||||||
if (send_buf) free(send_buf);
|
if (send_buf) free(send_buf);
|
||||||
@@ -524,7 +524,6 @@ OSStatus user_mqtt_send_plug_state(char plug_id)
|
|||||||
//hass mqtt自动发现数据开关发送
|
//hass mqtt自动发现数据开关发送
|
||||||
void user_mqtt_hass_auto(char plug_id)
|
void user_mqtt_hass_auto(char plug_id)
|
||||||
{
|
{
|
||||||
char i;
|
|
||||||
char *send_buf = NULL;
|
char *send_buf = NULL;
|
||||||
char *topic_buf = NULL;
|
char *topic_buf = NULL;
|
||||||
send_buf = malloc(512); //
|
send_buf = malloc(512); //
|
||||||
@@ -538,7 +537,7 @@ void user_mqtt_hass_auto(char plug_id)
|
|||||||
"\"cmd_t\":\"device/ztc1/set\","
|
"\"cmd_t\":\"device/ztc1/set\","
|
||||||
"\"pl_on\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":1}}\","
|
"\"pl_on\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":1}}\","
|
||||||
"\"pl_off\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":0}}\""
|
"\"pl_off\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":0}}\""
|
||||||
"}\0",
|
"}",
|
||||||
plug_id, strMac + 8, strMac, plug_id, strMac, plug_id, strMac, plug_id);
|
plug_id, strMac + 8, strMac, plug_id, strMac, plug_id, strMac, plug_id);
|
||||||
user_mqtt_send_topic(topic_buf, send_buf, 1);
|
user_mqtt_send_topic(topic_buf, send_buf, 1);
|
||||||
}
|
}
|
||||||
@@ -561,8 +560,8 @@ void user_mqtt_hass_auto_name(char plug_id)
|
|||||||
"\"cmd_t\":\"device/ztc1/set\","
|
"\"cmd_t\":\"device/ztc1/set\","
|
||||||
"\"pl_on\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":1}}\","
|
"\"pl_on\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":1}}\","
|
||||||
"\"pl_off\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":0}}\""
|
"\"pl_off\":\"{\\\"mac\\\":\\\"%s\\\",\\\"plug_%d\\\":{\\\"on\\\":0}}\""
|
||||||
"}\0",
|
"}",
|
||||||
user_config->plug[plug_id].name, strMac, plug_id, strMac, plug_id, strMac, plug_id);
|
user_config->plug[(int)plug_id].name, strMac, plug_id, strMac, plug_id, strMac, plug_id);
|
||||||
user_mqtt_send_topic(topic_buf, send_buf, 0);
|
user_mqtt_send_topic(topic_buf, send_buf, 0);
|
||||||
}
|
}
|
||||||
if (send_buf)
|
if (send_buf)
|
||||||
@@ -573,7 +572,6 @@ void user_mqtt_hass_auto_name(char plug_id)
|
|||||||
//hass mqtt自动发现数据功率发送
|
//hass mqtt自动发现数据功率发送
|
||||||
void user_mqtt_hass_auto_power(void)
|
void user_mqtt_hass_auto_power(void)
|
||||||
{
|
{
|
||||||
char i;
|
|
||||||
char *send_buf = NULL;
|
char *send_buf = NULL;
|
||||||
char *topic_buf = NULL;
|
char *topic_buf = NULL;
|
||||||
send_buf = malloc(512); //
|
send_buf = malloc(512); //
|
||||||
@@ -628,7 +626,6 @@ void user_mqtt_hass_auto_power_name(void)
|
|||||||
|
|
||||||
void user_mqtt_hass_power(void)
|
void user_mqtt_hass_power(void)
|
||||||
{
|
{
|
||||||
char i;
|
|
||||||
char *send_buf = NULL;
|
char *send_buf = NULL;
|
||||||
char *topic_buf = NULL;
|
char *topic_buf = NULL;
|
||||||
send_buf = malloc(512); //
|
send_buf = malloc(512); //
|
||||||
@@ -636,7 +633,7 @@ void user_mqtt_hass_power(void)
|
|||||||
if (send_buf != NULL && topic_buf != NULL)
|
if (send_buf != NULL && topic_buf != NULL)
|
||||||
{
|
{
|
||||||
sprintf(topic_buf, "homeassistant/sensor/%s/power/state", strMac);
|
sprintf(topic_buf, "homeassistant/sensor/%s/power/state", strMac);
|
||||||
sprintf(send_buf, "{\"power\":\"%d.%d\"}", power / 10, power % 10);
|
sprintf(send_buf, "{\"power\":\"%d.%d\"}", (int)(power/10), (int)(power%10));
|
||||||
user_mqtt_send_topic(topic_buf, send_buf, 0);
|
user_mqtt_send_topic(topic_buf, send_buf, 0);
|
||||||
}
|
}
|
||||||
if (send_buf) free(send_buf);
|
if (send_buf) free(send_buf);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void rtc_thread(mico_thread_arg_t arg)
|
|||||||
|
|
||||||
|
|
||||||
mico_utc_time_t utc_time;
|
mico_utc_time_t utc_time;
|
||||||
mico_utc_time_t utc_time_last;
|
mico_utc_time_t utc_time_last = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{ //<2F>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wifi<66>ſ<EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>
|
{ //<2F>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wifi<66>ſ<EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||||
micoWlanGetLinkStatus(&LinkStatus);
|
micoWlanGetLinkStatus(&LinkStatus);
|
||||||
@@ -184,11 +184,11 @@ void rtc_thread(mico_thread_arg_t arg)
|
|||||||
{
|
{
|
||||||
|
|
||||||
char repeat = user_config->plug[i].task[j].repeat;
|
char repeat = user_config->plug[i].task[j].repeat;
|
||||||
if ( //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>̵<EFBFBD><CCB5><EFBFBD>״̬: <20><>Ϊ0 ʱ<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>趨ֵ, <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨ֵ
|
if ( //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>̵<EFBFBD><CCB5><EFBFBD>״̬: <20><>Ϊ0 ʱ<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>趨ֵ, <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨ֵ
|
||||||
rtc_time.sec == 0 && rtc_time.min == user_config->plug[i].task[j].minute
|
rtc_time.sec == 0 && rtc_time.min == user_config->plug[i].task[j].minute
|
||||||
&& rtc_time.hr == user_config->plug[i].task[j].hour
|
&& rtc_time.hr == user_config->plug[i].task[j].hour
|
||||||
&& ((repeat == 0x00) || repeat & (1 << (rtc_time.weekday - 1)))
|
&& ((repeat == 0x00) || repeat & (1 << (rtc_time.weekday - 1)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (user_config->plug[i].on != user_config->plug[i].task[j].action)
|
if (user_config->plug[i].on != user_config->plug[i].task[j].action)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
//#include "user_gpio.h"
|
//#include "user_gpio.h"
|
||||||
#include "user_sntp.h"
|
#include "user_sntp.h"
|
||||||
|
#include "sntp.h"
|
||||||
|
|
||||||
/* Callback function when MiCO UTC time in sync to NTP server */
|
/* Callback function when MiCO UTC time in sync to NTP server */
|
||||||
static void sntp_time_call_back(void)
|
static void sntp_time_call_back(void)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void udp_thread(void *arg)
|
|||||||
require_string(p_send_msg, exit, "Wrong data point");
|
require_string(p_send_msg, exit, "Wrong data point");
|
||||||
|
|
||||||
// send message to server
|
// send message to server
|
||||||
err = udp_msg_send(udp_fd, p_send_msg->data, p_send_msg->datalen);
|
err = udp_msg_send(udp_fd, (const unsigned char*)p_send_msg->data, p_send_msg->datalen);
|
||||||
// require_noerr_string(err, MQTT_reconnect, "ERROR: udp publish data err");
|
// require_noerr_string(err, MQTT_reconnect, "ERROR: udp publish data err");
|
||||||
|
|
||||||
os_log("udp send data success! msg=[%ld].\r\n", p_send_msg->datalen);
|
os_log("udp send data success! msg=[%ld].\r\n", p_send_msg->datalen);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ extern char wifi_status;
|
|||||||
extern void wifi_init(void);
|
extern void wifi_init(void);
|
||||||
extern void ap_init(void);
|
extern void ap_init(void);
|
||||||
extern void wifi_start_easylink(void);
|
extern void wifi_start_easylink(void);
|
||||||
|
extern void wifi_connect(char* wifi_ssid, char* wifi_key);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user