Hi team,
Customer is trying to put the MRR_MSS_CLIInit in a new task in MRR LAB007 demo. and also create a task for getting temperature.
The code that temperature can get correct
#if 0
Task_Params_init(&taskParams);
taskParams.priority = 3;
taskParams.stackSize = 4*1024;
Task_create(MRR_MSS_CLIInit, &taskParams, NULL);
#else
MRR_MSS_CLIInit ();
#endif
Task_Params_init(&taskParams);
taskParams.priority = 3;
taskParams.stackSize = 1*1024;
Task_create(tempereature, &taskParams, NULL);
}
void tempereature()
{
int32_t errCode;
uint8_t uartbuf[50];
while(1)
{
errCode = rlRfGetTemperatureReport(RL_DEVICE_MAP_INTERNAL_BSS, &tempData);
Task_sleep(1000);
if(errCode < 0)
{
sprintf(uartbuf,"GetTemp API failed \r\n");
UART_writePolling (gMrrMSSMCB.commandUartHandle,
(uint8_t*)uartbuf,
strlen(uartbuf));
}
else
{
sprintf(uartbuf,"Temperature: %d, %d, %d, %d, %d, %d, %d, %d \r\n", tempData.tmpRx0Sens, tempData.tmpRx1Sens,
tempData.tmpRx2Sens, tempData.tmpRx3Sens,
tempData.tmpTx0Sens, tempData.tmpTx1Sens,
tempData.tmpPmSens, tempData.tmpDig0Sens);
UART_writePolling (gMrrMSSMCB.commandUartHandle,
(uint8_t*)uartbuf,
strlen(uartbuf));
}
}
}
When change the "#if 0" to "#if 1"
Then temperatue value we get using the "rlRfGetTemperatureReport" API can only refresh one time. from the second time, the temperature is a fix value.
Can you please let me know what's the issue here?
Issue code listed below, you can easily repeat this test in your side with default lab007 demo.
#if 1 Task_Params_init(&taskParams); taskParams.priority = 3; taskParams.stackSize = 4*1024; Task_create(MRR_MSS_CLIInit, &taskParams, NULL); #else MRR_MSS_CLIInit (); #endif Task_Params_init(&taskParams); taskParams.priority = 3; taskParams.stackSize = 1*1024; Task_create(tempereature, &taskParams, NULL); } void tempereature() { int32_t errCode; uint8_t uartbuf[50]; while(1) { errCode = rlRfGetTemperatureReport(RL_DEVICE_MAP_INTERNAL_BSS, &tempData); Task_sleep(1000); if(errCode < 0) { sprintf(uartbuf,"GetTemp API failed \r\n"); UART_writePolling (gMrrMSSMCB.commandUartHandle, (uint8_t*)uartbuf, strlen(uartbuf)); } else { sprintf(uartbuf,"Temperature: %d, %d, %d, %d, %d, %d, %d, %d \r\n", tempData.tmpRx0Sens, tempData.tmpRx1Sens, tempData.tmpRx2Sens, tempData.tmpRx3Sens, tempData.tmpTx0Sens, tempData.tmpTx1Sens, tempData.tmpPmSens, tempData.tmpDig0Sens); UART_writePolling (gMrrMSSMCB.commandUartHandle, (uint8_t*)uartbuf, strlen(uartbuf)); } } }
Thanks.
Wesley