Browse Source

Merge dd778e2189 into c86e63d2f5

pull/3049/merge
Liam Cottle 21 hours ago
committed by GitHub
parent
commit
936425fa00
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      examples/companion_radio/AbstractUITask.h
  2. 192
      examples/companion_radio/main.cpp
  3. 8
      examples/companion_radio/ui-new/UITask.cpp
  4. 4
      examples/companion_radio/ui-new/UITask.h
  5. 2
      examples/companion_radio/ui-orig/UITask.h
  6. 10
      examples/companion_radio/ui-tiny/UITask.cpp
  7. 4
      examples/companion_radio/ui-tiny/UITask.h
  8. 1
      src/helpers/BaseSerialInterface.h
  9. 200
      src/helpers/MultiSerialInterface.h
  10. 11
      src/helpers/ethernet/EthernetInterface.h
  11. 109
      src/helpers/ethernet/RAK13800/RAK13800EthernetInterface.cpp
  12. 27
      src/helpers/ethernet/RAK13800/RAK13800EthernetInterface.h
  13. 140
      src/helpers/ethernet/SerialEthernetInterface.cpp
  14. 23
      src/helpers/ethernet/SerialEthernetInterface.h
  15. 94
      src/helpers/ethernet/ch390/CH390EthernetInterface.cpp
  16. 30
      src/helpers/ethernet/ch390/CH390EthernetInterface.h
  17. 268
      src/helpers/nrf52/SerialEthernetInterface.cpp
  18. 1
      variants/ebyte_eora_s3/platformio.ini
  19. 1
      variants/gat562_30s_mesh_kit/platformio.ini
  20. 1
      variants/gat562_mesh_tracker_pro/platformio.ini
  21. 1
      variants/heltec_ct62/platformio.ini
  22. 1
      variants/heltec_e213/platformio.ini
  23. 1
      variants/heltec_mesh_solar/platformio.ini
  24. 2
      variants/heltec_rc32/platformio.ini
  25. 1
      variants/heltec_t096/platformio.ini
  26. 1
      variants/heltec_t1/platformio.ini
  27. 2
      variants/heltec_t114/platformio.ini
  28. 1
      variants/heltec_t190/platformio.ini
  29. 1
      variants/heltec_tower_v2/platformio.ini
  30. 1
      variants/heltec_tracker/platformio.ini
  31. 1
      variants/heltec_tracker_v2/platformio.ini
  32. 1
      variants/heltec_v2/platformio.ini
  33. 2
      variants/heltec_v3/platformio.ini
  34. 2
      variants/heltec_v4/platformio.ini
  35. 2
      variants/heltec_v4_r8/platformio.ini
  36. 1
      variants/heltec_wireless_paper/platformio.ini
  37. 2
      variants/ikoka_handheld_nrf/platformio.ini
  38. 1
      variants/ikoka_nano_nrf/platformio.ini
  39. 1
      variants/ikoka_stick_nrf/platformio.ini
  40. 1
      variants/keepteen_lt1/platformio.ini
  41. 1
      variants/lilygo_t3s3/platformio.ini
  42. 1
      variants/lilygo_t3s3_sx1276/platformio.ini
  43. 1
      variants/lilygo_tbeam_1w/platformio.ini
  44. 1
      variants/lilygo_tdeck/platformio.ini
  45. 1
      variants/lilygo_techo/platformio.ini
  46. 1
      variants/lilygo_techo_card/platformio.ini
  47. 1
      variants/lilygo_techo_lite/platformio.ini
  48. 1
      variants/lilygo_teth_elite/platformio.ini
  49. 1
      variants/lilygo_tlora_v2_1/platformio.ini
  50. 1
      variants/m5stack_unit_c6l/platformio.ini
  51. 1
      variants/mesh_pocket/platformio.ini
  52. 2
      variants/meshadventurer/platformio.ini
  53. 1
      variants/meshtiny/platformio.ini
  54. 1
      variants/minewsemi_me25ls01/platformio.ini
  55. 1
      variants/muziworks_r1_neo/platformio.ini
  56. 1
      variants/nano_g2_ultra/platformio.ini
  57. 1
      variants/nibble_screen_connect/platformio.ini
  58. 1
      variants/nibble_zero_connect/platformio.ini
  59. 1
      variants/promicro/platformio.ini
  60. 1
      variants/rak11310/platformio.ini
  61. 1
      variants/rak3112/platformio.ini
  62. 1
      variants/rak3401/platformio.ini
  63. 1
      variants/rak3x72/platformio.ini
  64. 6
      variants/rak4631/platformio.ini
  65. 1
      variants/rak_wismesh_tag/platformio.ini
  66. 1
      variants/rpi_picow/platformio.ini
  67. 1
      variants/sensecap_solar/platformio.ini
  68. 1
      variants/station_g2/platformio.ini
  69. 1
      variants/station_g3_esp32/platformio.ini
  70. 1
      variants/t1000-e/platformio.ini
  71. 1
      variants/thinknode_m1/platformio.ini
  72. 1
      variants/thinknode_m2/platformio.ini
  73. 1
      variants/thinknode_m3/platformio.ini
  74. 1
      variants/thinknode_m5/platformio.ini
  75. 1
      variants/thinknode_m6/platformio.ini
  76. 43
      variants/thinknode_m7/platformio.ini
  77. 1
      variants/thinknode_m9/platformio.ini
  78. 1
      variants/tiny_relay/platformio.ini
  79. 1
      variants/waveshare_rp2040_lora/platformio.ini
  80. 1
      variants/wio-e5-dev/platformio.ini
  81. 1
      variants/wio-e5-mini/platformio.ini
  82. 1
      variants/wio-tracker-l1/platformio.ini
  83. 1
      variants/xiao_c3/platformio.ini
  84. 1
      variants/xiao_nrf52/platformio.ini
  85. 1
      variants/xiao_rp2040/platformio.ini
  86. 1
      variants/xiao_s3/platformio.ini
  87. 1
      variants/xiao_s3_wio/platformio.ini

12
examples/companion_radio/AbstractUITask.h

@ -4,7 +4,7 @@
#include <helpers/ui/DisplayDriver.h>
#include <helpers/ui/UIScreen.h>
#include <helpers/SensorManager.h>
#include <helpers/BaseSerialInterface.h>
#include <helpers/MultiSerialInterface.h>
#include <Arduino.h>
#ifdef PIN_BUZZER
@ -25,10 +25,10 @@ enum class UIEventType {
class AbstractUITask {
protected:
mesh::MainBoard* _board;
BaseSerialInterface* _serial;
MultiSerialInterface* _interfaceManager;
bool _connected;
AbstractUITask(mesh::MainBoard* board, BaseSerialInterface* serial) : _board(board), _serial(serial) {
AbstractUITask(mesh::MainBoard* board, MultiSerialInterface* interfaceManager) : _board(board), _interfaceManager(interfaceManager) {
_connected = false;
}
@ -36,9 +36,9 @@ public:
void setHasConnection(bool connected) { _connected = connected; }
bool hasConnection() const { return _connected; }
uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); }
bool isSerialEnabled() const { return _serial->isEnabled(); }
void enableSerial() { _serial->enable(); }
void disableSerial() { _serial->disable(); }
bool isBluetoothEnabled() const { return _interfaceManager->isBluetoothEnabled(); }
void enableBluetooth() { _interfaceManager->enableBluetooth(); }
void disableBluetooth() { _interfaceManager->disableBluetooth(); }
virtual void msgRead(int msgcount) = 0;
virtual void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) = 0;
virtual void notify(UIEventType t = UIEventType::none) = 0;

192
examples/companion_radio/main.cpp

