无码用户重播()问题

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
12 posts / 0 new
Last post
gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
无码用户重播()问题

hi,

I wrote a new AT Command with 1wire:

否则if(user_compare_cmd(“1wire”,1,2)))
{
tm_onewire_t ow;
uint8_t port = ahtoi((char*)argument_array[0]);
uint8_t port_number = port / 10;
UINT8_T PIN_NUMBER =端口%10;
UINT8_T DS_ROM [8];
char message[8];
float temp;

TM_OneWire_Init(&OW, (GPIO_PORT)port_number, (GPIO_PIN)pin_number);
TM_OneWire_Reset(&OW);

if(tm_onewire_first(&ow)){
//Conversasion
TM_DS18B20_StartAll(&OW);
systick_wait(750000); // wait 750ms

/* Search for next devices */
{做

TM_OneWire_GetFullROM(&OW, DS_ROM);
TM_DS18B20_Read(&OW, DS_ROM, &temp);
sprintf(message, "%x%x%x%x,%0.2f",DS_ROM[4], DS_ROM[5], DS_ROM[6], DS_ROM[7],temp); // DS_ROM[0], DS_ROM[1], DS_ROM[2], DS_ROM[3],
// ARCH_PRINTF(“ATR + PRINT =%S \ R”,消息);
user_reply(消息,true);
} while (TM_OneWire_Next(&OW));
}
}

works fine but it I would like to send the values in message to peer with user_replay(message,true)
void user_reply(char * reply_string,bool成功)
{
if(!codeless_env.suppress_response)
{
if(success)
{
// Append 'OK' to response
if(strlen(reply_string)>0)
sprintf(reply_string,"%s\r\nOK",reply_string);
else
reply_string = "OK";
}
else
{
// Report 'ERROR'
sprintf(reply_string,"ERROR");
}

//如果命令源自那里,则回复BT对等体(仅当已连接)
if((codeless_env.command_route == CMD_FROM_PEER_RESP_PEER) && (ke_state_get(TASK_APP)==APP_CONNECTED))
{
send_to_peer(reply_string);
}
否则if(dodeless_env.command_route == cmd_from_local_resp_local)
{
// Reply locally via serial port
arch_puts(“\ r \n");
ARCH_PUTS(REPHANT_STRING);
arch_puts(“\ r \n");
ARCH_PRINTF_PROCESS();
}
//codeless_env.command_route = cmd_route_undefined;
}
}

我只有最后一个字符串。如果我安装了10个传感器,最后一个传感器.....

如果我取消注释//codeless_env.command_route = cmd_route_undefined;
Then I only get the first one..

Can someone helps me please to understand the problem?

Best regards
盖特

Device:
MHv_Dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2013-12-06 15:10
嗨盖特,

嗨盖特,

Please try to describe what you are trying to accomplish. Your code listing alone leaves too many unknowns :o)

具体而言,我需要了解您是否实际上尝试在本地发布命令并希望回复返回到空中的对等体。此外,我需要您尝试交换多少数据。回复字符串限制为160个字符。

/MHv

gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
好的,

好的,

I would like to send from Master to Slave:

ATr+1wire=00 to start a reading from attached sensors on the slave (in this case 10) and send ID and value over the air back to the master!
The Master should print that values over the uart2 to the terminal.

COmmand send and execute works like a charm.
but the problem is that it sends something over the air to the master but the master only printing the first with
Codeless_env.command_route = cmd_route_unded 1时间
and 10 times the last if you have
//codeless_env.command_route = CMD_ROUTE_UNDEFINED in void user_reply(char* reply_string, bool success).

And I do not understand why he is only printig out the last one on uart2.

Best regards
盖特

MHv_Dialog
Offline
Last seen:2 months 1 week ago
工作人员
加入:2013-12-06 15:10
嗨盖特,

嗨盖特,

You are breaking the flow of commands because you repeatedly use the user_reply(). When a remote AT command is received, CodeLess sets the codeless_env.command_route to CMD_FROM_PEER_RESP_PEER which ensures that the reply goes back to the command originator. As soon as the reply has ben prepared for transmission the command_route is set to CMD_ROUTE_UNDEFINED to allow for the next command to be received (via Bluetooth or UART).

In your do-while loop, instead of using user_reply(), simply record your entire response back to the peer. Then outside the loop, use user_reply() to transmit the entire string as one reply. This allows for the CodeLess commandflow to remain intact. But remember, the reply can only be about 160 characters long.

/MHv

Kevinl.
Offline
Last seen:2 weeks 5 days ago
工作人员
加入:2017-11-06 13:52
嗨盖特,

嗨盖特,

请尝试在测试前关闭睡眠模式。

此致

gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
where should I close the

where should I close the Sleep mode? in user_replay function?

Kevinl.
Offline
Last seen:2 weeks 5 days ago
工作人员
加入:2017-11-06 13:52
in user_config.h

in user_config.h

将以下变量更改为ARCH_SLEEP_OFF。
/******************************************
* Default sleep mode. Possible values are:
*
* - ARCH_SLEEP_OFF
* - ARCH_EXT_SLEEP_ON.
* - ARCH_EXT_SLEEP_OTP_COPY_ON
*
********************************************
*/
static const sleep_state_t app_default_sleep_mode = arch_sleep_off .;// ARCH_EXT_SLEEP_ON;

gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
没有变化!对不起

没有变化!对不起

gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
For me there are also some

For me there are also some questions:

I cannot print more than 231 lines in a loop of 1000 at arch_printf().

It will stops after the 231 line.

我认为这是一段时间问题检查或从广告中断?是否有一些专家与无附件可以帮助我?

PM_Dialog
Offline
Last seen:5 days 4 hours ago
工作人员
加入:2018-02-08 11:03
Hi gert186,

Hi gert186,

Your description is little bit generic, please provide me more info about it. What do you mean with “lines”? Do you mean characters? Could you please let me know if you are using any of sleep modes configuration?

Thanks, PM_Dialog

gert186
Offline
Last seen:1 year 4 months ago
加入:2016-04-21 59
No Sleep Mode is switched off

No Sleep Mode is switched off.

I print out 231 times a character but it should be 1000 :-) The character is "1"

PM_Dialog
Offline
Last seen:5 days 4 hours ago
工作人员
加入:2018-02-08 11:03
Hi gert186,

Hi gert186,

Your description is still quite generic. There are many reasons that you are not able to do that. Could you please share the code snippet that you are using?

Thanks, PM_Dialog