Thread 中讨论的其他器件:SysConfig、 Z-stack
您好!
我将从项目 ZR_SW 开始。 我添加了 OMROM D6T-8L 温度传感器的代码、我将其用作占位传感器。 我创建了一个子菜单选项、希望在其中查看当前的温度、因此当我在该子菜单中时、我可以看到温度更新本身显示在 CUI 中。
在 zcl_sampleapps_ui.c 中、我创建了名为 uiActionSetSensorPrestencia 的函数。 我调用 readSensor、它会获取温度。 然后我调用 check乘员、如果它检测到一个人、它返回"1"、如果没有、它返回"0"。
这就是我要做的:
1.当我进入此子菜单时,我希望在第一行显示温度,直到我离开此子菜单。 此时、当我进入该子菜单时、我只会看到一次温度值。
在读取温度值并检查是否有人占用时、如果检测到"有人占用"、我想切换灯。 我不应该在这里使用"zclGeneral_SendOnOff_CmdTog"、但我不知道如何执行它。
我尝试添加 while 循环、但它不像这样工作。
谢谢你。
static void uiActionSetSensorPresencia(const char _input, char* _pLines[3], CUI_cursorInfo_t* _pCurInfo);
CUI_MENU_ITEM_INT_ACTION("< READ SENSOR >", (CUI_pFnIntercept_t) uiActionSetSensorPresencia)
static void uiActionSetSensorPresencia(const char _input, char* _pLines[3], CUI_cursorInfo_t* _pCurInfo)
{
if (CUI_ITEM_INTERCEPT_START == _input) {
char tmpPtat[8] = ""; char tmp1[8] = ""; char tmpInt[8] = "";
zstack_getZCLFrameCounterRsp_t Rsp;
//Zstackapi_getZCLFrameCounterReq(appServiceTaskId, &Rsp);
char tmpEntera[8] = ".";char tmpDouble[8];
double *value = readSensor();
int occupied = checkOccupancy();
if (occupied == 1) {
strcpy(tmpInt, "OCUPADO");
} else {
strcpy(tmpInt, "NO_OCUP");
}
doubleToString(value[0], tmpPtat, tmpEntera, tmpDouble);
doubleToString(value[1], tmp1, tmpEntera, tmpDouble);
strncpy(_pLines[0], "Mostrando valores:", MAX_MENU_LINE_LEN);
strncpy(_pLines[1], value[0], MAX_MENU_LINE_LEN);
strncpy(_pLines[2], tmpInt, MAX_MENU_LINE_LEN);
if (occupied == 1) {
zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &listBulbs[FBBulbsFound-1], TRUE, Rsp.zclFrameCounter );
}
}
}








