删除一些注释

This commit is contained in:
zogodo
2019-10-09 18:29:41 +08:00
parent 509eb8b812
commit d688ba99fa
5 changed files with 18 additions and 68 deletions

View File

@@ -74,13 +74,6 @@ int application_start(void)
uint32_t power_last = 0xffffffff; uint32_t power_last = 0xffffffff;
OSStatus err = kNoErr; OSStatus err = kNoErr;
// for (i = 0; i < Relay_NUM; i++)
// {
// MicoGpioOutputLow(Relay[(i)]);
// MicoGpioInitialize(Relay[i], OUTPUT_PUSH_PULL);
// MicoGpioOutputLow(Relay[(i)]);
// MicoGpioOutputHigh(Relay[i]);
// }
/* Create mico system context and read application's config data from flash */ /* Create mico system context and read application's config data from flash */
sys_config = mico_system_context_init(sizeof(user_config_t)); sys_config = mico_system_context_init(sizeof(user_config_t));
user_config = ((system_context_t*)sys_config)->user_config_data; user_config = ((system_context_t*)sys_config)->user_config_data;
@@ -132,19 +125,7 @@ int application_start(void)
os_log("mqtt_port:%d",user_config->mqtt_port); os_log("mqtt_port:%d",user_config->mqtt_port);
os_log("mqtt_user:%s",user_config->mqtt_user); os_log("mqtt_user:%s",user_config->mqtt_user);
os_log("mqtt_password:%s",user_config->mqtt_password); os_log("mqtt_password:%s",user_config->mqtt_password);
os_log("version:%d",user_config->version); os_log("version:%d",user_config->version);
// for (i = 0; i < SOCKET_NUM; i++)
// {
// os_log("socket_%d:",i);
// os_log("\tname:%s:",user_config->socket[i].name);
// for (j = 0; j < SOCKET_TIME_TASK_NUM; j++)
// {
// os_log("\t\ton:%d\t %02d:%02d repeat:0x%X",user_config->socket[i].task[j].on,
// user_config->socket[i].task[j].hour,user_config->socket[i].task[j].minute,
// user_config->socket[i].task[j].repeat);
// }
// }
StationInit(); StationInit();
if (sys_config->micoSystemConfig.reserved != NOTIFY_STATION_UP) if (sys_config->micoSystemConfig.reserved != NOTIFY_STATION_UP)

View File