@ -12,6 +12,59 @@ static uint32_t _atoi(const char* sp) {
return n;
}
// interface manager
#include <helpers/MultiSerialInterface.h>
MultiSerialInterface interface_manager;
// include bluetooth interface
#if defined(BLE_PIN_CODE)
#ifdef ESP32
// include esp32 bluetooth interface
#include <helpers/esp32/SerialBLEInterface.h>
SerialBLEInterface bluetooth_interface;
#elif defined(NRF52_PLATFORM)
// include nrf52 bluetooth interface
#include <helpers/nrf52/SerialBLEInterface.h>
SerialBLEInterface bluetooth_interface;
#else
#error "SerialBLEInterface is not defined for this platform"
#endif
#endif
// include wifi interface
#ifdef WIFI_SSID
#ifndef TCP_PORT
#define TCP_PORT 5000
#endif
#ifdef ESP32
// include esp32 wifi interface
#include <helpers/esp32/SerialWifiInterface.h>
SerialWifiInterface wifi_interface;
#else
#error "SerialWifiInterface is not defined for this platform"
#endif
#endif
// include usb interface
#if defined(ENABLE_USB_INTERFACE)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface usb_serial_interface;
#endif
// include ethernet interface
#if defined(ETHERNET_ENABLED)
#include <helpers/ethernet/EthernetInterface.h>
ETHERNET_CLASS ethernet_interface;
#endif
// include hardware serial interface
#if defined(SERIAL_RX)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface hardware_serial_interface;
HardwareSerial companion_serial(1);
#endif
// platform file system
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
#include <InternalFileSystem.h>
#if defined(QSPIFLASH)
@ -34,64 +87,10 @@ static uint32_t _atoi(const char* sp) {
DataStore store(SPIFFS, rtc_clock);
#endif
#ifdef ESP32
#ifdef WIFI_SSID
#include <helpers/esp32/SerialWifiInterface.h>
SerialWifiInterface serial_interface;
#ifndef TCP_PORT
#define TCP_PORT 5000
#endif
#elif defined(BLE_PIN_CODE)
#include <helpers/esp32/SerialBLEInterface.h>
SerialBLEInterface serial_interface;
#elif defined(SERIAL_RX)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
HardwareSerial companion_serial(1);
#else
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#endif
#elif defined(RP2040_PLATFORM)
//#ifdef WIFI_SSID
// #include <helpers/rp2040/SerialWifiInterface.h>
// SerialWifiInterface serial_interface;
// #ifndef TCP_PORT
// #define TCP_PORT 5000
// #endif
// #elif defined(BLE_PIN_CODE)
// #include <helpers/rp2040/SerialBLEInterface.h>
// SerialBLEInterface serial_interface;
#if defined(SERIAL_RX)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
HardwareSerial companion_serial(1);
#else
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#endif
#elif defined(NRF52_PLATFORM)
#ifdef BLE_PIN_CODE
#include <helpers/nrf52/SerialBLEInterface.h>
SerialBLEInterface serial_interface;
#elif defined(ETHERNET_ENABLED)
#include <helpers/nrf52/SerialEthernetInterface.h>
SerialEthernetInterface serial_interface;
#else
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#endif
#elif defined(STM32_PLATFORM)
#include <helpers/ArduinoSerialInterface.h>
ArduinoSerialInterface serial_interface;
#else
#error "need to define a serial interface"
#endif
/* GLOBAL OBJECTS */
#ifdef DISPLAY_CLASS
#include "UITask.h"
UITask ui_task(&board, &serial_interface);
UITask ui_task(&board, &interface_manager);
#endif
StdRNG fast_rng;
@ -161,26 +160,6 @@ void setup() {
false
#endif
);
#ifdef BLE_PIN_CODE
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
the_mesh.startInterface(serial_interface);
#elif defined(ETHERNET_ENABLED)
Serial.print("Waiting for serial to connect...\n");
unsigned long timeout = millis();
while (!Serial) {
if ((millis() - timeout) < 5000) { delay(100); } else { break; }
}
Serial.println("Initializing Ethernet adapter...");
if (serial_interface.begin()) {
the_mesh.startInterface(serial_interface);
} else {
Serial.println("ETH: Init failed, continuing without Ethernet (mesh only)");
}
#else
serial_interface.begin(Serial);
the_mesh.startInterface(serial_interface);
#endif
#elif defined(RP2040_PLATFORM)
LittleFS.begin();
store.begin();
@ -191,22 +170,6 @@ void setup() {
false
#endif
);
//#ifdef WIFI_SSID
// WiFi.begin(WIFI_SSID, WIFI_PWD);
// serial_interface.begin(TCP_PORT);
// #elif defined(BLE_PIN_CODE)
// char dev_name[32+16];
// sprintf(dev_name, "%s%s", BLE_NAME_PREFIX, the_mesh.getNodeName());
// serial_interface.begin(dev_name, the_mesh.getBLEPin());
#if defined(SERIAL_RX)
companion_serial.setPins(SERIAL_RX, SERIAL_TX);
companion_serial.begin(115200);
serial_interface.begin(companion_serial);
#else
serial_interface.begin(Serial);
#endif
the_mesh.startInterface(serial_interface);
#elif defined(ESP32)
SPIFFS.begin(true);
store.begin();
@ -217,7 +180,17 @@ void setup() {
false
#endif
);
#else
#error "need to define filesystem"
#endif
// add bluetooth interface
#if defined(BLE_PIN_CODE)
bluetooth_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
interface_manager.addInterface(InterfaceType::Bluetooth, &bluetooth_interface);
#endif
// add wifi interface
#ifdef WIFI_SSID
board.setInhibitSleep(true); // prevent sleep when WiFi is active
WiFi.setAutoReconnect(true);
@ -233,21 +206,31 @@ void setup() {
});
WiFi.begin(WIFI_SSID, WIFI_PWD);
serial_interface.begin(TCP_PORT);
#elif defined(BLE_PIN_CODE)
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
#elif defined(SERIAL_RX)
wifi_interface.begin(TCP_PORT);
interface_manager.addInterface(InterfaceType::WiFi, &wifi_interface);
#endif
// add usb interface
#if defined(ENABLE_USB_INTERFACE)
usb_serial_interface.begin(Serial);
interface_manager.addInterface(InterfaceType::USB, &usb_serial_interface);
#endif
// add ethernet interface
#if defined(ETHERNET_ENABLED)
ethernet_interface.begin();
interface_manager.addInterface(InterfaceType::Ethernet, &ethernet_interface);
#endif
// add hardware serial interface
#if defined(SERIAL_RX)
companion_serial.setPins(SERIAL_RX, SERIAL_TX);
companion_serial.begin(115200);
serial_interface.begin(companion_serial);
#else
serial_interface.begin(Serial);
#endif
the_mesh.startInterface(serial_interface);
#else
#error "need to define filesystem"
hardware_serial_interface.begin(companion_serial);
interface_manager.addInterface(InterfaceType::HardwareSerial, &hardware_serial_interface);
#endif
the_mesh.startInterface(interface_manager);
sensors.begin();
#if ENV_INCLUDE_GPS == 1
@ -263,6 +246,7 @@ void setup() {
void loop() {
the_mesh.loop();
interface_manager.loop();
sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
@ -272,10 +256,6 @@ void loop() {
external_watchdog.loop();
#endif
#ifdef ETHERNET_ENABLED
serial_interface.loop();
#endif
if (!the_mesh.hasPendingWork()) {
#if defined(NRF52_PLATFORM)
board.sleep(0); // nrf ignores seconds param, sleeps whenever possible

8
examples/companion_radio/ui-new/UITask.cpp

@ -289,7 +289,7 @@ public:
} else if (_page == HomePage::BLUETOOTH) {
display.setColor(UIColor::corp_blue);
display.drawXbm((display.width() - 32) / 2, 18,
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off,
_task->isBluetoothEnabled() ? bluetooth_on : bluetooth_off,
32, 32);
display.setColor(UIColor::secondary_txt);
display.setTextSize(1);
@ -449,10 +449,10 @@ public:
return true;
}
if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) {
if (_task->isSerialEnabled()) { // toggle Bluetooth on/off
_task->disableSerial();
if (_task->isBluetoothEnabled()) { // toggle Bluetooth on/off
_task->disableBluetooth();
} else {
_task->enableSerial();
_task->enableBluetooth();
}
return true;
}

4
examples/companion_radio/ui-new/UITask.h

@ -4,7 +4,7 @@
#include <helpers/ui/DisplayDriver.h>
#include <helpers/ui/UIScreen.h>
#include <helpers/SensorManager.h>
#include <helpers/BaseSerialInterface.h>
#include <helpers/MultiSerialInterface.h>
#include <Arduino.h>
#include <helpers/sensors/LPPDataHelpers.h>
@ -65,7 +65,7 @@ class UITask : public AbstractUITask {
public:
UITask(mesh::MainBoard* board, BaseSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
next_batt_chck = _next_refresh = 0;
ui_started_at = 0;
curr = NULL;

2
examples/companion_radio/ui-orig/UITask.h

@ -54,7 +54,7 @@ class UITask : public AbstractUITask {
public:
UITask(mesh::MainBoard* board, BaseSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
_next_refresh = 0;
ui_started_at = 0;
}

10
examples/companion_radio/ui-tiny/UITask.cpp

@ -240,7 +240,7 @@ public:
} else if (_page == HomePage::BLUETOOTH) {
display.setColor(UIColor::corp_blue);
display.drawXbm((display.width() - 32) / 2, 8,
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off,
_task->isBluetoothEnabled() ? bluetooth_on : bluetooth_off,
32, 32);
display.setTextSize(1);
// display.drawTextCentered(display.width() / 2, 40 - 11, "toggle: " PRESS_LABEL);
@ -391,10 +391,10 @@ public:
return true;
}
if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) {
if (_task->isSerialEnabled()) { // toggle Bluetooth on/off
_task->disableSerial();
if (_task->isBluetoothEnabled()) { // toggle Bluetooth on/off
_task->disableBluetooth();
} else {
_task->enableSerial();
_task->enableBluetooth();
}
return true;
}
@ -677,7 +677,7 @@ void UITask::loop() {
_cached_batt_mv,
isBuzzerQuiet(),
getGPSState(),
isSerialEnabled());
isBluetoothEnabled());
bool status_dirty = _statusBar.needsRedraw();
bool content_dirty = (millis() >= _next_refresh && curr);

4
examples/companion_radio/ui-tiny/UITask.h

@ -4,7 +4,7 @@
#include <helpers/ui/DisplayDriver.h>
#include <helpers/ui/UIScreen.h>
#include <helpers/SensorManager.h>
#include <helpers/BaseSerialInterface.h>
#include <helpers/MultiSerialInterface.h>
#include <Arduino.h>
#include <helpers/sensors/LPPDataHelpers.h>
@ -71,7 +71,7 @@ class UITask : public AbstractUITask {
public:
UITask(mesh::MainBoard* board, BaseSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
next_batt_chck = _next_refresh = 0;
_cached_batt_mv = 0;
ui_started_at = 0;

1
src/helpers/BaseSerialInterface.h

@ -14,6 +14,7 @@ public:
virtual bool isEnabled() const = 0;
virtual bool isConnected() const = 0;
virtual void loop() {};
virtual bool isWriteBusy() const = 0;
virtual size_t writeFrame(const uint8_t src[], size_t len) = 0;

200
src/helpers/MultiSerialInterface.h

@ -0,0 +1,200 @@
#pragma once
#include "BaseSerialInterface.h"
#ifndef MAX_INTERFACES
// ble, usb, wifi, ethernet
#define MAX_INTERFACES 4
#endif
enum class InterfaceType : uint8_t {
NONE,
Bluetooth,
USB,
WiFi,
Ethernet,
HardwareSerial
};
class MultiSerialInterface : public BaseSerialInterface {
private:
struct RegisteredInterface {
InterfaceType type = InterfaceType::NONE;
BaseSerialInterface* instance = nullptr;
};
bool _enabled = false;
RegisteredInterface _interfaces[MAX_INTERFACES] = {};
public:
bool addInterface(InterfaceType type, BaseSerialInterface* iface) {
// make sure an interface was provided
if(iface == nullptr){
return false;
}
// put it in the first free slot
for(int i = 0; i < MAX_INTERFACES; i++){
if(_interfaces[i].instance == nullptr){
_interfaces[i].instance = iface;
_interfaces[i].type = type;
return true;
}
}
// no free slots available
return false;
}
bool removeInterface(BaseSerialInterface* iface) {
// make sure an interface was provided
if(iface == nullptr){
return false;
}
// find and remove interface
for(int i = 0; i < MAX_INTERFACES; i++){
if(_interfaces[i].instance == iface){
_interfaces[i] = {};
return true;
}
}
// interface not found
return false;
}
void enableBluetooth() {
for(auto iface : _interfaces){
if(iface.instance && iface.type == InterfaceType::Bluetooth){
iface.instance->enable();
}
}
}
void disableBluetooth() {
for(auto iface : _interfaces){
if(iface.instance && iface.type == InterfaceType::Bluetooth){
iface.instance->disable();
}
}
}
bool isBluetoothEnabled() {
for(auto iface : _interfaces){
if(iface.instance && iface.type == InterfaceType::Bluetooth){
return iface.instance->isEnabled();
}
}
return false;
}
// enable all interfaces
void enable() override {
_enabled = true;
for(auto iface : _interfaces){
if(iface.instance){
iface.instance->enable();
}
}
}
// disable all interfaces
void disable() override {
_enabled = false;
for(auto iface : _interfaces){
if(iface.instance){
iface.instance->disable();
}
}
}
bool isEnabled() const override {
return _enabled;
}
bool isConnected() const override {
// not connected when disabled
if(!_enabled){
return false;
}
// check if any interface is connected
for(auto iface : _interfaces){
if(iface.instance && iface.instance->isConnected()) {
return true;
}
}
// nothing connected
return false;
}
// loop all interfaces
void loop() override {
for(auto iface : _interfaces){
if(iface.instance){
iface.instance->loop();
}
}
}
bool isWriteBusy() const override {
// not busy when disabled
if(!_enabled){
return false;
}
// check if any interface is busy
for(auto iface : _interfaces){
if(iface.instance && iface.instance->isEnabled() && iface.instance->isWriteBusy()){
return true;
}
}
// nothing busy
return false;
}
size_t writeFrame(const uint8_t src[], size_t len) override {
// don't write when disabled or nothing provided
if(!_enabled || len == 0){
return 0;
}
// write frame to all enabled interfaces
bool allSuccessful = true;
for(auto iface : _interfaces){
if(iface.instance && iface.instance->isEnabled()){
if(iface.instance->writeFrame(src, len) != len){
allSuccessful = false;
}
}
}
// report success if all writes completed successfully
return allSuccessful ? len : 0;
}
size_t checkRecvFrame(uint8_t dest[]) override {
// don't read when disabled
if(!_enabled){
return 0;
}
// try to read a frame from any enabled interface
for(auto iface : _interfaces){
if(iface.instance && iface.instance->isEnabled()){
size_t frameSize = iface.instance->checkRecvFrame(dest);
if(frameSize > 0){
return frameSize;
}
}
}
// no frame received
return 0;
}
};

11
src/helpers/ethernet/EthernetInterface.h

@ -0,0 +1,11 @@
#pragma once
#if defined(ETHERNET_ENABLED)
#if defined(ETHERNET_USE_CH390)
#include "helpers/ethernet/ch390/CH390EthernetInterface.h"
#elif defined(ETHERNET_USE_RAK13800)
#include "helpers/ethernet/RAK13800/RAK13800EthernetInterface.h"
#else
#error "ETHERNET_ENABLED is defined, but no specific driver flag (e.g. ETHERNET_USE_CH390) was provided!"
#endif
#endif

109
src/helpers/ethernet/RAK13800/RAK13800EthernetInterface.cpp

@ -0,0 +1,109 @@
#include "RAK13800EthernetInterface.h"
#include "../../nrf52/EthernetMac.h"
#include <SPI.h>
#include <EthernetUdp.h>
#define PIN_SPI1_MISO (29) // (0 + 29)
#define PIN_SPI1_MOSI (30) // (0 + 30)
#define PIN_SPI1_SCK (3) // (0 + 3)
SPIClass ETHERNET_SPI_PORT(NRF_SPIM1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI);
#define PIN_ETHERNET_POWER_EN WB_IO2 // output, high to enable
#define PIN_ETHERNET_RESET 21
#define PIN_ETHERNET_SS 26
bool RAK13800EthernetInterface::begin() {
// WB_IO2 (power enable) is already driven HIGH by early constructor
// in RAK4631Board.cpp to support POE boot.
// Skip hardware reset — the W5100S comes out of power-on reset cleanly,
// and toggling reset kills the PHY link which breaks POE power.
#ifdef PIN_ETHERNET_RESET
pinMode(PIN_ETHERNET_RESET, OUTPUT);
digitalWrite(PIN_ETHERNET_RESET, HIGH);
#endif
// generate mac address
uint8_t mac[6];
generateEthernetMac(mac);
ETHERNET_DEBUG_PRINTLN(
"Ethernet MAC: %02X:%02X:%02X:%02X:%02X:%02X",
mac[0],
mac[1],
mac[2],
mac[3],
mac[4],
mac[5]);
ETHERNET_SPI_PORT.begin();
Ethernet.init(ETHERNET_SPI_PORT, PIN_ETHERNET_SS);
// Use static IP if build flags are defined, otherwise DHCP
#if defined(ETHERNET_STATIC_IP) && defined(ETHERNET_STATIC_GATEWAY) && defined(ETHERNET_STATIC_SUBNET) && defined(ETHERNET_STATIC_DNS)
IPAddress ip(ETHERNET_STATIC_IP);
IPAddress gateway(ETHERNET_STATIC_GATEWAY);
IPAddress subnet(ETHERNET_STATIC_SUBNET);
IPAddress dns(ETHERNET_STATIC_DNS);
Ethernet.begin(mac, ip, dns, gateway, subnet);
#else
if (Ethernet.begin(mac) == 0) {
ETHERNET_DEBUG_PRINTLN("Failed to initialize RAK13800 hardware.");
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
ETHERNET_DEBUG_PRINTLN("Ethernet hardware not found.");
} else if (Ethernet.linkStatus() == LinkOFF) {
ETHERNET_DEBUG_PRINTLN("Ethernet cable not connected.");
} else {
ETHERNET_DEBUG_PRINTLN("DHCP failed for unknown reason.");
}
return false;
}
#endif
ETHERNET_DEBUG_PRINTLN("Ethernet begin complete");
ETHERNET_DEBUG_PRINT_IP("IP Address", Ethernet.localIP());
ETHERNET_DEBUG_PRINT_IP("Subnet Mask", Ethernet.subnetMask());
ETHERNET_DEBUG_PRINT_IP("Gateway", Ethernet.gatewayIP());
ETHERNET_DEBUG_PRINT_IP("DNS", Ethernet.dnsServerIP());
server.begin();
ETHERNET_DEBUG_PRINTLN("listening on TCP port: %d", ETHERNET_TCP_PORT);
return true;
}
int RAK13800EthernetInterface::available() {
return client.available();
}
int RAK13800EthernetInterface::read() {
return client.read();
}
size_t RAK13800EthernetInterface::write(const uint8_t *buf, size_t size) {
return client.write(buf, size);
}
bool RAK13800EthernetInterface::isConnected() const {
return _isConnected;
}
void RAK13800EthernetInterface::loop() {
Ethernet.maintain();
auto newClient = server.accept();
if (newClient) {
IPAddress remoteIp = newClient.remoteIP();
uint16_t remotePort = newClient.remotePort();
ETHERNET_DEBUG_PRINTLN("New client accepted %u.%u.%u.%u:%u", remoteIp[0], remoteIp[1], remoteIp[2], remoteIp[3], remotePort);
if (client) {
ETHERNET_DEBUG_PRINTLN("Closing previous client");
client.stop();
}
client = newClient;
onClientConnected();
}
_isConnected = client.connected();
}

27
src/helpers/ethernet/RAK13800/RAK13800EthernetInterface.h

@ -0,0 +1,27 @@
#pragma once
#include "../SerialEthernetInterface.h"
#include <SPI.h>
#include <RAK13800_W5100S.h>
class RAK13800EthernetInterface : public SerialEthernetInterface {
bool _isConnected;
EthernetServer server;
EthernetClient client;
public:
RAK13800EthernetInterface() : server(EthernetServer(ETHERNET_TCP_PORT)) {
_isConnected = false;
}
bool begin();
void loop() override;
// BaseSerialInterface methods
bool isConnected() const override;
int available() override;
int read() override;
size_t write(const uint8_t *buf, size_t size) override;
};

140
src/helpers/ethernet/SerialEthernetInterface.cpp

@ -0,0 +1,140 @@
#include "SerialEthernetInterface.h"
#define RECV_STATE_IDLE 0
#define RECV_STATE_HDR_FOUND 1
#define RECV_STATE_LEN1_FOUND 2
#define RECV_STATE_LEN2_FOUND 3
bool SerialEthernetInterface::begin() {
return true;
}
void SerialEthernetInterface::enable() {
if (_isEnabled) return;
_isEnabled = true;
clearBuffers();
}
void SerialEthernetInterface::disable() {
_isEnabled = false;
}
size_t SerialEthernetInterface::writeFrame(const uint8_t src[], size_t len) {
if (len > MAX_FRAME_SIZE) {
ETHERNET_DEBUG_PRINTLN("writeFrame(), frame too big, len=%d\n", len);
return 0;
}
if (isConnected() && len > 0) {
if (send_queue_len >= FRAME_QUEUE_SIZE) {
ETHERNET_DEBUG_PRINTLN("writeFrame(), send_queue is full!");
return 0;
}
send_queue[send_queue_len].len = len; // add to send queue
memcpy(send_queue[send_queue_len].buf, src, len);
send_queue_len++;
return len;
}
return 0;
}
bool SerialEthernetInterface::isWriteBusy() const {
return false;
}
void SerialEthernetInterface::onClientConnected() {
_state = RECV_STATE_IDLE;
_frame_len = 0;
_rx_len = 0;
}
size_t SerialEthernetInterface::checkRecvFrame(uint8_t dest[]) {
if (isConnected()) {
if (send_queue_len > 0) { // first, check send queue
_last_write = millis();
int len = send_queue[0].len;
#if ETHERNET_RAW_LINE
ETHERNET_DEBUG_PRINTLN("TX line len=%d", len);
client.write(send_queue[0].buf, len);
client.write("\r\n", 2);
#else
uint8_t pkt[3+len]; // use same header as serial interface so client can delimit frames
pkt[0] = '>';
pkt[1] = (len & 0xFF); // LSB
pkt[2] = (len >> 8); // MSB
memcpy(&pkt[3], send_queue[0].buf, send_queue[0].len);
ETHERNET_DEBUG_PRINTLN("Sending frame len=%d", len);
#if ETHERNET_DEBUG_LOGGING && ARDUINO
ETHERNET_DEBUG_PRINTLN("TX frame len=%d", len);
#endif
write(pkt, 3 + len);
#endif
send_queue_len--;
for (int i = 0; i < send_queue_len; i++) { // delete top item from queue
send_queue[i] = send_queue[i + 1];
}
} else {
while (available()) {
int c = read();
if (c < 0) break;
#if ETHERNET_RAW_LINE
if (c == '\r' || c == '\n') {
if (_rx_len == 0) {
continue;
}
uint16_t out_len = _rx_len;
if (out_len > MAX_FRAME_SIZE) out_len = MAX_FRAME_SIZE;
memcpy(dest, _rx_buf, out_len);
_rx_len = 0;
return out_len;
}
if (_rx_len < MAX_FRAME_SIZE) {
_rx_buf[_rx_len] = (uint8_t)c;
_rx_len++;
}
#else
switch (_state) {
case RECV_STATE_IDLE:
if (c == '<') {
_state = RECV_STATE_HDR_FOUND;
}
break;
case RECV_STATE_HDR_FOUND:
_frame_len = (uint8_t)c;
_state = RECV_STATE_LEN1_FOUND;
break;
case RECV_STATE_LEN1_FOUND:
_frame_len |= ((uint16_t)c) << 8;
_rx_len = 0;
_state = _frame_len > 0 ? RECV_STATE_LEN2_FOUND : RECV_STATE_IDLE;
break;
default:
if (_rx_len < MAX_FRAME_SIZE) {
_rx_buf[_rx_len] = (uint8_t)c;
}
_rx_len++;
if (_rx_len >= _frame_len) {
if (_frame_len > MAX_FRAME_SIZE) {
_frame_len = MAX_FRAME_SIZE;
}
#if ETHERNET_DEBUG_LOGGING && ARDUINO
ETHERNET_DEBUG_PRINTLN("RX frame len=%d", _frame_len);
#endif
memcpy(dest, _rx_buf, _frame_len);
_state = RECV_STATE_IDLE;
return _frame_len;
}
}
#endif
}
}
}
return 0;
}

23
src/helpers/nrf52/SerialEthernetInterface.h → src/helpers/ethernet/SerialEthernetInterface.h

@ -1,10 +1,6 @@
#pragma once
#ifdef ETHERNET_ENABLED
#include "helpers/BaseSerialInterface.h"
#include <SPI.h>
#include <RAK13800_W5100S.h>
#include "../BaseSerialInterface.h"
#ifndef ETHERNET_TCP_PORT
#define ETHERNET_TCP_PORT 5000
@ -12,7 +8,6 @@
// define ETHERNET_RAW_LINE=1 to use raw line-based CLI instead of framed packets
class SerialEthernetInterface : public BaseSerialInterface {
bool deviceConnected;
bool _isEnabled;
unsigned long _last_write;
uint8_t _state;
@ -20,9 +15,6 @@ class SerialEthernetInterface : public BaseSerialInterface {
uint16_t _rx_len;
uint8_t _rx_buf[MAX_FRAME_SIZE];
EthernetServer server;
EthernetClient client;
struct Frame {
uint8_t len;
uint8_t buf[MAX_FRAME_SIZE];
@ -42,8 +34,7 @@ class SerialEthernetInterface : public BaseSerialInterface {
protected:
public:
SerialEthernetInterface() : server(EthernetServer(ETHERNET_TCP_PORT)) {
deviceConnected = false;
SerialEthernetInterface() {
_isEnabled = false;
_last_write = 0;
send_queue_len = 0;
@ -53,6 +44,8 @@ class SerialEthernetInterface : public BaseSerialInterface {
}
bool begin();
void onClientConnected();
// BaseSerialInterface methods
void enable() override;
void disable() override;
@ -64,7 +57,9 @@ class SerialEthernetInterface : public BaseSerialInterface {
size_t writeFrame(const uint8_t src[], size_t len) override;
size_t checkRecvFrame(uint8_t dest[]) override;
void loop();
virtual int available() = 0;
virtual int read() = 0;
virtual size_t write(const uint8_t *buf, size_t size) = 0;
};
@ -72,11 +67,9 @@ class SerialEthernetInterface : public BaseSerialInterface {
#include <Arduino.h>
#define ETHERNET_DEBUG_PRINT(F, ...) Serial.printf("ETH: " F, ##__VA_ARGS__)
#define ETHERNET_DEBUG_PRINTLN(F, ...) Serial.printf("ETH: " F "\n", ##__VA_ARGS__)
#define ETHERNET_DEBUG_PRINT_IP(name, ip) Serial.printf(name ": %u.%u.%u.%u" "\n", ip[0], ip[1], ip[2], ip[3])
#define ETHERNET_DEBUG_PRINT_IP(name, ip) Serial.printf("ETH: " name ": %u.%u.%u.%u" "\n", ip[0], ip[1], ip[2], ip[3])
#else
#define ETHERNET_DEBUG_PRINT(...) {}
#define ETHERNET_DEBUG_PRINTLN(...) {}
#define ETHERNET_DEBUG_PRINT_IP(...) {}
#endif
#endif // ETHERNET_ENABLED

94
src/helpers/ethernet/ch390/CH390EthernetInterface.cpp

@ -0,0 +1,94 @@
#include "CH390EthernetInterface.h"
void onWiFiEvent(WiFiEvent_t event) {
switch(event){
case ARDUINO_EVENT_ETH_START:
ETHERNET_DEBUG_PRINTLN("Ethernet Started");
break;
case ARDUINO_EVENT_ETH_CONNECTED:
ETHERNET_DEBUG_PRINTLN("Ethernet Connected");
break;
case ARDUINO_EVENT_ETH_DISCONNECTED:
ETHERNET_DEBUG_PRINTLN("Ethernet Disconnected");
break;
case ARDUINO_EVENT_ETH_GOT_IP:
ETHERNET_DEBUG_PRINTLN("Ethernet Got IP");
ETHERNET_DEBUG_PRINT_IP("IP Address", CH390.localIP());
ETHERNET_DEBUG_PRINT_IP("Subnet Mask", CH390.subnetMask());
ETHERNET_DEBUG_PRINT_IP("Gateway", CH390.gatewayIP());
ETHERNET_DEBUG_PRINT_IP("DNS", CH390.dnsIP());
ETHERNET_DEBUG_PRINTLN("MAC Address: %s", CH390.macAddress().c_str());
break;
default:
break;
}
}
bool CH390EthernetInterface::begin() {
// listen to ethernet events
WiFi.onEvent(onWiFiEvent);
// Init CH390
ch390_config_t config = CH390_DEFAULT_CONFIG();
config.spi_miso_gpio = ETH_MISO_PIN;
config.spi_mosi_gpio = ETH_MOSI_PIN;
config.spi_sck_gpio = ETH_SCLK_PIN;
config.spi_cs_gpio = ETH_CS_PIN;
config.int_gpio = ETH_INT_PIN;
if (!CH390.begin(config)) {
ETHERNET_DEBUG_PRINTLN("Failed to initialize CH390 hardware.");
return false;
}
// Setup Static IP if build flags are present
#if defined(ETHERNET_STATIC_IP) && defined(ETHERNET_STATIC_GATEWAY) && defined(ETHERNET_STATIC_SUBNET)
IPAddress ip(ETHERNET_STATIC_IP);
IPAddress gw(ETHERNET_STATIC_GATEWAY);
IPAddress sn(ETHERNET_STATIC_SUBNET);
CH390.config(ip, gw, sn);
#endif
// Start Server
server.begin(ETHERNET_TCP_PORT);
ETHERNET_DEBUG_PRINTLN("listening on TCP port: %d", ETHERNET_TCP_PORT);
return true;
}
int CH390EthernetInterface::available() {
return client.available();
}
int CH390EthernetInterface::read() {
return client.read();
}
size_t CH390EthernetInterface::write(const uint8_t *buf, size_t size) {
return client.write(buf, size);
}
bool CH390EthernetInterface::isConnected() const {
return _isConnected;
}
void CH390EthernetInterface::loop() {
if (server.hasClient()) {
auto newClient = server.available();
if (newClient) {
IPAddress remoteIp = newClient.remoteIP();
uint16_t remotePort = newClient.remotePort();
ETHERNET_DEBUG_PRINTLN("New client accepted %u.%u.%u.%u:%u", remoteIp[0], remoteIp[1], remoteIp[2], remoteIp[3], remotePort);
if (client) {
ETHERNET_DEBUG_PRINTLN("Closing previous client");
client.stop();
}
client = newClient;
onClientConnected();
}
}
_isConnected = client.connected();
}

30
src/helpers/ethernet/ch390/CH390EthernetInterface.h

@ -0,0 +1,30 @@
#pragma once
#include "../SerialEthernetInterface.h"
#include <SPI.h>
#include <WiFi.h>
#include <WiFiServer.h>
#include <WiFiClient.h>
#include <ESP32_CH390.h>
class CH390EthernetInterface : public SerialEthernetInterface {
bool _isConnected;
WiFiServer server;
WiFiClient client;
public:
CH390EthernetInterface(){
_isConnected = false;
}
bool begin();
void loop() override;
// BaseSerialInterface methods
bool isConnected() const override;
int available() override;
int read() override;
size_t write(const uint8_t *buf, size_t size) override;
};

268
src/helpers/nrf52/SerialEthernetInterface.cpp

@ -1,268 +0,0 @@
#ifdef ETHERNET_ENABLED
#include "SerialEthernetInterface.h"
#include "EthernetMac.h"
#include <SPI.h>
#include <EthernetUdp.h>
#define PIN_SPI1_MISO (29) // (0 + 29)
#define PIN_SPI1_MOSI (30) // (0 + 30)
#define PIN_SPI1_SCK (3) // (0 + 3)
SPIClass ETHERNET_SPI_PORT(NRF_SPIM1, PIN_SPI1_MISO, PIN_SPI1_SCK, PIN_SPI1_MOSI);
#define PIN_ETHERNET_POWER_EN WB_IO2 // output, high to enable
#define PIN_ETHERNET_RESET 21
#define PIN_ETHERNET_SS 26
#define RECV_STATE_IDLE 0
#define RECV_STATE_HDR_FOUND 1
#define RECV_STATE_LEN1_FOUND 2
#define RECV_STATE_LEN2_FOUND 3
bool SerialEthernetInterface::begin() {
ETHERNET_DEBUG_PRINTLN("Ethernet initializing");
// WB_IO2 (power enable) is already driven HIGH by early constructor
// in RAK4631Board.cpp to support POE boot.
// Skip hardware reset — the W5100S comes out of power-on reset cleanly,
// and toggling reset kills the PHY link which breaks POE power.
#ifdef PIN_ETHERNET_RESET
pinMode(PIN_ETHERNET_RESET, OUTPUT);
digitalWrite(PIN_ETHERNET_RESET, HIGH);
#endif
uint8_t mac[6];
generateEthernetMac(mac);
ETHERNET_DEBUG_PRINTLN(
"Ethernet MAC: %02X:%02X:%02X:%02X:%02X:%02X",
mac[0],
mac[1],
mac[2],
mac[3],
mac[4],
mac[5]);
ETHERNET_DEBUG_PRINTLN("Init");
ETHERNET_SPI_PORT.begin();
Ethernet.init(ETHERNET_SPI_PORT, PIN_ETHERNET_SS);
// Use static IP if build flags are defined, otherwise DHCP
#if defined(ETHERNET_STATIC_IP) && defined(ETHERNET_STATIC_GATEWAY) && defined(ETHERNET_STATIC_SUBNET) && defined(ETHERNET_STATIC_DNS)
IPAddress ip(ETHERNET_STATIC_IP);
IPAddress gateway(ETHERNET_STATIC_GATEWAY);
IPAddress subnet(ETHERNET_STATIC_SUBNET);
IPAddress dns(ETHERNET_STATIC_DNS);
Ethernet.begin(mac, ip, dns, gateway, subnet);
#else
ETHERNET_DEBUG_PRINTLN("Begin");
if (Ethernet.begin(mac) == 0) {
ETHERNET_DEBUG_PRINTLN("Begin failed.");
// DHCP failed -- let's figure out why
if (Ethernet.hardwareStatus() == EthernetNoHardware) // Check for Ethernet hardware present.
{
ETHERNET_DEBUG_PRINTLN("Ethernet hardware not found.");
return false;
}
if (Ethernet.linkStatus() == LinkOFF) // No physical connection
{
ETHERNET_DEBUG_PRINTLN("Ethernet cable not connected.");
return false;
}
ETHERNET_DEBUG_PRINTLN("Ethernet: DHCP failed for unknown reason.");
return false;
}
#endif
ETHERNET_DEBUG_PRINTLN("Ethernet begin complete");
ETHERNET_DEBUG_PRINT_IP("IP", Ethernet.localIP());
ETHERNET_DEBUG_PRINT_IP("Subnet", Ethernet.subnetMask());
ETHERNET_DEBUG_PRINT_IP("Gateway", Ethernet.gatewayIP());
server.begin(); // start listening for clients
ETHERNET_DEBUG_PRINTLN("Ethernet: listening on TCP port: %d", ETHERNET_TCP_PORT);
return true;
}
void SerialEthernetInterface::enable() {
if (_isEnabled) return;
_isEnabled = true;
clearBuffers();
}
void SerialEthernetInterface::disable() {
_isEnabled = false;
}
size_t SerialEthernetInterface::writeFrame(const uint8_t src[], size_t len) {
if (len > MAX_FRAME_SIZE) {
ETHERNET_DEBUG_PRINTLN("writeFrame(), frame too big, len=%d\n", len);
return 0;
}
if (deviceConnected && len > 0) {
if (send_queue_len >= FRAME_QUEUE_SIZE) {
ETHERNET_DEBUG_PRINTLN("writeFrame(), send_queue is full!");
return 0;
}
send_queue[send_queue_len].len = len; // add to send queue
memcpy(send_queue[send_queue_len].buf, src, len);
send_queue_len++;
return len;
}
return 0;
}
bool SerialEthernetInterface::isWriteBusy() const {
return false;
}
size_t SerialEthernetInterface::checkRecvFrame(uint8_t dest[]) {
// Use accept() (not available()) so we only see newly-accepted sockets.
// available() also returns existing connected sockets that have data,
// which would cause us to treat each inbound packet as a "new client"
// and stop() the underlying socket — disconnecting the companion.
auto newClient = server.accept();
if (newClient) {
IPAddress new_ip = newClient.remoteIP();
uint16_t new_port = newClient.remotePort();
ETHERNET_DEBUG_PRINTLN(
"New client accepted %u.%u.%u.%u:%u",
new_ip[0],
new_ip[1],
new_ip[2],
new_ip[3],
new_port);
deviceConnected = false;
if (client) {
ETHERNET_DEBUG_PRINTLN("Closing previous client");
client.stop();
}
_state = RECV_STATE_IDLE;
_frame_len = 0;
_rx_len = 0;
client = newClient;
ETHERNET_DEBUG_PRINTLN("Switched to new client");
}
if (client.connected()) {
if (!deviceConnected) {
ETHERNET_DEBUG_PRINTLN(
"Got connection %u.%u.%u.%u:%u",
client.remoteIP()[0],
client.remoteIP()[1],
client.remoteIP()[2],
client.remoteIP()[3],
client.remotePort());
deviceConnected = true;
}
} else {
if (deviceConnected) {
deviceConnected = false;
ETHERNET_DEBUG_PRINTLN("Disconnected");
}
}
if (deviceConnected) {
if (send_queue_len > 0) { // first, check send queue
_last_write = millis();
int len = send_queue[0].len;
#if ETHERNET_RAW_LINE
ETHERNET_DEBUG_PRINTLN("TX line len=%d", len);
client.write(send_queue[0].buf, len);
client.write("\r\n", 2);
#else
uint8_t pkt[3+len]; // use same header as serial interface so client can delimit frames
pkt[0] = '>';
pkt[1] = (len & 0xFF); // LSB
pkt[2] = (len >> 8); // MSB
memcpy(&pkt[3], send_queue[0].buf, send_queue[0].len);
ETHERNET_DEBUG_PRINTLN("Sending frame len=%d", len);
#if ETHERNET_DEBUG_LOGGING && ARDUINO
ETHERNET_DEBUG_PRINTLN("TX frame len=%d", len);
#endif
client.write(pkt, 3 + len);
#endif
send_queue_len--;
for (int i = 0; i < send_queue_len; i++) { // delete top item from queue
send_queue[i] = send_queue[i + 1];
}
} else {
while (client.available()) {
int c = client.read();
if (c < 0) break;
#if ETHERNET_RAW_LINE
if (c == '\r' || c == '\n') {
if (_rx_len == 0) {
continue;
}
uint16_t out_len = _rx_len;
if (out_len > MAX_FRAME_SIZE) {
out_len = MAX_FRAME_SIZE;
}
memcpy(dest, _rx_buf, out_len);
_rx_len = 0;
return out_len;
}
if (_rx_len < MAX_FRAME_SIZE) {
_rx_buf[_rx_len] = (uint8_t)c;
_rx_len++;
}
#else
switch (_state) {
case RECV_STATE_IDLE:
if (c == '<') {
_state = RECV_STATE_HDR_FOUND;
}
break;
case RECV_STATE_HDR_FOUND:
_frame_len = (uint8_t)c;
_state = RECV_STATE_LEN1_FOUND;
break;
case RECV_STATE_LEN1_FOUND:
_frame_len |= ((uint16_t)c) << 8;
_rx_len = 0;
_state = _frame_len > 0 ? RECV_STATE_LEN2_FOUND : RECV_STATE_IDLE;
break;
default:
if (_rx_len < MAX_FRAME_SIZE) {
_rx_buf[_rx_len] = (uint8_t)c;
}
_rx_len++;
if (_rx_len >= _frame_len) {
if (_frame_len > MAX_FRAME_SIZE) {
_frame_len = MAX_FRAME_SIZE;
}
#if ETHERNET_DEBUG_LOGGING && ARDUINO
ETHERNET_DEBUG_PRINTLN("RX frame len=%d", _frame_len);
#endif
memcpy(dest, _rx_buf, _frame_len);
_state = RECV_STATE_IDLE;
return _frame_len;
}
}
#endif
}
}
}
return 0;
}
bool SerialEthernetInterface::isConnected() const {
return deviceConnected;
}
void SerialEthernetInterface::loop() {
Ethernet.maintain();
}
#endif // ETHERNET_ENABLED

1
variants/ebyte_eora_s3/platformio.ini

@ -102,6 +102,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Ebyte_EoRa-S3.build_src_filter}

1
variants/gat562_30s_mesh_kit/platformio.ini

@ -75,6 +75,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${GAT562_30S_Mesh_Kit.build_src_filter}

1
variants/gat562_mesh_tracker_pro/platformio.ini

@ -71,6 +71,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${GAT562_Mesh_Tracker_Pro.build_src_filter}

1
variants/heltec_ct62/platformio.ini

@ -101,6 +101,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_ct62.build_src_filter}

1
variants/heltec_e213/platformio.ini

@ -73,6 +73,7 @@ build_flags =
-D DISPLAY_CLASS=E213Display
-D AUTO_OFF_MILLIS=0
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_E213_base.build_src_filter}
+<helpers/ui/E213Display.cpp>
+<helpers/esp32/*.cpp>

1
variants/heltec_mesh_solar/platformio.ini

@ -87,6 +87,7 @@ build_flags =
${Heltec_mesh_solar.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1

2
variants/heltec_rc32/platformio.ini

@ -131,6 +131,7 @@ build_flags =
-D DISPLAY_CLASS=NullDisplayDriver
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_RC32.build_src_filter}
+<helpers/ui/MomentaryButton.cpp>
+<helpers/ui/buzzer.cpp>
@ -275,6 +276,7 @@ build_flags =
-D UI_HAS_ROTARY_INPUT
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/esp32/*.cpp>

1
variants/heltec_t096/platformio.ini

@ -152,6 +152,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1

1
variants/heltec_t1/platformio.ini

@ -90,6 +90,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_t1.build_src_filter}

2
variants/heltec_t114/platformio.ini

@ -127,6 +127,7 @@ build_flags =
-D DISPLAY_CLASS=NullDisplayDriver
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_t114.build_src_filter}
+<helpers/nrf52/*.cpp>
+<helpers/ui/NullDisplayDriver.cpp>
@ -238,6 +239,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1

1
variants/heltec_t190/platformio.ini

@ -74,6 +74,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_T190_base.build_src_filter}
+<helpers/esp32/*.cpp>
+<../examples/companion_radio/*.cpp>

1
variants/heltec_tower_v2/platformio.ini

@ -87,6 +87,7 @@ build_flags =
-D DISPLAY_CLASS=NullDisplayDriver
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1

1
variants/heltec_tracker/platformio.ini

@ -59,6 +59,7 @@ build_flags =
-D DISPLAY_CLASS=ST7735Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456 ; HWT will use display for pin
; -D OFFLINE_QUEUE_SIZE=256
; -D BLE_DEBUG_LOGGING=1

1
variants/heltec_tracker_v2/platformio.ini

@ -140,6 +140,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=ST7735Display
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Heltec_tracker_v2.build_src_filter}

1
variants/heltec_v2/platformio.ini

@ -137,6 +137,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v2.build_src_filter}

2
variants/heltec_v3/platformio.ini

@ -144,6 +144,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
@ -326,6 +327,7 @@ build_flags =
${Heltec_lora32_v3.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v3.build_src_filter}

2
variants/heltec_v4/platformio.ini

@ -187,6 +187,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${heltec_v4_oled.build_src_filter}
@ -351,6 +352,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=ST7789LCDDisplay
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${heltec_v4_tft.build_src_filter}

2
variants/heltec_v4_r8/platformio.ini

@ -138,6 +138,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D ENABLE_USB_INTERFACE
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>
@ -262,6 +263,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=ST7789LCDDisplay
-D ENABLE_USB_INTERFACE
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
+<helpers/ui/ST7789LCDDisplay.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/heltec_wireless_paper/platformio.ini

@ -73,6 +73,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=E213Display
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
+<helpers/ui/E213Display.cpp>
+<helpers/esp32/*.cpp>

2
variants/ikoka_handheld_nrf/platformio.ini

@ -74,6 +74,7 @@ extends = ikoka_handheld_nrf
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
-D LORA_TX_POWER=20
-D ENABLE_USB_INTERFACE
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
[env:ikoka_handheld_nrf_e22_30dbm_096_rotated_companion_radio_usb]
@ -82,6 +83,7 @@ board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
-D LORA_TX_POWER=20
-D DISPLAY_ROTATION=2
-D ENABLE_USB_INTERFACE
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
[env:ikoka_handheld_nrf_e22_30dbm_repeater]

1
variants/ikoka_nano_nrf/platformio.ini

@ -105,6 +105,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-I examples/companion_radio/ui-new
-D QSPIFLASH=1
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${ikoka_nano_nrf.build_src_filter}

1
variants/ikoka_stick_nrf/platformio.ini

@ -111,6 +111,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-I examples/companion_radio/ui-new
-D QSPIFLASH=1
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${ikoka_stick_nrf.build_src_filter}

1
variants/keepteen_lt1/platformio.ini

@ -66,6 +66,7 @@ build_flags = ${KeepteenLT1.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${KeepteenLT1.build_src_filter}

1
variants/lilygo_t3s3/platformio.ini

@ -140,6 +140,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter}

1
variants/lilygo_t3s3_sx1276/platformio.ini

@ -138,6 +138,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/lilygo_tbeam_1w/platformio.ini

@ -114,6 +114,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D PERSISTANT_GPS=1
-D ENV_SKIP_GPS_DETECT=1
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TBeam_1W.build_src_filter}

1
variants/lilygo_tdeck/platformio.ini

@ -71,6 +71,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${LilyGo_TDeck.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/lilygo_techo/platformio.ini

@ -120,6 +120,7 @@ build_flags =
-D UI_SENSORS_PAGE=1
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D QSPIFLASH=1
-D ENABLE_USB_INTERFACE
build_src_filter = ${LilyGo_T-Echo.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>

1
variants/lilygo_techo_card/platformio.ini

@ -110,6 +110,7 @@ build_flags =
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D ENABLE_USB_INTERFACE
build_src_filter = ${LilyGo_T-Echo_Card.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-tiny/*.cpp>

1
variants/lilygo_techo_lite/platformio.ini

@ -174,6 +174,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D UI_RECENT_LIST_SIZE=9
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${nrf52_base.build_src_filter}

1
variants/lilygo_teth_elite/platformio.ini

@ -72,6 +72,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TETH_Elite_sx1262.build_src_filter}

1
variants/lilygo_tlora_v2_1/platformio.ini

@ -77,6 +77,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter}

1
variants/m5stack_unit_c6l/platformio.ini

@ -97,6 +97,7 @@ build_flags = ${M5Stack_Unit_C6L.build_flags}
-D OFFLINE_QUEUE_SIZE=256
-D ARDUINO_USB_CDC_ON_BOOT=1
-D ARDUINO_USB_MODE=1
-D ENABLE_USB_INTERFACE
build_src_filter = ${M5Stack_Unit_C6L.build_src_filter}
+<helpers/esp32/*.cpp>
-<helpers/esp32/ESPNOWRadio.cpp>

1
variants/mesh_pocket/platformio.ini

@ -96,6 +96,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D AUTO_OFF_MILLIS=0
-D ENABLE_USB_INTERFACE
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1

2
variants/meshadventurer/platformio.ini

@ -186,6 +186,7 @@ build_flags =
-D MAX_CONTACTS=160
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=128
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps =
@ -266,6 +267,7 @@ build_flags =
-D MAX_CONTACTS=160
-D OFFLINE_QUEUE_SIZE=128
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps =

1
variants/meshtiny/platformio.ini

@ -36,6 +36,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Meshtiny.build_src_filter}

1
variants/minewsemi_me25ls01/platformio.ini

@ -144,6 +144,7 @@ build_flags = ${me25ls01.build_flags}
-D RX_BOOSTED_GAIN=true
-D RF_SWITCH_TABLE
-D DISPLAY_CLASS=NullDisplayDriver
-D ENABLE_USB_INTERFACE
build_src_filter = ${me25ls01.build_src_filter}
+<helpers/nrf52/*.cpp>
+<helpers/ui/NullDisplayDriver.cpp>

1
variants/muziworks_r1_neo/platformio.ini

@ -66,6 +66,7 @@ build_flags =
-I examples/companion_radio/ui-orig
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${R1Neo.build_src_filter}

1
variants/nano_g2_ultra/platformio.ini

@ -99,6 +99,7 @@ build_flags =
-D OFFLINE_QUEUE_SIZE=256
-D DISPLAY_CLASS=SH1106Display
-D PIN_BUZZER=4
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Nano_G2_Ultra.build_src_filter}

1
variants/nibble_screen_connect/platformio.ini

@ -107,6 +107,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=300
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
build_src_filter = ${nibble_screen_connect_base.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/nibble_zero_connect/platformio.ini

@ -104,6 +104,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=300
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/promicro/platformio.ini

@ -119,6 +119,7 @@ build_flags = ${Promicro.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Promicro.build_src_filter}

1
variants/rak11310/platformio.ini

@ -85,6 +85,7 @@ extends = rak11310
build_flags = ${rak11310.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}

1
variants/rak3112/platformio.ini

@ -136,6 +136,7 @@ build_flags =
-I examples/companion_radio/ui-orig
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak3112.build_src_filter}

1
variants/rak3401/platformio.ini

@ -67,6 +67,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak3401.build_src_filter}

1
variants/rak3x72/platformio.ini

@ -37,6 +37,7 @@ build_flags = ${rak3x72.build_flags}
; -D FORMAT_FS=true
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
build_src_filter = ${rak3x72.build_src_filter}
+<../examples/companion_radio/*.cpp>
lib_deps = ${rak3x72.lib_deps}

6
variants/rak4631/platformio.ini

@ -165,6 +165,7 @@ build_flags =
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak4631.build_src_filter}
@ -190,13 +191,16 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ETHERNET_ENABLED=1
-D ETHERNET_USE_RAK13800
-D ETHERNET_CLASS=RAK13800EthernetInterface
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
; -D ETHERNET_DEBUG_LOGGING=1
build_src_filter = ${rak4631.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
+<helpers/nrf52/SerialEthernetInterface.cpp>
+<helpers/ethernet/*.cpp>
+<helpers/ethernet/RAK13800/>
lib_deps =
${rak4631.lib_deps}
densaugeo/base64 @ ~1.4.0

1
variants/rak_wismesh_tag/platformio.ini

@ -71,6 +71,7 @@ build_flags =
-I examples/companion_radio/ui-orig
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak_wismesh_tag.build_src_filter}

1
variants/rpi_picow/platformio.ini

@ -58,6 +58,7 @@ extends = rpi_picow
build_flags = ${rpi_picow.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rpi_picow.build_src_filter}

1
variants/sensecap_solar/platformio.ini

@ -92,6 +92,7 @@ build_flags =
${SenseCap_Solar.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${SenseCap_Solar.build_src_filter}

1
variants/station_g2/platformio.ini

@ -188,6 +188,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Station_G2.build_src_filter}

1
variants/station_g3_esp32/platformio.ini

@ -103,6 +103,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Station_G3_ESP32.build_src_filter}

1
variants/t1000-e/platformio.ini

@ -82,6 +82,7 @@ build_flags = ${t1000-e.build_flags}
-D DISPLAY_CLASS=NullDisplayDriver
-D PIN_BUZZER=25
-D PIN_BUZZER_EN=37 ; P1/5 - required for T1000-E
-D ENABLE_USB_INTERFACE
build_src_filter = ${t1000-e.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/ui/NullDisplayDriver.cpp>

1
variants/thinknode_m1/platformio.ini

@ -117,6 +117,7 @@ build_flags =
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=6
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M1.build_src_filter}
+<helpers/ui/GxEPDDisplay.cpp>
+<helpers/ui/buzzer.cpp>

1
variants/thinknode_m2/platformio.ini

@ -159,6 +159,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M2.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/thinknode_m3/platformio.ini

@ -83,6 +83,7 @@ build_flags = ${ThinkNode_M3.build_flags}
-D DISPLAY_CLASS=NullDisplayDriver
-D PIN_BUZZER=23
-D PIN_BUZZER_EN=36
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M3.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/ui/NullDisplayDriver.cpp>

1
variants/thinknode_m5/platformio.ini

@ -173,6 +173,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M5.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>

1
variants/thinknode_m6/platformio.ini

@ -110,6 +110,7 @@ build_flags =
-D QSPIFLASH=1
-D OFFLINE_QUEUE_SIZE=256
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M6.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/ui/MomentaryButton.cpp>

43
variants/thinknode_m7/platformio.ini

@ -1,6 +1,8 @@
[ThinkNode_M7]
extends = esp32_base
board = thinknode_m7
board_upload.flash_size = 8MB
board_build.partitions = default_8MB.csv
build_flags = ${esp32_base.build_flags}
-I src/helpers/esp32
-I variants/thinknode_m7
@ -34,6 +36,23 @@ build_src_filter = ${esp32_base.build_src_filter}
lib_deps = ${esp32_base.lib_deps}
stevemarple/MicroNMEA @ ^2.0.6
[ThinkNode_M7_ethernet]
build_flags =
-D ETHERNET_ENABLED
-D ETHERNET_USE_CH390
-D ETHERNET_CLASS=CH390EthernetInterface
-D ETH_MISO_PIN=14
-D ETH_MOSI_PIN=48
-D ETH_SCLK_PIN=47
-D ETH_CS_PIN=21
-D ETH_INT_PIN=45
-D ETHERNET_DEBUG_LOGGING=1
build_src_filter =
+<helpers/ethernet/*.cpp>
+<helpers/ethernet/ch390/>
lib_deps =
https://github.com/liamcottle/ESP32-CH390.git#47b401f1de546118b03c18b5689dedec45871f2d
[env:ThinkNode_M7_repeater]
extends = ThinkNode_M7
build_src_filter = ${ThinkNode_M7.build_src_filter}
@ -72,6 +91,7 @@ lib_deps =
extends = ThinkNode_M7
build_flags =
${ThinkNode_M7.build_flags}
${ThinkNode_M7_ethernet.build_flags}
-I examples/companion_radio/ui-orig
-D DISPLAY_CLASS=NullDisplayDriver
-D MAX_CONTACTS=350
@ -81,6 +101,7 @@ build_flags =
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
build_src_filter = ${ThinkNode_M7.build_src_filter}
${ThinkNode_M7_ethernet.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/ui/NullDisplayDriver.cpp>
@ -88,6 +109,7 @@ build_src_filter = ${ThinkNode_M7.build_src_filter}
+<../examples/companion_radio/ui-orig/*.cpp>
lib_deps =
${ThinkNode_M7.lib_deps}
${ThinkNode_M7_ethernet.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:ThinkNode_M7_companion_radio_usb]
@ -98,6 +120,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M7.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
@ -130,6 +153,26 @@ lib_deps =
${ThinkNode_M7.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:ThinkNode_M7_companion_radio_ethernet]
extends = ThinkNode_M7
build_flags =
${ThinkNode_M7.build_flags}
${ThinkNode_M7_ethernet.build_flags}
-I examples/companion_radio/ui-orig
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=NullDisplayDriver
-D OFFLINE_QUEUE_SIZE=256
build_src_filter = ${ThinkNode_M7.build_src_filter}
${ThinkNode_M7_ethernet.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-orig/*.cpp>
lib_deps = ${ThinkNode_M7.lib_deps}
${ThinkNode_M7_ethernet.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:ThinkNode_M7_kiss_modem]
extends = ThinkNode_M7
build_src_filter = ${ThinkNode_M7.build_src_filter}

1
variants/thinknode_m9/platformio.ini

@ -120,6 +120,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M9.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/buzzer.cpp>

1
variants/tiny_relay/platformio.ini

@ -44,6 +44,7 @@ build_flags = ${Tiny_Relay.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D MAX_LORA_TX_POWER=22
-D ENABLE_USB_INTERFACE
build_src_filter = ${Tiny_Relay.build_src_filter}
+<../examples/companion_radio/*.cpp>
lib_deps = ${Tiny_Relay.lib_deps}

1
variants/waveshare_rp2040_lora/platformio.ini

@ -84,6 +84,7 @@ extends = waveshare_rp2040_lora
build_flags = ${waveshare_rp2040_lora.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${waveshare_rp2040_lora.build_src_filter}

1
variants/wio-e5-dev/platformio.ini

@ -46,6 +46,7 @@ build_flags = ${lora_e5.build_flags}
-D LORA_TX_POWER=22
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
build_src_filter = ${lora_e5.build_src_filter}
+<../examples/companion_radio/*.cpp>
lib_deps = ${lora_e5.lib_deps}

1
variants/wio-e5-mini/platformio.ini

@ -44,6 +44,7 @@ build_flags = ${lora_e5_mini.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D DISPLAY_CLASS=NullDisplayDriver
-D ENABLE_USB_INTERFACE
build_src_filter = ${lora_e5_mini.build_src_filter}
+<helpers/ui/NullDisplayDriver.cpp>
+<../examples/companion_radio/*.cpp>

1
variants/wio-tracker-l1/platformio.ini

@ -68,6 +68,7 @@ build_flags = ${WioTrackerL1.build_flags}
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=12
-D QSPIFLASH=1
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${WioTrackerL1.build_src_filter}

1
variants/xiao_c3/platformio.ini

@ -100,6 +100,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1

1
variants/xiao_nrf52/platformio.ini

@ -74,6 +74,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D QSPIFLASH=1
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_nrf52.build_src_filter}

1
variants/xiao_rp2040/platformio.ini

@ -61,6 +61,7 @@ extends = Xiao_rp2040
build_flags = ${Xiao_rp2040.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Xiao_rp2040.build_src_filter}

1
variants/xiao_s3/platformio.ini

@ -123,6 +123,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1

1
variants/xiao_s3_wio/platformio.ini

@ -136,6 +136,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SSD1306Display
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_S3_WIO.build_src_filter}

Loading…
Cancel
Save