bugfixes for nRF examples

This commit is contained in:
morgan 2021-04-19 13:20:54 -04:00
parent 1500d07213
commit 888697bb79
3 changed files with 849 additions and 848 deletions

View File

@ -43,7 +43,7 @@ BLEBas blebas; // battery
#include <HamShield.h>
// create object for radio
HamShield radio(9,5,6);
HamShield radio(6,5,9);
// To use non-standard pins, use the following initialization
//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
}
// for serial output buffer on both interfaces
#define TEXT_BUF_LEN 64
char text_buf[TEXT_BUF_LEN];
void loop() {

View File

@ -165,7 +165,7 @@ void setup() {
delay(100);
SerialWrite(";;;;;;;;;;;;;;;;;;;;;;;;;;");
SerialWrite(";;;;;;;;;;;;;;;;;;;;;;;;;;\n");
int result = radio.testConnection();
SerialWrite("*%d;\n", result);
@ -507,9 +507,9 @@ void getValue(bool ble_serial) {
for(;;) {
if((!ble_serial && Serial.available()) || (ble_serial && bleuart.available())) {
if (ble_serial) {
temp = Serial.read();
} else {
temp = bleuart.read();
} else {
temp = Serial.read();
}
if(temp == 59) {
cmdbuff[p] = 0;
@ -669,7 +669,7 @@ char text_buf[TEXT_BUF_LEN];
void SerialWrite(const char *fmt, ...) {
va_list args;
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);
bleuart.write(text_buf, str_len);