mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 14:08:19 +08:00
修改了Web后台的部分界面,增加了HAmqtt中的总电量传感器,后台新增mqtt上报频率设置
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
#include "http_server/web_log.h"
|
||||
|
||||
#include "mico.h"
|
||||
#include "ota_server/ota_server.h"
|
||||
#include "main.h"
|
||||
#include "mqtt_server/user_mqtt_client.h"
|
||||
|
||||
float ota_progress = -2;
|
||||
|
||||
static void OtaServerStatusHandler(OTA_STATE_E state, float progress)
|
||||
{
|
||||
char str[64] = { 0 };
|
||||
switch (state)
|
||||
{
|
||||
case OTA_LOADING:
|
||||
ota_progress = 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;
|
||||
ota_log("ota server daemons success");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":100}", str_mac);
|
||||
break;
|
||||
case OTA_FAIL:
|
||||
ota_log("ota server daemons failed");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":-1}", str_mac);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UserOtaStart(char *url, char *md5)
|
||||
{
|
||||
ota_progress = 0;
|
||||
ota_log("ready to ota:%s",url);
|
||||
OtaServerStart(url, md5, OtaServerStatusHandler);
|
||||
}
|
||||
|
||||
#include "http_server/web_log.h"
|
||||
|
||||
#include "mico.h"
|
||||
#include "ota_server/ota_server.h"
|
||||
#include "main.h"
|
||||
#include "mqtt_server/user_mqtt_client.h"
|
||||
|
||||
float ota_progress = -2;
|
||||
|
||||
static void OtaServerStatusHandler(OTA_STATE_E state, float progress)
|
||||
{
|
||||
char str[64] = { 0 };
|
||||
switch (state)
|
||||
{
|
||||
case OTA_LOADING:
|
||||
ota_progress = 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;
|
||||
ota_log("ota server daemons success");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":100}", str_mac);
|
||||
break;
|
||||
case OTA_FAIL:
|
||||
ota_log("ota server daemons failed");
|
||||
sprintf(str, "{\"mac\":\"%s\",\"ota_progress\":-1}", str_mac);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UserOtaStart(char *url, char *md5)
|
||||
{
|
||||
ota_progress = 0;
|
||||
ota_log("ready to ota:%s",url);
|
||||
OtaServerStart(url, md5, OtaServerStatusHandler);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user