sforkowany z mirror/meshtastic-firmware
Merge pull request #641 from mc-hamster/master
Update generated protobuf; Update serial plugin; #615 - Configure charge current1.2-legacy
commit
54e780a6ca
|
@ -185,7 +185,7 @@ build_type = debug ; I'm debugging with ICE a lot now
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags} -Wno-unused-variable
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
-Isrc/nrf52
|
-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
|
;-DCFG_DEBUG=3
|
||||||
src_filter =
|
src_filter =
|
||||||
${arduino_base.src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/>
|
${arduino_base.src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/>
|
||||||
|
|
2
proto
2
proto
|
@ -1 +1 @@
|
||||||
Subproject commit 75078afe43934f4ce15ef86ebc6950658a170145
|
Subproject commit 855da8701edbb19818069ad8545d5b9f030bb33f
|
|
@ -1 +1 @@
|
||||||
Subproject commit 17e8453553d4cfc21ab87c53c9627f0cf1216429
|
Subproject commit e6e02cb83d238fae2f54f084858bd5e49a31afa1
|
|
@ -1,4 +1,5 @@
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
|
@ -268,8 +269,41 @@ bool Power::axp192Init()
|
||||||
DEBUG_MSG("DCDC3: %s\n", axp.isDCDC3Enable() ? "ENABLE" : "DISABLE");
|
DEBUG_MSG("DCDC3: %s\n", axp.isDCDC3Enable() ? "ENABLE" : "DISABLE");
|
||||||
DEBUG_MSG("Exten: %s\n", axp.isExtenEnable() ? "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
|
if (radioConfig.preferences.charge_current == ChargeCurrent_MAUnset) {
|
||||||
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.
|
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
|
#if 0
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern const pb_msgdesc_t DeviceState_msg;
|
||||||
#define DeviceState_fields &DeviceState_msg
|
#define DeviceState_fields &DeviceState_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define DeviceState_size 6176
|
#define DeviceState_size 6206
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -57,3 +57,4 @@ PB_BIND(ToRadio, ToRadio, 2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,26 @@ typedef enum _RegionCode {
|
||||||
RegionCode_TW = 8
|
RegionCode_TW = 8
|
||||||
} RegionCode;
|
} 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 {
|
typedef enum _GpsOperation {
|
||||||
GpsOperation_GpsOpUnset = 0,
|
GpsOperation_GpsOpUnset = 0,
|
||||||
GpsOperation_GpsOpMobile = 2,
|
GpsOperation_GpsOpMobile = 2,
|
||||||
|
@ -145,6 +165,7 @@ typedef struct _RadioConfig_UserPreferences {
|
||||||
char wifi_password[64];
|
char wifi_password[64];
|
||||||
bool wifi_ap_mode;
|
bool wifi_ap_mode;
|
||||||
RegionCode region;
|
RegionCode region;
|
||||||
|
ChargeCurrent charge_current;
|
||||||
LocationSharing location_share;
|
LocationSharing location_share;
|
||||||
GpsOperation gps_operation;
|
GpsOperation gps_operation;
|
||||||
uint32_t gps_update_interval;
|
uint32_t gps_update_interval;
|
||||||
|
@ -156,6 +177,11 @@ typedef struct _RadioConfig_UserPreferences {
|
||||||
bool debug_log_enabled;
|
bool debug_log_enabled;
|
||||||
pb_size_t ignore_incoming_count;
|
pb_size_t ignore_incoming_count;
|
||||||
uint32_t ignore_incoming[3];
|
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;
|
} RadioConfig_UserPreferences;
|
||||||
|
|
||||||
typedef struct _RouteDiscovery {
|
typedef struct _RouteDiscovery {
|
||||||
|
@ -265,6 +291,10 @@ typedef struct _ToRadio {
|
||||||
#define _RegionCode_MAX RegionCode_TW
|
#define _RegionCode_MAX RegionCode_TW
|
||||||
#define _RegionCode_ARRAYSIZE ((RegionCode)(RegionCode_TW+1))
|
#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_MIN GpsOperation_GpsOpUnset
|
||||||
#define _GpsOperation_MAX GpsOperation_GpsOpDisabled
|
#define _GpsOperation_MAX GpsOperation_GpsOpDisabled
|
||||||
#define _GpsOperation_ARRAYSIZE ((GpsOperation)(GpsOperation_GpsOpDisabled+1))
|
#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 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 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_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 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 MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
|
#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 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 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_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 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 MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
|
#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_password_tag 13
|
||||||
#define RadioConfig_UserPreferences_wifi_ap_mode_tag 14
|
#define RadioConfig_UserPreferences_wifi_ap_mode_tag 14
|
||||||
#define RadioConfig_UserPreferences_region_tag 15
|
#define RadioConfig_UserPreferences_region_tag 15
|
||||||
|
#define RadioConfig_UserPreferences_charge_current_tag 16
|
||||||
#define RadioConfig_UserPreferences_location_share_tag 32
|
#define RadioConfig_UserPreferences_location_share_tag 32
|
||||||
#define RadioConfig_UserPreferences_gps_operation_tag 33
|
#define RadioConfig_UserPreferences_gps_operation_tag 33
|
||||||
#define RadioConfig_UserPreferences_gps_update_interval_tag 34
|
#define RadioConfig_UserPreferences_gps_update_interval_tag 34
|
||||||
|
@ -381,6 +412,11 @@ extern "C" {
|
||||||
#define RadioConfig_UserPreferences_factory_reset_tag 100
|
#define RadioConfig_UserPreferences_factory_reset_tag 100
|
||||||
#define RadioConfig_UserPreferences_debug_log_enabled_tag 101
|
#define RadioConfig_UserPreferences_debug_log_enabled_tag 101
|
||||||
#define RadioConfig_UserPreferences_ignore_incoming_tag 103
|
#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 RouteDiscovery_route_tag 2
|
||||||
#define User_id_tag 1
|
#define User_id_tag 1
|
||||||
#define User_long_name_tag 2
|
#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, STRING, wifi_password, 13) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 14) \
|
X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 14) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, region, 15) \
|
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, location_share, 32) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \
|
X(a, STATIC, SINGULAR, UENUM, gps_operation, 33) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 34) \
|
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, fixed_position, 39) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, factory_reset, 100) \
|
X(a, STATIC, SINGULAR, BOOL, factory_reset, 100) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 101) \
|
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_CALLBACK NULL
|
||||||
#define RadioConfig_UserPreferences_DEFAULT NULL
|
#define RadioConfig_UserPreferences_DEFAULT NULL
|
||||||
|
|
||||||
|
@ -654,13 +696,13 @@ extern const pb_msgdesc_t ToRadio_msg;
|
||||||
#define SubPacket_size 275
|
#define SubPacket_size 275
|
||||||
#define MeshPacket_size 320
|
#define MeshPacket_size 320
|
||||||
#define ChannelSettings_size 95
|
#define ChannelSettings_size 95
|
||||||
#define RadioConfig_size 319
|
#define RadioConfig_size 349
|
||||||
#define RadioConfig_UserPreferences_size 219
|
#define RadioConfig_UserPreferences_size 249
|
||||||
#define NodeInfo_size 132
|
#define NodeInfo_size 132
|
||||||
#define MyNodeInfo_size 106
|
#define MyNodeInfo_size 106
|
||||||
#define LogRecord_size 81
|
#define LogRecord_size 81
|
||||||
#define FromRadio_size 329
|
#define FromRadio_size 358
|
||||||
#define ToRadio_size 323
|
#define ToRadio_size 353
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -18,13 +18,15 @@ typedef enum _PortNum {
|
||||||
PortNum_NODEINFO_APP = 4,
|
PortNum_NODEINFO_APP = 4,
|
||||||
PortNum_REPLY_APP = 32,
|
PortNum_REPLY_APP = 32,
|
||||||
PortNum_IP_TUNNEL_APP = 33,
|
PortNum_IP_TUNNEL_APP = 33,
|
||||||
PortNum_PRIVATE_APP = 256
|
PortNum_SERIAL_APP = 64,
|
||||||
|
PortNum_PRIVATE_APP = 256,
|
||||||
|
PortNum_ATAK_FORWARDER = 257
|
||||||
} PortNum;
|
} PortNum;
|
||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
#define _PortNum_MIN PortNum_UNKNOWN_APP
|
#define _PortNum_MIN PortNum_UNKNOWN_APP
|
||||||
#define _PortNum_MAX PortNum_PRIVATE_APP
|
#define _PortNum_MAX PortNum_ATAK_FORWARDER
|
||||||
#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_PRIVATE_APP+1))
|
#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_ATAK_FORWARDER+1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
#include "plugins/NodeInfoPlugin.h"
|
#include "plugins/NodeInfoPlugin.h"
|
||||||
#include "plugins/PositionPlugin.h"
|
#include "plugins/PositionPlugin.h"
|
||||||
|
#include "plugins/RemoteHardwarePlugin.h"
|
||||||
#include "plugins/ReplyPlugin.h"
|
#include "plugins/ReplyPlugin.h"
|
||||||
#include "plugins/SerialPlugin.h"
|
#include "plugins/SerialPlugin.h"
|
||||||
#include "plugins/RemoteHardwarePlugin.h"
|
|
||||||
#include "plugins/TextMessagePlugin.h"
|
#include "plugins/TextMessagePlugin.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create plugin instances here. If you are adding a new plugin, you must 'new' it here (or somewhere else)
|
* 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();
|
nodeInfoPlugin = new NodeInfoPlugin();
|
||||||
positionPlugin = new PositionPlugin();
|
positionPlugin = new PositionPlugin();
|
||||||
textMessagePlugin = new TextMessagePlugin();
|
textMessagePlugin = new TextMessagePlugin();
|
||||||
|
@ -18,5 +19,11 @@ void setupPlugins() {
|
||||||
|
|
||||||
new RemoteHardwarePlugin();
|
new RemoteHardwarePlugin();
|
||||||
new ReplyPlugin();
|
new ReplyPlugin();
|
||||||
|
|
||||||
|
#ifndef NO_ESP32
|
||||||
|
// Only run on an esp32 based device.
|
||||||
|
|
||||||
new SerialPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org
|
new SerialPlugin(); // Maintained by MC Hamster (Jm Casler) jm@casler.org
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,12 +13,7 @@
|
||||||
An overly simplistic interface to send messages over the mesh network by sending strings
|
An overly simplistic interface to send messages over the mesh network by sending strings
|
||||||
over a serial port.
|
over a serial port.
|
||||||
|
|
||||||
Originally designed for lora32 v1.0
|
Default is to use RX GPIO 16 and TX GPIO 17.
|
||||||
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.
|
|
||||||
|
|
||||||
Need help with this plugin? Post your question on the Meshtastic Discourse:
|
Need help with this plugin? Post your question on the Meshtastic Discourse:
|
||||||
https://meshtastic.discourse.group
|
https://meshtastic.discourse.group
|
||||||
|
@ -27,6 +22,9 @@
|
||||||
|
|
||||||
1) Enable the plugin by setting SERIALPLUGIN_ENABLED to 1.
|
1) Enable the plugin by setting SERIALPLUGIN_ENABLED to 1.
|
||||||
2) Set the pins (RXD2 / TXD2) for your preferred RX and TX GPIO pins.
|
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
|
3) Set SERIALPLUGIN_TIMEOUT to the amount of time to wait before we consider
|
||||||
your packet as "done".
|
your packet as "done".
|
||||||
4) (Optional) In SerialPlugin.h set the port to PortNum_TEXT_MESSAGE_APP if you want to
|
4) (Optional) In SerialPlugin.h set the port to PortNum_TEXT_MESSAGE_APP if you want to
|
||||||
|
@ -37,7 +35,6 @@
|
||||||
to your device.
|
to your device.
|
||||||
|
|
||||||
TODO (in this order):
|
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
|
* Once protobufs regenerated with the new port, update SerialPlugin.h
|
||||||
* Ensure this works on a tbeam
|
* Ensure this works on a tbeam
|
||||||
* Define a verbose RX mode to report on mesh and packet infomration.
|
* Define a verbose RX mode to report on mesh and packet infomration.
|
||||||
|
@ -46,7 +43,7 @@
|
||||||
KNOWN PROBLEMS
|
KNOWN PROBLEMS
|
||||||
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
|
* 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".
|
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_STRING_MAX Constants_DATA_PAYLOAD_LEN
|
||||||
#define SERIALPLUGIN_TIMEOUT 250
|
#define SERIALPLUGIN_TIMEOUT 250
|
||||||
#define SERIALPLUGIN_BAUD 38400
|
#define SERIALPLUGIN_BAUD 38400
|
||||||
#define SERIALPLUGIN_ENABLED 0
|
#define SERIALPLUGIN_ACK 1
|
||||||
#define SERIALPLUGIN_ECHO 0
|
|
||||||
#define SERIALPLUGIN_ACK 0
|
|
||||||
|
|
||||||
SerialPlugin *serialPlugin;
|
SerialPlugin *serialPlugin;
|
||||||
SerialPluginRadio *serialPluginRadio;
|
SerialPluginRadio *serialPluginRadio;
|
||||||
|
@ -70,17 +65,30 @@ char serialStringChar[Constants_DATA_PAYLOAD_LEN];
|
||||||
|
|
||||||
int32_t SerialPlugin::runOnce()
|
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.
|
// Interface with the serial peripheral from in here.
|
||||||
DEBUG_MSG("Initilizing serial peripheral interface\n");
|
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);
|
||||||
|
|
||||||
|
} else {
|
||||||
Serial2.begin(SERIALPLUGIN_BAUD, SERIAL_8N1, RXD2, TXD2);
|
Serial2.begin(SERIALPLUGIN_BAUD, SERIAL_8N1, RXD2, TXD2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (radioConfig.preferences.serialplugin_timeout) {
|
||||||
|
Serial2.setTimeout(
|
||||||
|
radioConfig.preferences.serialplugin_timeout); // Number of MS to wait to set the timeout for the string.
|
||||||
|
|
||||||
|
} else {
|
||||||
Serial2.setTimeout(SERIALPLUGIN_TIMEOUT); // Number of MS to wait to set the timeout for the string.
|
Serial2.setTimeout(SERIALPLUGIN_TIMEOUT); // Number of MS to wait to set the timeout for the string.
|
||||||
|
}
|
||||||
|
|
||||||
Serial2.setRxBufferSize(SERIALPLUGIN_RX_BUFFER);
|
Serial2.setRxBufferSize(SERIALPLUGIN_RX_BUFFER);
|
||||||
|
|
||||||
serialPluginRadio = new SerialPluginRadio();
|
serialPluginRadio = new SerialPluginRadio();
|
||||||
|
@ -101,11 +109,11 @@ int32_t SerialPlugin::runOnce()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (10);
|
return (10);
|
||||||
#else
|
} else {
|
||||||
DEBUG_MSG("Serial Plugin Disabled\n");
|
DEBUG_MSG("Serial Plugin Disabled\n");
|
||||||
|
|
||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -134,10 +142,9 @@ void SerialPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
|
||||||
|
|
||||||
bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
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;
|
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(),
|
// DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n", nodeDB.getNodeNum(),
|
||||||
|
@ -146,10 +153,10 @@ bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
||||||
if (mp.from == nodeDB.getNodeNum()) {
|
if (mp.from == nodeDB.getNodeNum()) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If SERIALPLUGIN_ECHO is true, then echo the packets that are sent out back to the TX
|
* If radioConfig.preferences.serialplugin_echo is true, then echo the packets that are sent out back to the TX
|
||||||
* of the serial interface.
|
* of the serial interface.
|
||||||
*/
|
*/
|
||||||
if (SERIALPLUGIN_ECHO) {
|
if (radioConfig.preferences.serialplugin_echo) {
|
||||||
|
|
||||||
// For some reason, we get the packet back twice when we send out of the radio.
|
// For some reason, we get the packet back twice when we send out of the radio.
|
||||||
// TODO: need to find out why.
|
// TODO: need to find out why.
|
||||||
|
@ -167,10 +174,9 @@ bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
||||||
Serial2.printf("%s", p.payload.bytes);
|
Serial2.printf("%s", p.payload.bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
} else {
|
||||||
DEBUG_MSG("Serial Plugin Disabled\n");
|
DEBUG_MSG("Serial Plugin Disabled\n");
|
||||||
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ class SerialPluginRadio : public SinglePortPlugin
|
||||||
from the main code.
|
from the main code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
||||||
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
|
SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send our payload into the mesh
|
* Send our payload into the mesh
|
||||||
|
|
Ładowanie…
Reference in New Issue