Skip to content

Commit

Permalink
Misc pre-release touch-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
psychogenic committed Jun 21, 2019
1 parent ed008c2 commit f646c67
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 26 deletions.
3 changes: 2 additions & 1 deletion src/NRF52BLESerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ void NRF52BLESerial::end() {
}

int NRF52BLESerial::available(void) {
fillRXFromBLESerial();
poll();
// fillRXFromBLESerial();
return rx_buf.getOccupied();
}

Expand Down
25 changes: 13 additions & 12 deletions src/SerialUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ void SerialUI::setGreeting(StaticString greets)
Globals::state()->setGreeting(greets);
}

void SerialUI::setName(DynamicString sysbroadcastName) {
#ifdef SERIALUI_PLATFORM_NRF52
SUIBLESerialDev.setLocalName(sysbroadcastName);
#endif
}

void SerialUI::setUID(StaticString u) {
Globals::state()->setUID(u);
}
Expand All @@ -68,7 +74,7 @@ char SerialUI::readTerminator() {
}

size_t SerialUI::readBytesToEOL(char* buffer, size_t max_length, bool left_trim){
#warning "TODO:FIXME readBytesToEOL"
return Globals::commChannel()->readUntilEOF(buffer, max_length);
}


Expand Down Expand Up @@ -375,23 +381,18 @@ size_t SerialUI::println(StaticString s) {
}
#endif