@@ -56,11 +56,9 @@ void user_function_cmd_received(int udp_flag, char* pusrdata)
cJSON_AddStringToObject(pRoot, "ip", para.ip); cJSON_AddStringToObject(pRoot, "ip", para.ip);
char *s = cJSON_Print(pRoot); char *s = cJSON_Print(pRoot);
// os_log("pRoot: %s\r\n", s);
user_send(udp_flag, s); //发送数据 user_send(udp_flag, s); //发送数据
free((void *) s); free((void *) s);
cJSON_Delete(pRoot); cJSON_Delete(pRoot);
// cJSON_Delete(p_cmd);
} }
//以下为解析命令部分 //以下为解析命令部分
@@ -76,7 +74,6 @@ void user_function_cmd_received(int udp_flag, char* pusrdata)
cJSON_AddStringToObject(json_send, "mac", strMac); cJSON_AddStringToObject(json_send, "mac", strMac);
//解析重启命令 //解析重启命令
// cJSON *p_cmd = cJSON_GetObjectItem(pJsonRoot, "name");
if(p_cmd && cJSON_IsString(p_cmd) && strcmp(p_cmd->valuestring, "restart") == 0) if(p_cmd && cJSON_IsString(p_cmd) && strcmp(p_cmd->valuestring, "restart") == 0)
{ {
os_log("cmd:restart"); os_log("cmd:restart");
@@ -192,7 +189,6 @@ void user_function_cmd_received(int udp_flag, char* pusrdata)
if (return_flag == true) if (return_flag == true)
{ {
char *json_str = cJSON_Print(json_send); char *json_str = cJSON_Print(json_send);
// os_log("pRoot: %s\r\n", json_str);
user_send(udp_flag, json_str); //发送数据 user_send(udp_flag, json_str); //发送数据
free((void *) json_str); free((void *) json_str);
} }
@@ -270,8 +266,6 @@ bool json_socket_analysis(int udp_flag, unsigned char x, cJSON * pJsonRoot, cJSO
cJSON_AddItemToObject(json_socket_send, "setting", json_socket_setting_send); cJSON_AddItemToObject(json_socket_send, "setting", json_socket_setting_send);
} }
} }
// cJSON *p_nvalue = cJSON_GetObjectItem(pJsonRoot, "nvalue");
// if (p_socket || p_nvalue)
cJSON_AddNumberToObject(json_socket_send, "on", user_config->socket[x].on); cJSON_AddNumberToObject(json_socket_send, "on", user_config->socket[x].on);
cJSON_AddItemToObject(pJsonSend, socket_str, json_socket_send); cJSON_AddItemToObject(pJsonSend, socket_str, json_socket_send);
@@ -310,8 +304,7 @@ bool json_socket_task_analysis(unsigned char x, unsigned char y, cJSON * pJsonRo
&& cJSON_IsNumber(p_socket_task_minute) && cJSON_IsNumber(p_socket_task_minute)
&& cJSON_IsNumber(p_socket_task_repeat) && cJSON_IsNumber(p_socket_task_repeat)
&& cJSON_IsNumber(p_socket_task_action) && cJSON_IsNumber(p_socket_task_action)
&& cJSON_IsNumber(p_socket_task_on) && cJSON_IsNumber(p_socket_task_on))
)
{ {
return_flag = true; return_flag = true;
user_config->socket[x].task[y].hour = p_socket_task_hour->valueint; user_config->socket[x].task[y].hour = p_socket_task_hour->valueint;
@@ -335,21 +328,27 @@ bool json_socket_task_analysis(unsigned char x, unsigned char y, cJSON * pJsonRo
unsigned char strtohex(char a, char b) unsigned char strtohex(char a, char b)
{ {
if (a >= 0x30 && a <= 0x39) if (a >= 0x30 && a <= 0x39)
{
a -= 0x30; a -= 0x30;
}
else if (a >= 0x41 && a <= 0x46) else if (a >= 0x41 && a <= 0x46)
{ {
a = a + 10 - 0x41; a = a + 10 - 0x41;
} else if (a >= 0x61 && a <= 0x66) }
else if (a >= 0x61 && a <= 0x66)
{ {
a = a + 10 - 0x61; a = a + 10 - 0x61;
} }
if (b >= 0x30 && b <= 0x39) if (b >= 0x30 && b <= 0x39)
{
b -= 0x30; b -= 0x30;
}
else if (b >= 0x41 && b <= 0x46) else if (b >= 0x41 && b <= 0x46)
{ {
b = b + 10 - 0x41; b = b + 10 - 0x41;
} else if (b >= 0x61 && b <= 0x66) }
else if (b >= 0x61 && b <= 0x66)
{ {
b = b + 10 - 0x61; b = b + 10 - 0x61;
} }

View File

@@ -107,14 +107,6 @@ static void KeyLongPress(void)
static void KeyLong10sPress(void) static void KeyLong10sPress(void)
{ {
os_log("WARNGIN: user params restored!"); os_log("WARNGIN: user params restored!");
// char i = 0;
// for (i = 0; i < 3; i++)
// {
// UserLedSet(1);
// mico_rtos_thread_msleep(100);
// UserLedSet(0);
// }
//
appRestoreDefault_callback(user_config, sizeof(user_config_t)); appRestoreDefault_callback(user_config, sizeof(user_config_t));
sys_config->micoSystemConfig.ssid[0] = 0; sys_config->micoSystemConfig.ssid[0] = 0;
mico_system_context_update(mico_system_context_get()); mico_system_context_update(mico_system_context_get());
@@ -148,7 +140,6 @@ static void KeyTimeoutHandler(void* arg)
char tmp = ~(0xfe | MicoGpioInputGet(Button)); char tmp = ~(0xfe | MicoGpioInputGet(Button));
key_trigger = tmp & (tmp ^ key_continue); key_trigger = tmp & (tmp ^ key_continue);
key_continue = tmp; key_continue = tmp;
// os_log("button scan:%02x %02x",key_trigger,key_continue);
if (key_trigger != 0) key_time = 0; //新按键按下时,重新开始按键计时 if (key_trigger != 0) key_time = 0; //新按键按下时,重新开始按键计时
if (key_continue != 0) if (key_continue != 0)
{ {

View File

@@ -17,45 +17,34 @@ static uint32_t timer_irq_count = 0;
static void power_timer_handler(void* arg) static void power_timer_handler(void* arg)
{ {
// char pin_input = MicoGpioInputGet(POWER);
uint32_t timer = 0; uint32_t timer = 0;
if (timer_irq_count > 1) if (timer_irq_count > 1)
{ {
timer = (clock_count - clock_count_last); timer = (clock_count - clock_count_last);
// os_log("power_irq_handler:%09u %u %u",timer,timer_irq_count,timer_count);
if (timer_count > 3) if (timer_count > 3)
{ {
timer /= 1000; timer /= 1000;
timer += 4294967; //0xffffffff/1000; timer += 4294967; //0xffffffff/1000;
} else if (clock_count < clock_count_last) }
else if (clock_count < clock_count_last)
{ {
timer += 0xffffffff; timer += 0xffffffff;
timer /= 1000; timer /= 1000;
}else timer/=1000; }
else
{
timer /= 1000;
}
power = 17100000 * (timer_irq_count - 1) / timer; power = 17100000 * (timer_irq_count - 1) / timer;
timer_count = 0; timer_count = 0;
timer_irq_count = 0; timer_irq_count = 0;
} else }
else
{ {
timer_count++; timer_count++;
} }
// if (clock_count_last != timer_count)
// {
//// os_log("power_irq_handler:%u-%u=%u",timer_count,clock_count_last,timer);
// timer = (timer_count - clock_count_last);
// if (timer_count < clock_count_last) timer += 0xffffffff;
//
// timer = timer / 1000;
// power = 15200000 / timer;
// os_log("power_irq_handler:%u,%07u",power,timer);
// clock_count_last = timer_count;
// }
// if(timer_count==0) os_log("power_timer_handler Hight:%d",clock_count_last);
// timer_count++;
// clock_count_last=timer_count;
} }
static void power_irq_handler(void* arg) static void power_irq_handler(void* arg)

View File

@@ -69,16 +69,6 @@ OSStatus user_sntp_get_time()
mico_utc_time_ms_t utc_time_ms = (uint64_t) current_time.seconds * (uint64_t) 1000 mico_utc_time_ms_t utc_time_ms = (uint64_t) current_time.seconds * (uint64_t) 1000
+ (current_time.microseconds / 1000); + (current_time.microseconds / 1000);
mico_time_set_utc_time_ms(&utc_time_ms); mico_time_set_utc_time_ms(&utc_time_ms);
// mico_utc_time_t utc_time = utc_time_ms / 1000 + 28800; //+8:00
// struct tm * currentTime = localtime((const time_t *) &utc_time);
// rtc_time.sec = currentTime->tm_sec;
// rtc_time.min = currentTime->tm_min;
// rtc_time.hr = currentTime->tm_hour;
// rtc_time.date = currentTime->tm_mday;
// rtc_time.weekday = currentTime->tm_wday;
// rtc_time.month = currentTime->tm_mon + 1;
// rtc_time.year = (currentTime->tm_year + 1900) % 100;
// MicoRtcSetTime(&rtc_time);
} }
else else
{ {