Merge pull request #736 from ViezeVingertjes/t1000e-low-power
Introduce BLE low-power mode and enable DC/DC converter
This commit is contained in:
@@ -27,8 +27,8 @@ void SerialBLEInterface::begin(const char* device_name, uint32_t pin_code) {
|
|||||||
|
|
||||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||||
Bluefruit.configPrphConn(250, BLE_GAP_EVENT_LENGTH_MIN, 16, 16); // increase MTU
|
Bluefruit.configPrphConn(250, BLE_GAP_EVENT_LENGTH_MIN, 16, 16); // increase MTU
|
||||||
|
Bluefruit.setTxPower(BLE_TX_POWER);
|
||||||
Bluefruit.begin();
|
Bluefruit.begin();
|
||||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
|
||||||
Bluefruit.setName(device_name);
|
Bluefruit.setName(device_name);
|
||||||
|
|
||||||
Bluefruit.Security.setMITM(true);
|
Bluefruit.Security.setMITM(true);
|
||||||
@@ -80,7 +80,7 @@ void SerialBLEInterface::startAdv() {
|
|||||||
* https://developer.apple.com/library/content/qa/qa1931/_index.html
|
* https://developer.apple.com/library/content/qa/qa1931/_index.html
|
||||||
*/
|
*/
|
||||||
Bluefruit.Advertising.restartOnDisconnect(false); // don't restart automatically as we handle it in onDisconnect
|
Bluefruit.Advertising.restartOnDisconnect(false); // don't restart automatically as we handle it in onDisconnect
|
||||||
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
|
Bluefruit.Advertising.setInterval(32, 1600);
|
||||||
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
||||||
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
#include "../BaseSerialInterface.h"
|
#include "../BaseSerialInterface.h"
|
||||||
#include <bluefruit.h>
|
#include <bluefruit.h>
|
||||||
|
|
||||||
|
#ifndef BLE_TX_POWER
|
||||||
|
#define BLE_TX_POWER 4
|
||||||
|
#endif
|
||||||
|
|
||||||
class SerialBLEInterface : public BaseSerialInterface {
|
class SerialBLEInterface : public BaseSerialInterface {
|
||||||
BLEUart bleuart;
|
BLEUart bleuart;
|
||||||
bool _isEnabled;
|
bool _isEnabled;
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ void T1000eBoard::begin() {
|
|||||||
|
|
||||||
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
|
sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
|
||||||
|
|
||||||
|
// Enable DC/DC converter for improved power efficiency
|
||||||
|
NRF_POWER->DCDCEN = 1;
|
||||||
|
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
pinMode(BUTTON_PIN, INPUT);
|
pinMode(BUTTON_PIN, INPUT);
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ build_flags = ${t1000-e.build_flags}
|
|||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
|
-D BLE_TX_POWER=0
|
||||||
; -D BLE_DEBUG_LOGGING=1
|
; -D BLE_DEBUG_LOGGING=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
|
|||||||
Reference in New Issue
Block a user