Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Commit 351b1eb

Browse files
authored
Merge pull request #154 from ojousima/master
Fix fast advertising at startup
2 parents b531523 + a3625d7 commit 351b1eb

File tree

1 file changed

+10
-3
lines changed
  • ruuvi_examples/ruuvi_firmware

1 file changed

+10
-3
lines changed

ruuvi_examples/ruuvi_firmware/main.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ void change_mode(void* data, uint16_t length)
166166
tag_mode = RAWv1;
167167
app_timer_start(main_timer_id, APP_TIMER_TICKS(MAIN_LOOP_INTERVAL_RAW, RUUVITAG_APP_TIMER_PRESCALER), NULL);
168168
}
169-
bluetooth_configure_advertising_interval(advertising_rates[tag_mode] + advertisement_delay);
169+
if(fast_advertising)
170+
{
171+
bluetooth_configure_advertising_interval(ADVERTISING_INTERVAL_STARTUP + advertisement_delay);
172+
}
173+
else
174+
{
175+
bluetooth_configure_advertising_interval(advertising_rates[tag_mode] + advertisement_delay);
176+
}
170177
bluetooth_apply_configuration();
171178
NRF_LOG_INFO("Updating to %d mode\r\n", (uint32_t) tag_mode);
172179
main_timer_handler(NULL);
@@ -221,7 +228,7 @@ static void store_mode(void* data, uint16_t length)
221228
*/
222229
static void reboot(void* p_context)
223230
{
224-
NRF_LOG_INFO("Rebooting\r\n")
231+
NRF_LOG_WARNING("Rebooting\r\n")
225232
NVIC_SystemReset();
226233
}
227234

@@ -387,7 +394,7 @@ static void main_sensor_task(void* p_data, uint16_t length)
387394
// Embed data into structure for parsing.
388395
parseSensorData(&data, raw_t, raw_p, raw_h, vbat, acc);
389396
NRF_LOG_DEBUG("temperature: %d, pressure: %d, humidity: %d x: %d y: %d z: %d\r\n", raw_t, raw_p, raw_h, acc[0], acc[1], acc[2]);
390-
NRF_LOG_INFO("VBAT: %d send %d \r\n", vbat, data.vbat);
397+
NRF_LOG_DEBUG("VBAT: %d send %d \r\n", vbat, data.vbat);
391398
// Prepare bytearray to broadcast.
392399
bme280_data_t environmental;
393400
environmental.temperature = raw_t;

0 commit comments

Comments
 (0)