Skip to content

Commit 73b49ea

Browse files
authored
Merge pull request #736 from ViezeVingertjes/t1000e-low-power
Introduce BLE low-power mode and enable DC/DC converter
2 parents f6f0cfd + 5370667 commit 73b49ea

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/helpers/nrf52/SerialBLEInterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ void SerialBLEInterface::begin(const char* device_name, uint32_t pin_code) {
2727

2828
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
2929
Bluefruit.configPrphConn(250, BLE_GAP_EVENT_LENGTH_MIN, 16, 16); // increase MTU
30+
Bluefruit.setTxPower(BLE_TX_POWER);
3031
Bluefruit.begin();
31-
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
3232
Bluefruit.setName(device_name);
3333

3434
Bluefruit.Security.setMITM(true);
@@ -80,7 +80,7 @@ void SerialBLEInterface::startAdv() {
8080
* https://developer.apple.com/library/content/qa/qa1931/_index.html
8181
*/
8282
Bluefruit.Advertising.restartOnDisconnect(false); // don't restart automatically as we handle it in onDisconnect
83-
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
83+
Bluefruit.Advertising.setInterval(32, 1600);
8484
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
8585
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
8686

src/helpers/nrf52/SerialBLEInterface.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
#include "../BaseSerialInterface.h"
44
#include <bluefruit.h>
55

6+
#ifndef BLE_TX_POWER
7+
#define BLE_TX_POWER 4
8+
#endif
9+
610
class SerialBLEInterface : public BaseSerialInterface {
711
BLEUart bleuart;
812
bool _isEnabled;

variants/t1000-e/T1000eBoard.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ void T1000eBoard::begin() {
1111

1212
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
1313

14+
// Enable DC/DC converter for improved power efficiency
15+
NRF_POWER->DCDCEN = 1;
16+
1417
#ifdef BUTTON_PIN
1518
pinMode(BATTERY_PIN, INPUT);
1619
pinMode(BUTTON_PIN, INPUT);

variants/t1000-e/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ build_flags = ${t1000-e.build_flags}
9494
-D MAX_CONTACTS=350
9595
-D MAX_GROUP_CHANNELS=40
9696
-D BLE_PIN_CODE=123456
97+
-D BLE_TX_POWER=0
9798
; -D BLE_DEBUG_LOGGING=1
9899
; -D MESH_PACKET_LOGGING=1
99100
; -D MESH_DEBUG=1

0 commit comments

Comments
 (0)