mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 21:18:13 +08:00
统一os_log
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "http_server/web_log.h"
|
||||
#define os_log(format, ...) do { custom_log("OTA", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0)
|
||||
|
||||
#include "mico.h"
|
||||
#include "ota_server/ota_server.h"
|
||||
@@ -15,17 +14,17 @@ static void OtaServerStatusHandler(OTA_STATE_E state, float progress)
|
||||
{
|
||||
case OTA_LOADING:
|
||||
ota_progress = progress;
|
||||
os_log("ota server is loading, progress %.2f%%", progress);
|
||||
ota_log("ota server is loading, progress %.2f%%", progress);
|
||||
if (((int) progress)%10 == 1)
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":%d}", str_mac,((int) progress));
|
||||
break;
|
||||
case OTA_SUCCE:
|
||||
ota_progress = 100;
|
||||
os_log("ota server daemons success");
|
||||
ota_log("ota server daemons success");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":100}", str_mac);
|
||||
break;
|
||||
case OTA_FAIL:
|
||||
os_log("ota server daemons failed");
|
||||
ota_log("ota server daemons failed");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":-1}", str_mac);
|
||||
break;
|
||||
default:
|
||||
@@ -36,7 +35,7 @@ static void OtaServerStatusHandler(OTA_STATE_E state, float progress)
|
||||
void UserOtaStart(char *url, char *md5)
|
||||
{
|
||||
ota_progress = 0;
|
||||
os_log("ready to ota:%s",url);
|
||||
ota_log("ready to ota:%s",url);
|
||||
OtaServerStart(url, md5, OtaServerStatusHandler);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user