diff --git a/platformio.ini b/platformio.ini
index 1f962a8d9..2033b2faf 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -185,7 +185,7 @@ build_type = debug ; I'm debugging with ICE a lot now
build_flags =
${arduino_base.build_flags} -Wno-unused-variable
-Isrc/nrf52
- -Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
+ -Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.7
;-DCFG_DEBUG=3
src_filter =
${arduino_base.src_filter} - - - -
diff --git a/proto b/proto
index 75078afe4..855da8701 160000
--- a/proto
+++ b/proto
@@ -1 +1 @@
-Subproject commit 75078afe43934f4ce15ef86ebc6950658a170145
+Subproject commit 855da8701edbb19818069ad8545d5b9f030bb33f
diff --git a/sdk-nrfxlib b/sdk-nrfxlib
index 17e845355..e6e02cb83 160000
--- a/sdk-nrfxlib
+++ b/sdk-nrfxlib
@@ -1 +1 @@
-Subproject commit 17e8453553d4cfc21ab87c53c9627f0cf1216429
+Subproject commit e6e02cb83d238fae2f54f084858bd5e49a31afa1
diff --git a/src/Power.cpp b/src/Power.cpp
index 3d185cb2d..26c40f926 100644
--- a/src/Power.cpp
+++ b/src/Power.cpp
@@ -1,4 +1,5 @@
#include "power.h"
+#include "NodeDB.h"
#include "PowerFSM.h"
#include "main.h"
#include "sleep.h"
@@ -268,9 +269,42 @@ bool Power::axp192Init()
DEBUG_MSG("DCDC3: %s\n", axp.isDCDC3Enable() ? "ENABLE" : "DISABLE");
DEBUG_MSG("Exten: %s\n", axp.isExtenEnable() ? "ENABLE" : "DISABLE");
- //axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1320MA); // actual limit (in HW) on the tbeam is 450mA
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA); // There's no HW limit on the tbeam. Setting to 450mz to be a good neighbor on the usb bus.
-
+ if (radioConfig.preferences.charge_current == ChargeCurrent_MAUnset) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA100) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_100MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA190) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_190MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA280) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_280MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA360) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_360MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA450) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA550) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_550MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA630) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_630MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA700) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_700MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA780) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_780MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA880) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_880MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA960) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_960MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA1000) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1000MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA1080) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1080MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA1160) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1160MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA1240) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1240MA);
+ } else if (radioConfig.preferences.charge_current == ChargeCurrent_MA1320) {
+ axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1320MA);
+ }
+
#if 0
// Not connected
diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h
index 39f39275f..c3e556669 100644
--- a/src/mesh/generated/deviceonly.pb.h
+++ b/src/mesh/generated/deviceonly.pb.h
@@ -80,7 +80,7 @@ extern const pb_msgdesc_t DeviceState_msg;
#define DeviceState_fields &DeviceState_msg
/* Maximum encoded size of messages (where known) */
-#define DeviceState_size 6176
+#define DeviceState_size 6206
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/mesh/generated/mesh.pb.c b/src/mesh/generated/mesh.pb.c
index 8f976cacb..3bc2b0800 100644
--- a/src/mesh/generated/mesh.pb.c
+++ b/src/mesh/generated/mesh.pb.c
@@ -57,3 +57,4 @@ PB_BIND(ToRadio, ToRadio, 2)
+
diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h
index 0962effaf..815fb2e26 100644
--- a/src/mesh/generated/mesh.pb.h
+++ b/src/mesh/generated/mesh.pb.h
@@ -35,6 +35,26 @@ typedef enum _RegionCode {
RegionCode_TW = 8
} RegionCode;
+typedef enum _ChargeCurrent {
+ ChargeCurrent_MAUnset = 0,
+ ChargeCurrent_MA100 = 1,
+ ChargeCurrent_MA190 = 2,
+ ChargeCurrent_MA280 = 3,
+ ChargeCurrent_MA360 = 4,
+ ChargeCurrent_MA450 = 5,
+ ChargeCurrent_MA550 = 6,
+ ChargeCurrent_MA630 = 7,
+ ChargeCurrent_MA700 = 8,
+ ChargeCurrent_MA780 = 9,
+ ChargeCurrent_MA880 = 10,
+ ChargeCurrent_MA960 = 11,
+ ChargeCurrent_MA1000 = 12,
+ ChargeCurrent_MA1080 = 13,
+ ChargeCurrent_MA1160 = 14,
+ ChargeCurrent_MA1240 = 15,
+ ChargeCurrent_MA1320 = 16
+} ChargeCurrent;
+
typedef enum _GpsOperation {
GpsOperation_GpsOpUnset = 0,
GpsOperation_GpsOpMobile = 2,
@@ -145,6 +165,7 @@ typedef struct _RadioConfig_UserPreferences {
char wifi_password[64];
bool wifi_ap_mode;
RegionCode region;
+ ChargeCurrent charge_current;
LocationSharing location_share;
GpsOperation gps_operation;
uint32_t gps_update_interval;
@@ -156,6 +177,11 @@ typedef struct _RadioConfig_UserPreferences {
bool debug_log_enabled;
pb_size_t ignore_incoming_count;
uint32_t ignore_incoming[3];
+ bool serialplugin_enabled;
+ bool serialplugin_echo;
+ uint32_t serialplugin_rxd;
+ uint32_t serialplugin_txd;
+ uint32_t serialplugin_timeout;
} RadioConfig_UserPreferences;
typedef struct _RouteDiscovery {
@@ -265,6 +291,10 @@ typedef struct _ToRadio {
#define _RegionCode_MAX RegionCode_TW
#define _RegionCode_ARRAYSIZE ((RegionCode)(RegionCode_TW+1))
+#define _ChargeCurrent_MIN ChargeCurrent_MAUnset
+#define _ChargeCurrent_MAX ChargeCurrent_MA1320
+#define _ChargeCurrent_ARRAYSIZE ((ChargeCurrent)(ChargeCurrent_MA1320+1))
+
#define _GpsOperation_MIN GpsOperation_GpsOpUnset
#define _GpsOperation_MAX GpsOperation_GpsOpDisabled
#define _GpsOperation_ARRAYSIZE ((GpsOperation)(GpsOperation_GpsOpDisabled+1))
@@ -299,7 +329,7 @@ extern "C" {
#define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0, 0, 0, 0}
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
-#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
+#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
#define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
@@ -313,7 +343,7 @@ extern "C" {
#define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0, 0, 0, 0}
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
-#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
+#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
@@ -371,6 +401,7 @@ extern "C" {
#define RadioConfig_UserPreferences_wifi_password_tag 13
#define RadioConfig_UserPreferences_wifi_ap_mode_tag 14
#define RadioConfig_UserPreferences_region_tag 15
+#define RadioConfig_UserPreferences_charge_current_tag 16
#define RadioConfig_UserPreferences_location_share_tag 32
#define RadioConfig_UserPreferences_gps_operation_tag 33
#define RadioConfig_UserPreferences_gps_update_interval_tag 34
@@ -381,6 +412,11 @@ extern "C" {
#define RadioConfig_UserPreferences_factory_reset_tag 100
#define RadioConfig_UserPreferences_debug_log_enabled_tag 101
#define RadioConfig_UserPreferences_ignore_incoming_tag 103
+#define RadioConfig_UserPreferences_serialplugin_enabled_tag 120
+#define RadioConfig_UserPreferences_serialplugin_echo_tag 121
+#define RadioConfig_UserPreferences_serialplugin_rxd_tag 122
+#define RadioConfig_UserPreferences_serialplugin_txd_tag 123
+#define RadioConfig_UserPreferences_serialplugin_timeout_tag 124
#define RouteDiscovery_route_tag 2
#define User_id_tag 1
#define User_long_name_tag 2
@@ -533,6 +569,7 @@ X(a, STATIC, SINGULAR, STRING, wifi_ssid, 12) \
X(a, STATIC, SINGULAR, STRING, wifi_password, 13) \
X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 14) \
X(a, STATIC, SINGULAR, UENUM, region, 15) \
+X(a, STATIC, SINGULAR, UENUM, charge_current, 16) \
X(a, STATIC, SINGULAR, UENUM, location_share, 32) \
X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \
X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 34) \
@@ -542,7 +579,12 @@ X(a, STATIC, SINGULAR, BOOL, is_low_power, 38) \
X(a, STATIC, SINGULAR, BOOL, fixed_position, 39) \
X(a, STATIC, SINGULAR, BOOL, factory_reset, 100) \
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 101) \
-X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103)
+X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103) \
+X(a, STATIC, SINGULAR, BOOL, serialplugin_enabled, 120) \
+X(a, STATIC, SINGULAR, BOOL, serialplugin_echo, 121) \
+X(a, STATIC, SINGULAR, UINT32, serialplugin_rxd, 122) \
+X(a, STATIC, SINGULAR, UINT32, serialplugin_txd, 123) \
+X(a, STATIC, SINGULAR, UINT32, serialplugin_timeout, 124)
#define RadioConfig_UserPreferences_CALLBACK NULL
#define RadioConfig_UserPreferences_DEFAULT NULL
@@ -654,13 +696,13 @@ extern const pb_msgdesc_t ToRadio_msg;
#define SubPacket_size 275
#define MeshPacket_size 320
#define ChannelSettings_size 95
-#define RadioConfig_size 319
-#define RadioConfig_UserPreferences_size 219
+#define RadioConfig_size 349
+#define RadioConfig_UserPreferences_size 249
#define NodeInfo_size 132
#define MyNodeInfo_size 106
#define LogRecord_size 81
-#define FromRadio_size 329
-#define ToRadio_size 323
+#define FromRadio_size 358
+#define ToRadio_size 353
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h
index bef19c12c..91c988fdc 100644
--- a/src/mesh/generated/portnums.pb.h
+++ b/src/mesh/generated/portnums.pb.h
@@ -18,13 +18,15 @@ typedef enum _PortNum {
PortNum_NODEINFO_APP = 4,
PortNum_REPLY_APP = 32,
PortNum_IP_TUNNEL_APP = 33,
- PortNum_PRIVATE_APP = 256
+ PortNum_SERIAL_APP = 64,
+ PortNum_PRIVATE_APP = 256,
+ PortNum_ATAK_FORWARDER = 257
} PortNum;
/* Helper constants for enums */
#define _PortNum_MIN PortNum_UNKNOWN_APP
-#define _PortNum_MAX PortNum_PRIVATE_APP
-#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_PRIVATE_APP+1))
+#define _PortNum_MAX PortNum_ATAK_FORWARDER
+#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_ATAK_FORWARDER+1))
#ifdef __cplusplus
diff --git a/src/plugins/Plugins.cpp b/src/plugins/Plugins.cpp
index eee8280c5..096b9cf5d 100644
--- a/src/plugins/Plugins.cpp
+++ b/src/plugins/Plugins.cpp
@@ -1,14 +1,15 @@
#include "plugins/NodeInfoPlugin.h"
#include "plugins/PositionPlugin.h"
+#include "plugins/RemoteHardwarePlugin.h"
#include "plugins/ReplyPlugin.h"
#include "plugins/SerialPlugin.h"
-#include "plugins/RemoteHardwarePlugin.h"
#include "plugins/TextMessagePlugin.h"
/**
* Create plugin instances here. If you are adding a new plugin, you must 'new' it here (or somewhere else)
*/
-void setupPlugins() {
+void setupPlugins()
+{
nodeInfoPlugin = new NodeInfoPlugin();
positionPlugin = new PositionPlugin();
textMessagePlugin = new TextMessagePlugin();
@@ -18,5 +19,11 @@ void setupPlugins() {
new RemoteHardwarePlugin();
new ReplyPlugin();
+
+#ifndef NO_ESP32
+ // Only run on an esp32 based device.
+
new SerialPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org
+#endif
+
}
\ No newline at end of file
diff --git a/src/plugins/SerialPlugin.cpp b/src/plugins/SerialPlugin.cpp
index 82c8baf83..236b29f94 100644
--- a/src/plugins/SerialPlugin.cpp
+++ b/src/plugins/SerialPlugin.cpp
@@ -13,12 +13,7 @@
An overly simplistic interface to send messages over the mesh network by sending strings
over a serial port.
- Originally designed for lora32 v1.0
- Manufacture Info: http://www.lilygo.cn/prod_view.aspx?TypeId=50003&Id=1133&FId=t3:50003:3
- Pin Mapping: http://ae01.alicdn.com/kf/HTB1fLBcxkSWBuNjSszdq6zeSpXaJ.jpg
-
- This will probably and most likely work on other esp32 devices, given possible change the RX/TX
- selection.
+ Default is to use RX GPIO 16 and TX GPIO 17.
Need help with this plugin? Post your question on the Meshtastic Discourse:
https://meshtastic.discourse.group
@@ -27,6 +22,9 @@
1) Enable the plugin by setting SERIALPLUGIN_ENABLED to 1.
2) Set the pins (RXD2 / TXD2) for your preferred RX and TX GPIO pins.
+ On tbeam, recommend to use:
+ #define RXD2 35
+ #define TXD2 15
3) Set SERIALPLUGIN_TIMEOUT to the amount of time to wait before we consider
your packet as "done".
4) (Optional) In SerialPlugin.h set the port to PortNum_TEXT_MESSAGE_APP if you want to
@@ -37,7 +35,6 @@
to your device.
TODO (in this order):
- * Add check for esp32 and only build code sections for esp32.
* Once protobufs regenerated with the new port, update SerialPlugin.h
* Ensure this works on a tbeam
* Define a verbose RX mode to report on mesh and packet infomration.
@@ -46,7 +43,7 @@
KNOWN PROBLEMS
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
state. Device connected to that pin may see this as "noise".
- * This will not work on the NRF or Linux target.
+ * Will not work on NRF and the Linux device targets.
*/
@@ -57,9 +54,7 @@
#define SERIALPLUGIN_STRING_MAX Constants_DATA_PAYLOAD_LEN
#define SERIALPLUGIN_TIMEOUT 250
#define SERIALPLUGIN_BAUD 38400
-#define SERIALPLUGIN_ENABLED 0
-#define SERIALPLUGIN_ECHO 0
-#define SERIALPLUGIN_ACK 0
+#define SERIALPLUGIN_ACK 1
SerialPlugin *serialPlugin;
SerialPluginRadio *serialPluginRadio;
@@ -70,43 +65,56 @@ char serialStringChar[Constants_DATA_PAYLOAD_LEN];
int32_t SerialPlugin::runOnce()
{
-#ifdef NO_ESP32
+#ifndef NO_ESP32
+ if (radioConfig.preferences.serialplugin_enabled) {
-#if SERIALPLUGIN_ENABLED == 1
+ if (firstTime) {
- if (firstTime) {
+ // Interface with the serial peripheral from in here.
+ DEBUG_MSG("Initilizing serial peripheral interface\n");
- // Interface with the serial peripheral from in here.
- DEBUG_MSG("Initilizing serial peripheral interface\n");
+ if (radioConfig.preferences.serialplugin_rxd && radioConfig.preferences.serialplugin_txd) {
+ Serial2.begin(SERIALPLUGIN_BAUD, SERIAL_8N1, radioConfig.preferences.serialplugin_rxd,
+ radioConfig.preferences.serialplugin_txd);
- Serial2.begin(SERIALPLUGIN_BAUD, SERIAL_8N1, RXD2, TXD2);
- Serial2.setTimeout(SERIALPLUGIN_TIMEOUT); // Number of MS to wait to set the timeout for the string.
- Serial2.setRxBufferSize(SERIALPLUGIN_RX_BUFFER);
+ } else {
+ Serial2.begin(SERIALPLUGIN_BAUD, SERIAL_8N1, RXD2, TXD2);
+ }
- serialPluginRadio = new SerialPluginRadio();
+ if (radioConfig.preferences.serialplugin_timeout) {
+ Serial2.setTimeout(
+ radioConfig.preferences.serialplugin_timeout); // Number of MS to wait to set the timeout for the string.
- firstTime = 0;
+ } else {
+ Serial2.setTimeout(SERIALPLUGIN_TIMEOUT); // Number of MS to wait to set the timeout for the string.
+ }
- } else {
- String serialString;
+ Serial2.setRxBufferSize(SERIALPLUGIN_RX_BUFFER);
- while (Serial2.available()) {
- serialString = Serial2.readString();
- serialString.toCharArray(serialStringChar, Constants_DATA_PAYLOAD_LEN);
+ serialPluginRadio = new SerialPluginRadio();
- serialPluginRadio->sendPayload();
+ firstTime = 0;
- DEBUG_MSG("Received: %s\n", serialStringChar);
+ } else {
+ String serialString;
+
+ while (Serial2.available()) {
+ serialString = Serial2.readString();
+ serialString.toCharArray(serialStringChar, Constants_DATA_PAYLOAD_LEN);
+
+ serialPluginRadio->sendPayload();
+
+ DEBUG_MSG("Received: %s\n", serialStringChar);
+ }
}
+
+ return (10);
+ } else {
+ DEBUG_MSG("Serial Plugin Disabled\n");
+
+ return (INT32_MAX);
}
- return (10);
-#else
- DEBUG_MSG("Serial Plugin Disabled\n");
-
- return (INT32_MAX);
-#endif
-
#endif
}
@@ -134,44 +142,42 @@ void SerialPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
{
+#ifndef NO_ESP32
-#ifdef NO_ESP32
+ if (radioConfig.preferences.serialplugin_enabled) {
-#if SERIALPLUGIN_ENABLED == 1
+ auto &p = mp.decoded.data;
+ // DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n", nodeDB.getNodeNum(),
+ // mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
- auto &p = mp.decoded.data;
- // DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n", nodeDB.getNodeNum(),
- // mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
+ if (mp.from == nodeDB.getNodeNum()) {
- if (mp.from == nodeDB.getNodeNum()) {
+ /*
+ * If radioConfig.preferences.serialplugin_echo is true, then echo the packets that are sent out back to the TX
+ * of the serial interface.
+ */
+ if (radioConfig.preferences.serialplugin_echo) {
- /*
- * If SERIALPLUGIN_ECHO is true, then echo the packets that are sent out back to the TX
- * of the serial interface.
- */
- if (SERIALPLUGIN_ECHO) {
-
- // For some reason, we get the packet back twice when we send out of the radio.
- // TODO: need to find out why.
- if (lastRxID != mp.id) {
- lastRxID = mp.id;
- // DEBUG_MSG("* * Message came this device\n");
- // Serial2.println("* * Message came this device");
- Serial2.printf("%s", p.payload.bytes);
+ // For some reason, we get the packet back twice when we send out of the radio.
+ // TODO: need to find out why.
+ if (lastRxID != mp.id) {
+ lastRxID = mp.id;
+ // DEBUG_MSG("* * Message came this device\n");
+ // Serial2.println("* * Message came this device");
+ Serial2.printf("%s", p.payload.bytes);
+ }
}
+
+ } else {
+ // DEBUG_MSG("* * Message came from the mesh\n");
+ // Serial2.println("* * Message came from the mesh");
+ Serial2.printf("%s", p.payload.bytes);
}
} else {
- // DEBUG_MSG("* * Message came from the mesh\n");
- // Serial2.println("* * Message came from the mesh");
- Serial2.printf("%s", p.payload.bytes);
+ DEBUG_MSG("Serial Plugin Disabled\n");
}
-#else
- DEBUG_MSG("Serial Plugin Disabled\n");
-
-#endif
-
#endif
return true; // Let others look at this message also if they want
diff --git a/src/plugins/SerialPlugin.h b/src/plugins/SerialPlugin.h
index c6d79f3eb..4555c65b8 100644
--- a/src/plugins/SerialPlugin.h
+++ b/src/plugins/SerialPlugin.h
@@ -33,8 +33,8 @@ class SerialPluginRadio : public SinglePortPlugin
from the main code.
*/
- SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
- // SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
+ // SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
+ SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
/**
* Send our payload into the mesh