|
本帖最后由 海底沙 于 2017-9-30 08:49 编辑
在做一个空调项目时,发现在手机端较快更改某个数据点数据时,数据显示有反复,
如温度从28度调到22度,APP显示从28----22----27----26----22,
效果见附件(不知如何上传视频,我以附件上传,下载后去掉".pdf"可看)
修改前.avi.pdf
(3.6 MB, 下载次数: 27)
于是在gizwits_product.c中增加了一句,解决了这问题:
/**
******************
* @file gizwits_product.c
* @brief Control protocol processing, and platform-related hardware initialization
* @author Gizwits
* @date 2017-07-19
* @version V03030000
* @copyright Gizwits
*
* @note 机智云.只为智能硬件而生
* Gizwits Smart Cloud for Smart Products
* 链接|增值ֵ|开放|中立|安全|自有|自由|生态
* www.gizwits.com
*
******************/
#include <stdio.h>
#include <string.h>
#include "gizwits_product.h"
#include "driver/hal_key.h"
#include "gizwits_protocol.h"
extern gizwitsProtocol_t gizwitsProtocol;
/** User area The current device state structure */
dataPoint_t currentDataPoint;
int8_t ICACHE_FLASH_ATTR gizwitsEventProcess(eventInfo_t *info, uint8_t *data, uint32_t len)
{
uint8_t i = 0;
dataPoint_t * dataPointPtr = (dataPoint_t *)data;
moduleStatusInfo_t * wifiData = (moduleStatusInfo_t *)data;
if((NULL == info) || (NULL == data))
{
GIZWITS_LOG("!!! gizwitsEventProcess Error \n");
return -1;
}
for(i = 0; i < info->num; i++)
{
switch(info->event)
{
......
case EVENT_temp:
currentDataPoint.valuetemp= dataPointPtr->valuetemp;
GIZWITS_LOG("Evt:EVENT_temp %d\n",currentDataPoint.valuetemp);
//user handle
//目的是使下传的数据不再回传到云端,产生的后果是可能因网络原因造成设备端状态与APP端不一致
gizMemcpy((uint8_t *)&gizwitsProtocol.gizLastDataPoint, (uint8_t *)¤tDataPoint, sizeof(currentDataPoint));
break;
......
}
}
......
system_os_post(USER_TASK_PRIO_2, SIG_UPGRADE_DATA, 0);
return 0;
}
效果见下面:
修改后.avi.pdf
(2.81 MB, 下载次数: 30)
|
|