This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to make advertising timeout variable

I want nrf51822 to switch between 2 different advertising timeout. One will set advertising timeout with 20s, another will keep advertising.

Currently, I use following code to set advertising timeout. It can't be changed.

"#define APP_ADV_TIMEOUT_IN_SECONDS 20 "

And I try to change APP_ADV_TIMEOUT_IN_SECONDS with a variable parameter. Like:

"uint32_t APP_ADV_TIMEOUT_IN_SECONDS=20"

But it fails. (Didn't run to main() )

Please help me to solve this problem or any other idea? Thank you.

Parents
  • of course it's possible to make the advertising timeout a variable. Personally I wouldn't name it the same as the old #define because that's just asking for trouble, but a trivial modification like this should take all of 5 seconds. It's really impossible to even start to guess what you might be doing wrong, do you have any C coding experience?

Reply
  • of course it's possible to make the advertising timeout a variable. Personally I wouldn't name it the same as the old #define because that's just asking for trouble, but a trivial modification like this should take all of 5 seconds. It's really impossible to even start to guess what you might be doing wrong, do you have any C coding experience?

Children
No Data
Related