修改当前温度为WO,并编写需求规格书
This commit is contained in:
@@ -70,7 +70,7 @@ void userHandle(void)
|
||||
// gDevData.mode = read_sensor(); /* DP3 模式 */
|
||||
// gDevData.min_temp = 23.5f; /* DP4 最低温度 (float, scale=0.1), 直接填物理量 */
|
||||
// gDevData.max_temp = 23.5f; /* DP5 最高温度 (float, scale=0.1), 直接填物理量 */
|
||||
// gDevData.current_temp = 23.5f; /* DP6 当前温度 (float, scale=0.1), 直接填物理量 */
|
||||
/* DP6 current_temp 为 WO:不下发采集、不上报;只在 jbEventProcess 收服务器写入 */
|
||||
// gDevData.linkage_delete = read_sensor(); /* DP7 联动删除 */
|
||||
// memcpy(gDevData.linkage_config, sensor_read(), 20); /* DP8 联动配置 */
|
||||
// gDevData.time_en = read_sensor(); /* DP9 定时使能 */
|
||||
@@ -162,6 +162,12 @@ int8_t jbEventProcess(jb_event_info_t *info, jb_data_point_t *ctrl)
|
||||
// TODO: 根据 ctrl->max_temp 执行动作 (已是浮点物理量)
|
||||
break;
|
||||
|
||||
/* ── DP6 当前温度 (float, WO, scale=0.1) ── */
|
||||
case DP_ID_CURRENT_TEMP:
|
||||
gDevData.current_temp = ctrl->current_temp;
|
||||
/* 业务:转调 app_* 更新联动用温度;禁止在本文件写开停算法 */
|
||||
break;
|
||||
|
||||
/* ── DP7 联动删除 (bool) ── */
|
||||
case DP_ID_LINKAGE_DELETE:
|
||||
if (ctrl->linkage_delete)
|
||||
|
||||
@@ -197,14 +197,7 @@ static uint16_t jbPackDps(const jb_data_point_t *dp,
|
||||
jbWriteU16BE(&out[valIdx], (uint16_t)_raw);
|
||||
valIdx += 2;
|
||||
}
|
||||
/* DP6 当前温度 (float, 2B, RO (float, scale=0.1)) */
|
||||
if (mask[DP_ID_CURRENT_TEMP / 8] & (1 << (DP_ID_CURRENT_TEMP % 8)))
|
||||
{
|
||||
bitmap[DP_ID_CURRENT_TEMP / 8] |= (1 << (DP_ID_CURRENT_TEMP % 8));
|
||||
int16_t _raw = (int16_t)(dp->current_temp * 10.0f);
|
||||
jbWriteU16BE(&out[valIdx], (uint16_t)_raw);
|
||||
valIdx += 2;
|
||||
}
|
||||
/* DP6 当前温度:WO,不上报,不打包 */
|
||||
/* DP7 联动删除 (bool, 1B, RW) */
|
||||
if (mask[DP_ID_LINKAGE_DELETE / 8] & (1 << (DP_ID_LINKAGE_DELETE % 8)))
|
||||
{
|
||||
@@ -420,6 +413,20 @@ static void jbUnpackDps(const uint8_t *bitmap, const uint8_t *values,
|
||||
info->dp_ids[info->count++] = DP_ID_MAX_TEMP;
|
||||
}
|
||||
}
|
||||
/* DP6 当前温度 (float, 2B, WO (float, scale=0.1)) */
|
||||
if (bitmap[DP_ID_CURRENT_TEMP / 8] & (1 << (DP_ID_CURRENT_TEMP % 8)))
|
||||
{
|
||||
if (valIdx + 2 <= valLen)
|
||||
{
|
||||
int16_t _raw = (int16_t)jbReadU16BE(&values[valIdx]);
|
||||
dp->current_temp = (float)_raw * 0.1f;
|
||||
valIdx += 2;
|
||||
}
|
||||
if (info && info->count < DP_ID_MAX)
|
||||
{
|
||||
info->dp_ids[info->count++] = DP_ID_CURRENT_TEMP;
|
||||
}
|
||||
}
|
||||
/* DP7 联动删除 (bool, 1B, RW) */
|
||||
if (bitmap[DP_ID_LINKAGE_DELETE / 8] & (1 << (DP_ID_LINKAGE_DELETE % 8)))
|
||||
{
|
||||
@@ -684,12 +691,7 @@ static uint8_t jbBuildDiffMask(const jb_data_point_t *last,
|
||||
mask[DP_ID_MAX_TEMP / 8] |= (1 << (DP_ID_MAX_TEMP % 8));
|
||||
hasChange = 1;
|
||||
}
|
||||
/* DP6 当前温度 */
|
||||
if ((int16_t)(last->current_temp * 10.0f) != (int16_t)(cur->current_temp * 10.0f))
|
||||
{
|
||||
mask[DP_ID_CURRENT_TEMP / 8] |= (1 << (DP_ID_CURRENT_TEMP % 8));
|
||||
hasChange = 1;
|
||||
}
|
||||
/* DP6 当前温度:WO,变化不上报 */
|
||||
/* DP7 联动删除 */
|
||||
if (last->linkage_delete != cur->linkage_delete)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* ════════════════════════════════════════════════════════════════ */
|
||||
#define PKT_HEAD_0 0x55
|
||||
#define PKT_HEAD_1 0xAA
|
||||
#define MAX_PACKAGE_LEN 128
|
||||
#define MAX_PACKAGE_LEN 256
|
||||
#define JB_OTA_MAX_PAYLOAD 96 /* OTA 单包 Payload 上限(Byte); 须 <= MAX_PACKAGE_LEN - 11(0x32 帧开销) */
|
||||
|
||||
#define DP_COUNT 27
|
||||
@@ -124,7 +124,7 @@ typedef enum
|
||||
DP_ID_MODE = 3, /* 模式 (enum, RW) */
|
||||
DP_ID_MIN_TEMP = 4, /* 最低温度 (float, RW) */
|
||||
DP_ID_MAX_TEMP = 5, /* 最高温度 (float, RW) */
|
||||
DP_ID_CURRENT_TEMP = 6, /* 当前温度 (float, RO) */
|
||||
DP_ID_CURRENT_TEMP = 6, /* 当前温度 (float, WO) */
|
||||
DP_ID_LINKAGE_DELETE = 7, /* 联动删除 (bool, RW) */
|
||||
DP_ID_LINKAGE_CONFIG = 8, /* 联动配置 (raw, RW) */
|
||||
DP_ID_TIME_EN = 9, /* 定时使能 (bool, RW) */
|
||||
@@ -190,7 +190,7 @@ typedef struct
|
||||
uint8_t mode; /* DP3 模式 */
|
||||
float min_temp; /* DP4 最低温度 (float, scale=0.1) */
|
||||
float max_temp; /* DP5 最高温度 (float, scale=0.1) */
|
||||
float current_temp; /* DP6 当前温度 (float, scale=0.1) */
|
||||
float current_temp; /* DP6 当前温度 (float, scale=0.1, WO) */
|
||||
uint8_t linkage_delete;/* DP7 联动删除 */
|
||||
uint8_t linkage_config[20];/* DP8 联动配置 */
|
||||
uint8_t time_en; /* DP9 定时使能 */
|
||||
|
||||
Reference in New Issue
Block a user