bugfixes for nRF examples
This commit is contained in:
parent
1500d07213
commit
888697bb79
|
@ -43,7 +43,7 @@ BLEBas blebas; // battery
|
||||||
|
|
||||||
#include <HamShield.h>
|
#include <HamShield.h>
|
||||||
// create object for radio
|
// create object for radio
|
||||||
HamShield radio(9,5,6);
|
HamShield radio(6,5,9);
|
||||||
// To use non-standard pins, use the following initialization
|
// To use non-standard pins, use the following initialization
|
||||||
//HamShield radio(ncs_pin, clk_pin, dat_pin);
|
//HamShield radio(ncs_pin, clk_pin, dat_pin);
|
||||||
|
|
||||||
|
@ -183,6 +183,7 @@ void startAdv(void)
|
||||||
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for serial output buffer on both interfaces
|
||||||
#define TEXT_BUF_LEN 64
|
#define TEXT_BUF_LEN 64
|
||||||
char text_buf[TEXT_BUF_LEN];
|
char text_buf[TEXT_BUF_LEN];
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
@ -165,7 +165,7 @@ void setup() {
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
|
|
||||||
SerialWrite(";;;;;;;;;;;;;;;;;;;;;;;;;;");
|
SerialWrite(";;;;;;;;;;;;;;;;;;;;;;;;;;\n");
|
||||||
|
|
||||||
int result = radio.testConnection();
|
int result = radio.testConnection();
|
||||||
SerialWrite("*%d;\n", result);
|
SerialWrite("*%d;\n", result);
|
||||||
|
@ -507,9 +507,9 @@ void getValue(bool ble_serial) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if((!ble_serial && Serial.available()) || (ble_serial && bleuart.available())) {
|
if((!ble_serial && Serial.available()) || (ble_serial && bleuart.available())) {
|
||||||
if (ble_serial) {
|
if (ble_serial) {
|
||||||
temp = Serial.read();
|
|
||||||
} else {
|
|
||||||
temp = bleuart.read();
|
temp = bleuart.read();
|
||||||
|
} else {
|
||||||
|
temp = Serial.read();
|
||||||
}
|
}
|
||||||
if(temp == 59) {
|
if(temp == 59) {
|
||||||
cmdbuff[p] = 0;
|
cmdbuff[p] = 0;
|
||||||
|
@ -669,7 +669,7 @@ char text_buf[TEXT_BUF_LEN];
|
||||||
void SerialWrite(const char *fmt, ...) {
|
void SerialWrite(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
int str_len = snprintf(text_buf, TEXT_BUF_LEN, fmt, args);
|
int str_len = vsnprintf(text_buf, TEXT_BUF_LEN, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
bleuart.write(text_buf, str_len);
|
bleuart.write(text_buf, str_len);
|
||||||
|
|
Loading…
Reference in New Issue