This commit is contained in:
hathach committed 2017-07-27 00:11:26 +07:00
1 parent 159a32bd2c
commit 2528b45480
3 files changed
+20 -3

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
#define ARDUINO_MAIN
#include "Arduino.h"
#define DBG_MEM_INFO 0
#define DBG_MEM_INFO 1
#define DBG_MEM_INFO_INTERVAL 60000
// DEBUG Level 1
@@ -730,8 +730,11 @@ void systemResetCallback()
// turns off pullup, configures everything
setPinModeCallback(i, PIN_MODE_ANALOG);
} else if (IS_PIN_DIGITAL(i)) {
// sets the output to 0, configures portConfigInputs
setPinModeCallback(i, OUTPUT);
if ( i != LED_BLUE ) // skip connection LED
{
// sets the output to 0, configures portConfigInputs
setPinModeCallback(i, OUTPUT);
}
}
servoPinMap[i] = 255;
@@ -756,12 +759,19 @@ void systemResetCallback()
void setup()
{
Serial.begin(115200);
Serial.println("Bluefruit52 Standard Firmata via BLEUART Example");
Serial.println("---------------------------\n");
Bluefruit.begin();
Bluefruit.setTxPower(4); // Maximum TX power = 4 dBm
Bluefruit.setName("Bluefruit52");
// Configure and Start BLE Uart Service
// Firmata use several small write(1) --> buffering TXD is required to run smoothly
// Enable buffering TXD
bleuart.begin();
bleuart.bufferTXD(true);
Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
@@ -826,6 +836,9 @@ void startAdv(void)
*============================================================================*/
void loop()
{
// Skip if not connected and bleuart notification is enabled
if ( !(Bluefruit.connected() && bleuart.notifyEnabled()) ) return;
byte pin, analogPin;
/* DIGITALREAD - as fast as possible, check for changes and output them to the
@@ -580,6 +580,8 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
_conn_hdl = evt->evt.gap_evt.conn_handle;
_conn_interval = para->conn_params.min_conn_interval;
LOG_LV1(GAP, "Conn Interval= %f", _conn_interval*1.25f);
// Connection interval set by Central is out of preferred range
// Try to negotiate with Central using our preferred values
if ( !is_within(_ppcp_min_conn, para->conn_params.min_conn_interval, _ppcp_max_conn) )
@@ -599,6 +601,8 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
// min conn = max conn = actual used interval
ble_gap_conn_params_t* param = &evt->evt.gap_evt.params.conn_param_update.conn_params;
_conn_interval = param->min_conn_interval;
LOG_LV1(GAP, "Conn Interval= %f", _conn_interval*1.25f);
}
break;