#warning "const char* disabled"
/*
size_t SerialUI::print(const char* p) {
// TODO:FIXME wtf??
// return comm()->print(p);
#warning "const char* disabled"
return 0;
}
*/
size_t SerialUI::print(const String& p) {

size_t SerialUI::print(DynamicString p) {

return comm()->print(p);

}

size_t SerialUI::print(const char * p) {
size_t SerialUI::print(const String& p) {
return comm()->print(p);
}


size_t SerialUI::print(char p) {
return comm()->print(p);
}
Expand Down
7 changes: 5 additions & 2 deletions src/TrackedString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ float String::toFloat(void) const {
return this->value.toFloat();
}
double String::toDouble(void) const {
#ifdef SERIALUI_PLATFORM_NRF52
#warning "no WString toDouble() on platform -- returning float instead"
return this->value.toFloat();
#warning "no WString toDouble() on some platforms"
// return this->value.toDouble();
#else
return this->value.toDouble();
#endif
}

#endif
Expand Down
4 changes: 3 additions & 1 deletion src/includes/SerialUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class SerialUI {

void setGreeting(StaticString greets);

void setName(DynamicString sysbroadcastName);

void setUID(StaticString u);
/* ****************** configuration methods ***************** */
/*
Expand Down Expand Up @@ -334,7 +336,7 @@ class SerialUI {
size_t print(StaticString s);
#endif
size_t print(const String &);
size_t print(const char *);
size_t print(DynamicString p);
size_t print(char);
size_t print(unsigned char, int = DEC);
size_t print(int, int = DEC);
Expand Down
2 changes: 1 addition & 1 deletion src/includes/SerialUIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
#define SERIALUI_AUTH_PASSPHRASE_MAXLEN 64

// #define SERIALUI_ENABLE_DEBUG_OUTPUT

// define SERIALUI_WARN_PLATFORM_DETECTION_DEBUG

#endif /* SERIALUIV3_SRC_INCLUDES_SERIALUICONFIG_H_ */
19 changes: 18 additions & 1 deletion src/includes/SerialUIPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,37 @@

#include "platform/detect/SUIPlatDetect.h"


#ifdef SERIALUI_PLATFORM_ARDUINOSTANDARD
#ifdef SERIALUI_WARN_PLATFORM_DETECTION_DEBUG
#warning "PLATFORM: Arduino standard"
#endif /* SERIALUI_WARN_PLATFORM_DETECTION_DEBUG */
#include "platform/SUIPlatArduino.h"
#define SUI_PLATDETECT_SUCCESS
#endif


#ifdef SERIALUI_PLATFORM_NRF52
#ifdef SERIALUI_WARN_PLATFORM_DETECTION_DEBUG
#warning "PLATFORM: NRF52"
#endif /* SERIALUI_WARN_PLATFORM_DETECTION_DEBUG */
#include "platform/SUIPlatNRF52Arduino.h"
#define SUI_PLATDETECT_SUCCESS
#endif


#ifdef SERIALUI_PLATFORM_LINUX
#ifdef SERIALUI_WARN_PLATFORM_DETECTION_DEBUG
#warning "PLATFORM: Linux"
#endif /* SERIALUI_WARN_PLATFORM_DETECTION_DEBUG */
#include "platform/SUIPlatLinux.h"
#define SUI_PLATDETECT_SUCCESS
#endif

#ifndef SUI_PLATDETECT_SUCCESS
#warning "SERIALUI FAIL: Could not detect platform?"
#endif


namespace SerialUI {


Expand Down
2 changes: 1 addition & 1 deletion src/includes/platform/SUIPlatArduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define SERIALUI_CHANNELS_USE_STANDARDSTREAMS

#define SERIALUI_AUTHENTICATOR_ENABLE
//define SERIALUI_AUTHENTICATOR_ENABLE

#define SUI_PLATFORM_SOURCE_HASTIMEOUT_GETTERMETHOD
#define SUI_PLATFORM_SOURCE_DEFAULT Serial
Expand Down
6 changes: 4 additions & 2 deletions src/includes/platform/SUIPlatNRF52Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#include <Arduino.h>

#include "nrf52/NRF52BLESerial.h"


#define SERIALUI_AUTHENTICATOR_ENABLE

Expand All @@ -34,6 +32,8 @@
#define SUI_PLATFORM_TIMENOW_MS() millis()
#define SUI_PLATFORM_DELAY_MS(d) delay(d)

#include "nrf52/NRF52BLESerial.h"

namespace SerialUI {

#define SUI_FLASHSTRING const __FlashStringHelper*
Expand Down Expand Up @@ -67,4 +67,6 @@ typedef NRF52BLESerial SourceType;





#endif /* SERIALUI_SRC_INCLUDES_PLATFORM_SUIPLATNRF52ARDUINO_H_ */
9 changes: 8 additions & 1 deletion src/includes/platform/detect/SUIPlatDetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
#define SERIALUI_ARCH_ESP32
#endif


#if 0
XXXXX DEADBEEF XXXX -- support Arduino primo and sandeepmistry
https://github.com/sandeepmistry/arduino-nRF5, below
// BLE Nano
#if defined(ARDUINO_RBL_nRF51822) or defined(ARDUINO_ARCH_NRF51822) or \
defined(ARDUINO_ARCH_NRF5) or defined(NRF52)
Expand All @@ -123,8 +127,10 @@
#define SERIALUI_PLATFORM_RBLNRF52
#endif /* RBL - NRF* platform */

#endif

#ifndef ARDUINO_RBL_nRF52832
#ifdef NRF52
#if defined(ARDUINO_ARCH_NRF5) or defined(NRF52) or defined(NRF51)
#ifndef SERIALUI_PLATFORM_NRF52
#define SERIALUI_PLATFORM_AUTODETECTED
#define SERIALUI_PLATFORM_NRF52
Expand Down Expand Up @@ -158,6 +164,7 @@
defined(SERIALUI_PLATFORM_WIRINGPI) \
or defined(SERIALUI_PLATFORM_RBLNRF51822) \
or defined(SERIALUI_PLATFORM_RBLNRF52) \
or defined(SERIALUI_PLATFORM_NRF52) \
or defined(SERIALUI_PLATFORM_ARDUINO_SAM) \
or defined(SERIALUI_PLATFORM_XMEGA) \
or defined(SERIALUI_PLATFORM_DIGISPARKUSB) \
Expand Down
6 changes: 2 additions & 4 deletions src/includes/platform/nrf52/NRF52BLESerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#define SERIALUI_SRC_INCLUDES_PLATFORM_NRF52_NRF52BLESERIAL_H_

#include "includes/SerialUIExtIncludes.h"

#include <BLEPeripheral.h>
#include <BLESerial.h>
#include "includes/platform/nrf52/BLESerial.h"

#include "includes/RingBuffer.h"

Expand All @@ -41,7 +39,7 @@ class NRF52BLESerial : public Stream {
virtual operator bool();

private:
BLESerial _bleser;
SUIBLESerial _bleser;
RingBuffer<uint8_t> rx_buf;
RingBuffer<uint8_t> tx_buf;
void fillRXFromBLESerial();
Expand Down

0 comments on commit f646c67

Please sign in to comment.