Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the advertisement interval after reboot? #8

Closed
svenhaitjema opened this issue Nov 18, 2014 · 3 comments
Closed

Setting the advertisement interval after reboot? #8

svenhaitjema opened this issue Nov 18, 2014 · 3 comments

Comments

@svenhaitjema
Copy link

Hi all,

I'm trying to set up a low power consumption beacon with the following code:

1 T= 3200
2 CONFIG POWER, 1
3 BTPOKE LIM_DISC_ADV_INT_MIN, T
4 BTPOKE LIM_DISC_ADV_INT_MAX, T
5 BTPOKE GEN_DISC_ADV_INT_MIN, T
6 BTPOKE GEN_DISC_ADV_INT_MAX, T
7 PINMODE P0(4) INPUT PULLDOWN
10 // "A Simple iBeacon service"
20 DIM M(5)
30 // "Major (0-65535), Minor (0-65535), Power"
40 M = 0x00, 0x02, 0x00, 0x04, 0xC8
90 ADVERT GENERAL
100 ADVERT CUSTOM "FF 4C 00 02 15" "74 27 8B DA B6 44 45 20 8F 0C 72 0E AF 05 99 35" M
110 ADVERT END
120 // SET A NAME IN THE SCAN RESPONSE
130 SCAN NAME "iBeacon"
140 SCAN END
150 AUTORUN ON

The problem i'm having is that the part of the code that sets the advertisement interval (line 1 to 6) does not work after a reboot or battery swap. The ibeacon advertisement settings are set up properly as does the led, so the script must have run on boot.

The advertisement interval lines do work when connecting and then typing RUN in the console. On another device, I check the advertisements, and they come in every 2 seconds. The strange thing is though, if I disconnect the console, the advertisements stop. The only way to make the device visible again is taking out the battery, and reinsert it. Unfortunately, the advertisement interval is then back to the fast mode it boots up with.

I think the issue all boils down to: how to make the advertisement interval non volatile?

@aanon4
Copy link
Owner

aanon4 commented Nov 19, 2014

Well this is very odd and not what I've experienced. I have noticed that the device will startup beaconing like a crazy thing when power is applied, and then after a minute or so, go into the low beaconing state as specified by the BTPOKE calls. Similarly, connecting then disconnecting seems to put it in this state. What I find particularly odd is that your device goes completely silent after disconnect.

A couple of things to try. First, remove line 2 which is really only for my own boards (and I should remove it from the example). Difficult to imagine how this effects your board, but you never know. Second, can you tell me a bit about the hardware you're using?

@svenhaitjema
Copy link
Author

Dear Tim,

I'm very sorry to waste your time. Indeed after a minute the device does what it is supposed to do.

The invisibility seems to be related to improper disconnect on the Android console. After updating the App the issue seems non-existent (although not extensively tested). My Hardware is a bare hm-10.

Thank you!

@aanon4
Copy link
Owner

aanon4 commented Nov 20, 2014

No worries. Glad you work it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants