mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
Compare commits
51 Commits
v2.0.16.22
...
v2.0.18.1a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a7991c606 | ||
|
|
490ef459e5 | ||
|
|
40b7d783ed | ||
|
|
6a2583e872 | ||
|
|
3a3451129a | ||
|
|
81d2486cf4 | ||
|
|
9d420f403a | ||
|
|
c82d1de9ce | ||
|
|
9a950afd2a | ||
|
|
ab77772e0c | ||
|
|
ac90c27ae8 | ||
|
|
d6de042783 | ||
|
|
2b15d951cf | ||
|
|
0414ca2dc0 | ||
|
|
7a50934185 | ||
|
|
1fa2ca6a14 | ||
|
|
51521462c4 | ||
|
|
4aaf162700 | ||
|
|
5794a9ae06 | ||
|
|
835e6ab85e | ||
|
|
b97e61d8f8 | ||
|
|
d9031610ab | ||
|
|
a8dd497575 | ||
|
|
971ecd117c | ||
|
|
e8e04d23d7 | ||
|
|
3c6bbff4f9 | ||
|
|
f6c6c2912f | ||
|
|
a13adfb598 | ||
|
|
c908e61611 | ||
|
|
3dda6e14f7 | ||
|
|
f0f819f403 | ||
|
|
39bb9f21ac | ||
|
|
7750dd2d46 | ||
|
|
d02588ad85 | ||
|
|
e4342d9715 | ||
|
|
04add9b91e | ||
|
|
5e1c39eb0f | ||
|
|
5d1c06b72f | ||
|
|
1407952410 | ||
|
|
860aca9335 | ||
|
|
5c22901ff1 | ||
|
|
27bd4fa32e | ||
|
|
2be805ce81 | ||
|
|
0a3e512387 | ||
|
|
7b249deb26 | ||
|
|
7aa4e94e45 | ||
|
|
dab2bb3bcc | ||
|
|
afcd7acfab | ||
|
|
0188edb342 | ||
|
|
cd6d8e519b | ||
|
|
02f49d5347 |
@@ -1,8 +1,6 @@
|
||||
; Common settings for rp2040 Processor based targets
|
||||
[rp2040_base]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#20c7dbfcfe6677c5305fa28ecf5e3870321cb157
|
||||
platform_packages =
|
||||
earlephilhower/toolchain-rp2040-earlephilhower@^5.100300.221223
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9f8c10e50b5acd18e7bfd32638199c655be73a5b
|
||||
extends = arduino_base
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
|
||||
Submodule protobufs updated: 9b65349121...516074f2e4
@@ -17,4 +17,14 @@
|
||||
extern const uint8_t MESH_SERVICE_UUID_16[], TORADIO_UUID_16[16u], FROMRADIO_UUID_16[], FROMNUM_UUID_16[];
|
||||
|
||||
/// Given a level between 0-100, update the BLE attribute
|
||||
void updateBatteryLevel(uint8_t level);
|
||||
void updateBatteryLevel(uint8_t level);
|
||||
|
||||
class BluetoothApi
|
||||
{
|
||||
public:
|
||||
virtual void setup();
|
||||
virtual void shutdown();
|
||||
virtual void clearBonds();
|
||||
virtual bool isConnected();
|
||||
virtual int getRssi() = 0;
|
||||
};
|
||||
@@ -380,13 +380,16 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
tm *tm = localtime(reinterpret_cast<const time_t *>(&mp.rx_time));
|
||||
uint32_t seconds = sinceReceived(&mp);
|
||||
uint32_t minutes = seconds / 60;
|
||||
uint32_t hours = minutes / 60;
|
||||
uint32_t days = hours / 24;
|
||||
|
||||
if (config.display.heading_bold) {
|
||||
display->drawStringf(1 + x, 0 + y, tempBuf, "[%02d:%02d:%02d] From: %s", tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
display->drawStringf(1 + x, 0 + y, tempBuf, "%s ago from %s", screen->drawTimeDelta(days, hours, minutes, seconds),
|
||||
(node && node->has_user) ? node->user.short_name : "???");
|
||||
}
|
||||
display->drawStringf(0 + x, 0 + y, tempBuf, "[%02d:%02d:%02d] From: %s", tm->tm_hour, tm->tm_min, tm->tm_sec,
|
||||
display->drawStringf(0 + x, 0 + y, tempBuf, "%s ago from %s", screen->drawTimeDelta(days, hours, minutes, seconds),
|
||||
(node && node->has_user) ? node->user.short_name : "???");
|
||||
|
||||
display->setColor(WHITE);
|
||||
@@ -417,38 +420,6 @@ static void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char *
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/// Draw a series of fields in a row, wrapping to multiple rows if needed
|
||||
/// @return the max y we ended up printing to
|
||||
static uint32_t drawRows(OLEDDisplay *display, int16_t x, int16_t y, const char **fields)
|
||||
{
|
||||
// The coordinates define the left starting point of the text
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
const char **f = fields;
|
||||
int xo = x, yo = y;
|
||||
const int COLUMNS = 2; // hardwired for two columns per row....
|
||||
int col = 0; // track which column we are on
|
||||
while (*f) {
|
||||
display->drawString(xo, yo, *f);
|
||||
xo += SCREEN_WIDTH / COLUMNS;
|
||||
// Wrap to next row, if needed.
|
||||
if (++col >= COLUMNS) {
|
||||
xo = x;
|
||||
yo += FONT_HEIGHT_SMALL;
|
||||
col = 0;
|
||||
}
|
||||
f++;
|
||||
}
|
||||
if (col != 0) {
|
||||
// Include last incomplete line in our total.
|
||||
yo += FONT_HEIGHT_SMALL;
|
||||
}
|
||||
|
||||
return yo;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Draw power bars or a charging indicator on an image of a battery, determined by battery charge voltage or percentage.
|
||||
static void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *imgBuffer, const PowerStatus *powerStatus)
|
||||
{
|
||||
@@ -1365,6 +1336,20 @@ void Screen::blink()
|
||||
dispdev.setBrightness(brightness);
|
||||
}
|
||||
|
||||
String Screen::drawTimeDelta(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds)
|
||||
{
|
||||
String uptime;
|
||||
if (days >= 2)
|
||||
uptime = String(days) + "d";
|
||||
else if (hours >= 2)
|
||||
uptime = String(hours) + "h";
|
||||
else if (minutes >= 1)
|
||||
uptime = String(minutes) + "m";
|
||||
else
|
||||
uptime = String(seconds) + "s";
|
||||
return uptime;
|
||||
}
|
||||
|
||||
void Screen::handlePrint(const char *text)
|
||||
{
|
||||
// the string passed into us probably has a newline, but that would confuse the logging system
|
||||
@@ -1729,15 +1714,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
||||
display->setColor(WHITE);
|
||||
|
||||
// Show uptime as days, hours, minutes OR seconds
|
||||
String uptime;
|
||||
if (days >= 2)
|
||||
uptime += String(days) + "d ";
|
||||
else if (hours >= 2)
|
||||
uptime += String(hours) + "h ";
|
||||
else if (minutes >= 1)
|
||||
uptime += String(minutes) + "m ";
|
||||
else
|
||||
uptime += String(seconds) + "s ";
|
||||
String uptime = screen->drawTimeDelta(days, hours, minutes, seconds);
|
||||
|
||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
||||
if (rtc_sec > 0) {
|
||||
@@ -1753,7 +1730,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
||||
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||
|
||||
char timebuf[9];
|
||||
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", hour, min, sec);
|
||||
snprintf(timebuf, sizeof(timebuf), " %02d:%02d:%02d", hour, min, sec);
|
||||
uptime += timebuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,9 @@ class Screen : public concurrency::OSThread
|
||||
}
|
||||
}
|
||||
|
||||
/// generates a very brief time delta display
|
||||
String drawTimeDelta(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds);
|
||||
|
||||
/// Overrides the default utf8 character conversion, to replace empty space with question marks
|
||||
static char customFontTableLookup(const uint8_t ch)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
#ifdef ARCH_ESP32
|
||||
#include "mesh/http/WebServer.h"
|
||||
#include "nimble/NimbleBluetooth.h"
|
||||
NimbleBluetooth *nimbleBluetooth;
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_NRF52
|
||||
#include "NRF52Bluetooth.h"
|
||||
NRF52Bluetooth *nrf52Bluetooth;
|
||||
#endif
|
||||
|
||||
#if HAS_WIFI
|
||||
|
||||
@@ -9,6 +9,14 @@
|
||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
||||
#endif
|
||||
#if defined(ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#include "nimble/NimbleBluetooth.h"
|
||||
extern NimbleBluetooth *nimbleBluetooth;
|
||||
#endif
|
||||
#ifdef ARCH_NRF52
|
||||
#include "NRF52Bluetooth.h"
|
||||
extern NRF52Bluetooth *nrf52Bluetooth;
|
||||
#endif
|
||||
|
||||
extern uint8_t screen_found;
|
||||
extern uint8_t screen_model;
|
||||
|
||||
@@ -59,11 +59,6 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
||||
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY) {
|
||||
LOG_DEBUG("Cancelling rebroadcast of message from node on a foreign mesh, due to local only rebroadcast mode\n");
|
||||
Router::cancelSending(p->to, p->decoded.request_id);
|
||||
}
|
||||
// handle the packet as normal
|
||||
Router::sniffReceived(p, c);
|
||||
}
|
||||
|
||||
@@ -599,6 +599,17 @@ uint32_t sinceLastSeen(const meshtastic_NodeInfo *n)
|
||||
return delta;
|
||||
}
|
||||
|
||||
uint32_t sinceReceived(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
uint32_t now = getTime();
|
||||
|
||||
int delta = (int)(now - p->rx_time);
|
||||
if (delta < 0) // our clock must be slightly off still - not set from GPS yet
|
||||
delta = 0;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
#define NUM_ONLINE_SECS (60 * 60 * 2) // 2 hrs to consider someone offline
|
||||
|
||||
size_t NodeDB::getNumOnlineNodes()
|
||||
|
||||
@@ -32,6 +32,9 @@ extern meshtastic_User &owner;
|
||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n);
|
||||
|
||||
/// Given a packet, return how many seconds in the past (vs now) it was received
|
||||
uint32_t sinceReceived(const meshtastic_MeshPacket *p);
|
||||
|
||||
class NodeDB
|
||||
{
|
||||
// NodeNum provisionalNodeNum; // if we are trying to find a node num this is our current attempt
|
||||
|
||||
@@ -227,7 +227,8 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
||||
uint8_t CWsize = map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
|
||||
// LOG_DEBUG("rx_snr of %f so setting CWsize to:%d\n", snr, CWsize);
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT) {
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
delay = random(0, 2 * CWsize) * slotTimeMsec;
|
||||
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
|
||||
} else {
|
||||
@@ -460,10 +461,16 @@ void RadioInterface::applyModemConfig()
|
||||
// New frequency selection formula
|
||||
float freq = myRegion->freqStart + (bw / 2000) + (channel_num * (bw / 1000));
|
||||
|
||||
saveChannelNum(channel_num);
|
||||
saveFreq(freq + config.lora.frequency_offset);
|
||||
// override if we have a verbatim frequency
|
||||
if (loraConfig.override_frequency) {
|
||||
freq = loraConfig.override_frequency;
|
||||
channel_num = -1;
|
||||
}
|
||||
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset);
|
||||
saveChannelNum(channel_num);
|
||||
saveFreq(freq + loraConfig.frequency_offset);
|
||||
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset,
|
||||
channel_num, power);
|
||||
LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
|
||||
|
||||
@@ -108,20 +108,15 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
|
||||
|
||||
if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
|
||||
if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "meshtastic/device_metadata.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
#include "meshtastic/module_config.pb.h"
|
||||
#include "meshtastic/connection_status.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -91,6 +92,10 @@ typedef struct _meshtastic_AdminMessage {
|
||||
bool get_ringtone_request;
|
||||
/* Get the Ringtone in the response to this message. */
|
||||
char get_ringtone_response[231];
|
||||
/* Request the node to send it's connection status */
|
||||
bool get_device_connection_status_request;
|
||||
/* Device connection status response */
|
||||
meshtastic_DeviceConnectionStatus get_device_connection_status_response;
|
||||
/* Set the owner for this node */
|
||||
meshtastic_User set_owner;
|
||||
/* Set channels (using the new API).
|
||||
@@ -166,6 +171,8 @@ extern "C" {
|
||||
#define meshtastic_AdminMessage_get_device_metadata_response_tag 13
|
||||
#define meshtastic_AdminMessage_get_ringtone_request_tag 14
|
||||
#define meshtastic_AdminMessage_get_ringtone_response_tag 15
|
||||
#define meshtastic_AdminMessage_get_device_connection_status_request_tag 16
|
||||
#define meshtastic_AdminMessage_get_device_connection_status_response_tag 17
|
||||
#define meshtastic_AdminMessage_set_owner_tag 32
|
||||
#define meshtastic_AdminMessage_set_channel_tag 33
|
||||
#define meshtastic_AdminMessage_set_config_tag 34
|
||||
@@ -197,6 +204,8 @@ X(a, STATIC, ONEOF, BOOL, (payload_variant,get_device_metadata_request,
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_device_metadata_response,get_device_metadata_response), 13) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_ringtone_request,get_ringtone_request), 14) \
|
||||
X(a, STATIC, ONEOF, STRING, (payload_variant,get_ringtone_response,get_ringtone_response), 15) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_device_connection_status_request,get_device_connection_status_request), 16) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_device_connection_status_response,get_device_connection_status_response), 17) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_owner,set_owner), 32) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_channel,set_channel), 33) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_config,set_config), 34) \
|
||||
@@ -218,6 +227,7 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,nodedb_reset,nodedb_reset),
|
||||
#define meshtastic_AdminMessage_payload_variant_get_config_response_MSGTYPE meshtastic_Config
|
||||
#define meshtastic_AdminMessage_payload_variant_get_module_config_response_MSGTYPE meshtastic_ModuleConfig
|
||||
#define meshtastic_AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE meshtastic_DeviceMetadata
|
||||
#define meshtastic_AdminMessage_payload_variant_get_device_connection_status_response_MSGTYPE meshtastic_DeviceConnectionStatus
|
||||
#define meshtastic_AdminMessage_payload_variant_set_owner_MSGTYPE meshtastic_User
|
||||
#define meshtastic_AdminMessage_payload_variant_set_channel_MSGTYPE meshtastic_Channel
|
||||
#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config
|
||||
|
||||
@@ -54,7 +54,7 @@ extern const pb_msgdesc_t meshtastic_ChannelSet_msg;
|
||||
#define meshtastic_ChannelSet_fields &meshtastic_ChannelSet_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define meshtastic_ChannelSet_size 586
|
||||
#define meshtastic_ChannelSet_size 591
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -408,6 +408,12 @@ typedef struct _meshtastic_Config_LoRaConfig {
|
||||
bool override_duty_cycle;
|
||||
/* If true, sets RX boosted gain mode on SX126X based radios */
|
||||
bool sx126x_rx_boosted_gain;
|
||||
/* This parameter is for advanced users and licensed HAM radio operators.
|
||||
Ignore Channel Calculation and use this frequency instead. The frequency_offset
|
||||
will still be applied. This will allow you to use out-of-band frequencies.
|
||||
Please respect your local laws and regulations. If you are a HAM, make sure you
|
||||
enable HAM mode and turn off encryption. */
|
||||
float override_frequency;
|
||||
/* For testing it is useful sometimes to force a node to never listen to
|
||||
particular other nodes (simulating radio out of range). All nodenums listed
|
||||
in ignore_incoming will have packets they send droped on receive (by router.cpp) */
|
||||
@@ -515,7 +521,7 @@ extern "C" {
|
||||
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN}
|
||||
@@ -524,7 +530,7 @@ extern "C" {
|
||||
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0}
|
||||
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
@@ -585,6 +591,7 @@ extern "C" {
|
||||
#define meshtastic_Config_LoRaConfig_channel_num_tag 11
|
||||
#define meshtastic_Config_LoRaConfig_override_duty_cycle_tag 12
|
||||
#define meshtastic_Config_LoRaConfig_sx126x_rx_boosted_gain_tag 13
|
||||
#define meshtastic_Config_LoRaConfig_override_frequency_tag 14
|
||||
#define meshtastic_Config_LoRaConfig_ignore_incoming_tag 103
|
||||
#define meshtastic_Config_BluetoothConfig_enabled_tag 1
|
||||
#define meshtastic_Config_BluetoothConfig_mode_tag 2
|
||||
@@ -699,6 +706,7 @@ X(a, STATIC, SINGULAR, INT32, tx_power, 10) \
|
||||
X(a, STATIC, SINGULAR, UINT32, channel_num, 11) \
|
||||
X(a, STATIC, SINGULAR, BOOL, override_duty_cycle, 12) \
|
||||
X(a, STATIC, SINGULAR, BOOL, sx126x_rx_boosted_gain, 13) \
|
||||
X(a, STATIC, SINGULAR, FLOAT, override_frequency, 14) \
|
||||
X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103)
|
||||
#define meshtastic_Config_LoRaConfig_CALLBACK NULL
|
||||
#define meshtastic_Config_LoRaConfig_DEFAULT NULL
|
||||
@@ -735,7 +743,7 @@ extern const pb_msgdesc_t meshtastic_Config_BluetoothConfig_msg;
|
||||
#define meshtastic_Config_BluetoothConfig_size 10
|
||||
#define meshtastic_Config_DeviceConfig_size 20
|
||||
#define meshtastic_Config_DisplayConfig_size 26
|
||||
#define meshtastic_Config_LoRaConfig_size 72
|
||||
#define meshtastic_Config_LoRaConfig_size 77
|
||||
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
||||
#define meshtastic_Config_NetworkConfig_size 195
|
||||
#define meshtastic_Config_PositionConfig_size 42
|
||||
|
||||
27
src/mesh/generated/meshtastic/connection_status.pb.c
Normal file
27
src/mesh/generated/meshtastic/connection_status.pb.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#include "meshtastic/connection_status.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(meshtastic_DeviceConnectionStatus, meshtastic_DeviceConnectionStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_WifiConnectionStatus, meshtastic_WifiConnectionStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_EthernetConnectionStatus, meshtastic_EthernetConnectionStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_NetworkConnectionStatus, meshtastic_NetworkConnectionStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_BluetoothConnectionStatus, meshtastic_BluetoothConnectionStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(meshtastic_SerialConnectionStatus, meshtastic_SerialConnectionStatus, AUTO)
|
||||
|
||||
|
||||
|
||||
189
src/mesh/generated/meshtastic/connection_status.pb.h
Normal file
189
src/mesh/generated/meshtastic/connection_status.pb.h
Normal file
@@ -0,0 +1,189 @@
|
||||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.4.7 */
|
||||
|
||||
#ifndef PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED
|
||||
#define PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
/* Struct definitions */
|
||||
/* Ethernet or WiFi connection status */
|
||||
typedef struct _meshtastic_NetworkConnectionStatus {
|
||||
/* IP address of device */
|
||||
uint32_t ip_address;
|
||||
/* Whether the device has an active connection or not */
|
||||
bool is_connected;
|
||||
/* Whether the device has an active connection to an MQTT broker or not */
|
||||
bool is_mqtt_connected;
|
||||
/* Whether the device is actively remote syslogging or not */
|
||||
bool is_syslog_connected;
|
||||
} meshtastic_NetworkConnectionStatus;
|
||||
|
||||
/* WiFi connection status */
|
||||
typedef struct _meshtastic_WifiConnectionStatus {
|
||||
/* Connection status */
|
||||
bool has_status;
|
||||
meshtastic_NetworkConnectionStatus status;
|
||||
/* WiFi access point ssid */
|
||||
char ssid[33];
|
||||
/* Rssi of wireless connection */
|
||||
int32_t rssi;
|
||||
} meshtastic_WifiConnectionStatus;
|
||||
|
||||
/* Ethernet connection status */
|
||||
typedef struct _meshtastic_EthernetConnectionStatus {
|
||||
/* Connection status */
|
||||
bool has_status;
|
||||
meshtastic_NetworkConnectionStatus status;
|
||||
} meshtastic_EthernetConnectionStatus;
|
||||
|
||||
/* Bluetooth connection status */
|
||||
typedef struct _meshtastic_BluetoothConnectionStatus {
|
||||
/* The pairing pin for bluetooth */
|
||||
uint32_t pin;
|
||||
/* Rssi of bluetooth connection */
|
||||
int32_t rssi;
|
||||
/* Whether the device has an active connection or not */
|
||||
bool is_connected;
|
||||
} meshtastic_BluetoothConnectionStatus;
|
||||
|
||||
/* Serial connection status */
|
||||
typedef struct _meshtastic_SerialConnectionStatus {
|
||||
/* The serial baud rate */
|
||||
uint32_t baud;
|
||||
/* Whether the device has an active connection or not */
|
||||
bool is_connected;
|
||||
} meshtastic_SerialConnectionStatus;
|
||||
|
||||
typedef struct _meshtastic_DeviceConnectionStatus {
|
||||
/* WiFi Status */
|
||||
bool has_wifi;
|
||||
meshtastic_WifiConnectionStatus wifi;
|
||||
/* WiFi Status */
|
||||
bool has_ethernet;
|
||||
meshtastic_EthernetConnectionStatus ethernet;
|
||||
/* Bluetooth Status */
|
||||
bool has_bluetooth;
|
||||
meshtastic_BluetoothConnectionStatus bluetooth;
|
||||
/* Serial Status */
|
||||
bool has_serial;
|
||||
meshtastic_SerialConnectionStatus serial;
|
||||
} meshtastic_DeviceConnectionStatus;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define meshtastic_DeviceConnectionStatus_init_default {false, meshtastic_WifiConnectionStatus_init_default, false, meshtastic_EthernetConnectionStatus_init_default, false, meshtastic_BluetoothConnectionStatus_init_default, false, meshtastic_SerialConnectionStatus_init_default}
|
||||
#define meshtastic_WifiConnectionStatus_init_default {false, meshtastic_NetworkConnectionStatus_init_default, "", 0}
|
||||
#define meshtastic_EthernetConnectionStatus_init_default {false, meshtastic_NetworkConnectionStatus_init_default}
|
||||
#define meshtastic_NetworkConnectionStatus_init_default {0, 0, 0, 0}
|
||||
#define meshtastic_BluetoothConnectionStatus_init_default {0, 0, 0}
|
||||
#define meshtastic_SerialConnectionStatus_init_default {0, 0}
|
||||
#define meshtastic_DeviceConnectionStatus_init_zero {false, meshtastic_WifiConnectionStatus_init_zero, false, meshtastic_EthernetConnectionStatus_init_zero, false, meshtastic_BluetoothConnectionStatus_init_zero, false, meshtastic_SerialConnectionStatus_init_zero}
|
||||
#define meshtastic_WifiConnectionStatus_init_zero {false, meshtastic_NetworkConnectionStatus_init_zero, "", 0}
|
||||
#define meshtastic_EthernetConnectionStatus_init_zero {false, meshtastic_NetworkConnectionStatus_init_zero}
|
||||
#define meshtastic_NetworkConnectionStatus_init_zero {0, 0, 0, 0}
|
||||
#define meshtastic_BluetoothConnectionStatus_init_zero {0, 0, 0}
|
||||
#define meshtastic_SerialConnectionStatus_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define meshtastic_NetworkConnectionStatus_ip_address_tag 1
|
||||
#define meshtastic_NetworkConnectionStatus_is_connected_tag 2
|
||||
#define meshtastic_NetworkConnectionStatus_is_mqtt_connected_tag 3
|
||||
#define meshtastic_NetworkConnectionStatus_is_syslog_connected_tag 4
|
||||
#define meshtastic_WifiConnectionStatus_status_tag 1
|
||||
#define meshtastic_WifiConnectionStatus_ssid_tag 2
|
||||
#define meshtastic_WifiConnectionStatus_rssi_tag 3
|
||||
#define meshtastic_EthernetConnectionStatus_status_tag 1
|
||||
#define meshtastic_BluetoothConnectionStatus_pin_tag 1
|
||||
#define meshtastic_BluetoothConnectionStatus_rssi_tag 2
|
||||
#define meshtastic_BluetoothConnectionStatus_is_connected_tag 3
|
||||
#define meshtastic_SerialConnectionStatus_baud_tag 1
|
||||
#define meshtastic_SerialConnectionStatus_is_connected_tag 2
|
||||
#define meshtastic_DeviceConnectionStatus_wifi_tag 1
|
||||
#define meshtastic_DeviceConnectionStatus_ethernet_tag 2
|
||||
#define meshtastic_DeviceConnectionStatus_bluetooth_tag 3
|
||||
#define meshtastic_DeviceConnectionStatus_serial_tag 4
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define meshtastic_DeviceConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, wifi, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, ethernet, 2) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, bluetooth, 3) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, serial, 4)
|
||||
#define meshtastic_DeviceConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_DeviceConnectionStatus_DEFAULT NULL
|
||||
#define meshtastic_DeviceConnectionStatus_wifi_MSGTYPE meshtastic_WifiConnectionStatus
|
||||
#define meshtastic_DeviceConnectionStatus_ethernet_MSGTYPE meshtastic_EthernetConnectionStatus
|
||||
#define meshtastic_DeviceConnectionStatus_bluetooth_MSGTYPE meshtastic_BluetoothConnectionStatus
|
||||
#define meshtastic_DeviceConnectionStatus_serial_MSGTYPE meshtastic_SerialConnectionStatus
|
||||
|
||||
#define meshtastic_WifiConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, status, 1) \
|
||||
X(a, STATIC, SINGULAR, STRING, ssid, 2) \
|
||||
X(a, STATIC, SINGULAR, INT32, rssi, 3)
|
||||
#define meshtastic_WifiConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_WifiConnectionStatus_DEFAULT NULL
|
||||
#define meshtastic_WifiConnectionStatus_status_MSGTYPE meshtastic_NetworkConnectionStatus
|
||||
|
||||
#define meshtastic_EthernetConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, status, 1)
|
||||
#define meshtastic_EthernetConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_EthernetConnectionStatus_DEFAULT NULL
|
||||
#define meshtastic_EthernetConnectionStatus_status_MSGTYPE meshtastic_NetworkConnectionStatus
|
||||
|
||||
#define meshtastic_NetworkConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, ip_address, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_connected, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_mqtt_connected, 3) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_syslog_connected, 4)
|
||||
#define meshtastic_NetworkConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_NetworkConnectionStatus_DEFAULT NULL
|
||||
|
||||
#define meshtastic_BluetoothConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, pin, 1) \
|
||||
X(a, STATIC, SINGULAR, INT32, rssi, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_connected, 3)
|
||||
#define meshtastic_BluetoothConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_BluetoothConnectionStatus_DEFAULT NULL
|
||||
|
||||
#define meshtastic_SerialConnectionStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, baud, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, is_connected, 2)
|
||||
#define meshtastic_SerialConnectionStatus_CALLBACK NULL
|
||||
#define meshtastic_SerialConnectionStatus_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t meshtastic_DeviceConnectionStatus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_WifiConnectionStatus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_EthernetConnectionStatus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_NetworkConnectionStatus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_BluetoothConnectionStatus_msg;
|
||||
extern const pb_msgdesc_t meshtastic_SerialConnectionStatus_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define meshtastic_DeviceConnectionStatus_fields &meshtastic_DeviceConnectionStatus_msg
|
||||
#define meshtastic_WifiConnectionStatus_fields &meshtastic_WifiConnectionStatus_msg
|
||||
#define meshtastic_EthernetConnectionStatus_fields &meshtastic_EthernetConnectionStatus_msg
|
||||
#define meshtastic_NetworkConnectionStatus_fields &meshtastic_NetworkConnectionStatus_msg
|
||||
#define meshtastic_BluetoothConnectionStatus_fields &meshtastic_BluetoothConnectionStatus_msg
|
||||
#define meshtastic_SerialConnectionStatus_fields &meshtastic_SerialConnectionStatus_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define meshtastic_BluetoothConnectionStatus_size 19
|
||||
#define meshtastic_DeviceConnectionStatus_size 106
|
||||
#define meshtastic_EthernetConnectionStatus_size 13
|
||||
#define meshtastic_NetworkConnectionStatus_size 11
|
||||
#define meshtastic_SerialConnectionStatus_size 8
|
||||
#define meshtastic_WifiConnectionStatus_size 58
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,7 @@
|
||||
#define PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "meshtastic/config.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
@@ -29,6 +30,8 @@ typedef struct _meshtastic_DeviceMetadata {
|
||||
meshtastic_Config_DeviceConfig_Role role;
|
||||
/* Indicates the device's current enabled position flags */
|
||||
uint32_t position_flags;
|
||||
/* Device hardware model */
|
||||
meshtastic_HardwareModel hw_model;
|
||||
} meshtastic_DeviceMetadata;
|
||||
|
||||
|
||||
@@ -37,8 +40,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0}
|
||||
#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0}
|
||||
#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN}
|
||||
#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define meshtastic_DeviceMetadata_firmware_version_tag 1
|
||||
@@ -49,6 +52,7 @@ extern "C" {
|
||||
#define meshtastic_DeviceMetadata_hasEthernet_tag 6
|
||||
#define meshtastic_DeviceMetadata_role_tag 7
|
||||
#define meshtastic_DeviceMetadata_position_flags_tag 8
|
||||
#define meshtastic_DeviceMetadata_hw_model_tag 9
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define meshtastic_DeviceMetadata_FIELDLIST(X, a) \
|
||||
@@ -59,7 +63,8 @@ X(a, STATIC, SINGULAR, BOOL, hasWifi, 4) \
|
||||
X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \
|
||||
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \
|
||||
X(a, STATIC, SINGULAR, UENUM, role, 7) \
|
||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 8)
|
||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 8) \
|
||||
X(a, STATIC, SINGULAR, UENUM, hw_model, 9)
|
||||
#define meshtastic_DeviceMetadata_CALLBACK NULL
|
||||
#define meshtastic_DeviceMetadata_DEFAULT NULL
|
||||
|
||||
@@ -69,7 +74,7 @@ extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg;
|
||||
#define meshtastic_DeviceMetadata_fields &meshtastic_DeviceMetadata_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define meshtastic_DeviceMetadata_size 41
|
||||
#define meshtastic_DeviceMetadata_size 44
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
#include "meshtastic/channel.pb.h"
|
||||
#include "meshtastic/localonly.pb.h"
|
||||
#include "meshtastic/mesh.pb.h"
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
@@ -85,6 +86,12 @@ typedef struct _meshtastic_OEMStore {
|
||||
char oem_text[40];
|
||||
/* The default device encryption key, 16 or 32 byte */
|
||||
meshtastic_OEMStore_oem_aes_key_t oem_aes_key;
|
||||
/* A Preset LocalConfig to apply during factory reset */
|
||||
bool has_oem_local_config;
|
||||
meshtastic_LocalConfig oem_local_config;
|
||||
/* A Preset LocalModuleConfig to apply during factory reset */
|
||||
bool has_oem_local_module_config;
|
||||
meshtastic_LocalModuleConfig oem_local_module_config;
|
||||
} meshtastic_OEMStore;
|
||||
|
||||
|
||||
@@ -105,10 +112,10 @@ extern "C" {
|
||||
/* Initializer values for message structs */
|
||||
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default}, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0}
|
||||
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
||||
#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}}
|
||||
#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default}
|
||||
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero}, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0}
|
||||
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
||||
#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}}
|
||||
#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define meshtastic_DeviceState_my_node_tag 2
|
||||
@@ -127,6 +134,8 @@ extern "C" {
|
||||
#define meshtastic_OEMStore_oem_font_tag 4
|
||||
#define meshtastic_OEMStore_oem_text_tag 5
|
||||
#define meshtastic_OEMStore_oem_aes_key_tag 6
|
||||
#define meshtastic_OEMStore_oem_local_config_tag 7
|
||||
#define meshtastic_OEMStore_oem_local_module_config_tag 8
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define meshtastic_DeviceState_FIELDLIST(X, a) \
|
||||
@@ -159,9 +168,13 @@ X(a, STATIC, SINGULAR, UINT32, oem_icon_height, 2) \
|
||||
X(a, STATIC, SINGULAR, BYTES, oem_icon_bits, 3) \
|
||||
X(a, STATIC, SINGULAR, UENUM, oem_font, 4) \
|
||||
X(a, STATIC, SINGULAR, STRING, oem_text, 5) \
|
||||
X(a, STATIC, SINGULAR, BYTES, oem_aes_key, 6)
|
||||
X(a, STATIC, SINGULAR, BYTES, oem_aes_key, 6) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, oem_local_config, 7) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, oem_local_module_config, 8)
|
||||
#define meshtastic_OEMStore_CALLBACK NULL
|
||||
#define meshtastic_OEMStore_DEFAULT NULL
|
||||
#define meshtastic_OEMStore_oem_local_config_MSGTYPE meshtastic_LocalConfig
|
||||
#define meshtastic_OEMStore_oem_local_module_config_MSGTYPE meshtastic_LocalModuleConfig
|
||||
|
||||
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
||||
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
||||
@@ -175,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define meshtastic_ChannelFile_size 638
|
||||
#define meshtastic_DeviceState_size 21800
|
||||
#define meshtastic_OEMStore_size 2140
|
||||
#define meshtastic_OEMStore_size 2992
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -156,7 +156,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
||||
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define meshtastic_LocalConfig_size 429
|
||||
#define meshtastic_LocalConfig_size 434
|
||||
#define meshtastic_LocalModuleConfig_size 412
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -2,17 +2,24 @@
|
||||
#include "Channels.h"
|
||||
#include "MeshService.h"
|
||||
#include "NodeDB.h"
|
||||
#include "PowerFSM.h"
|
||||
#ifdef ARCH_ESP32
|
||||
#include "BleOta.h"
|
||||
#endif
|
||||
#include "Router.h"
|
||||
#include "configuration.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifdef ARCH_NRF52
|
||||
#include "main.h"
|
||||
#endif
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
#if HAS_WIFI || HAS_ETHERNET
|
||||
#include "mqtt/MQTT.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_REBOOT_SECONDS 5
|
||||
|
||||
AdminModule *adminModule;
|
||||
@@ -159,6 +166,11 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
||||
break;
|
||||
}
|
||||
case meshtastic_AdminMessage_get_device_connection_status_request_tag: {
|
||||
LOG_INFO("Client is getting device connection status\n");
|
||||
handleGetDeviceConnectionStatus(mp);
|
||||
break;
|
||||
}
|
||||
#ifdef ARCH_PORTDUINO
|
||||
case meshtastic_AdminMessage_exit_simulator_tag:
|
||||
LOG_INFO("Exiting simulator\n");
|
||||
@@ -487,12 +499,74 @@ void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
||||
deviceMetadata.hasEthernet = HAS_ETHERNET;
|
||||
deviceMetadata.role = config.device.role;
|
||||
deviceMetadata.position_flags = config.position.position_flags;
|
||||
deviceMetadata.hw_model = HW_VENDOR;
|
||||
|
||||
r.get_device_metadata_response = deviceMetadata;
|
||||
r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag;
|
||||
myReply = allocDataProtobuf(r);
|
||||
}
|
||||
|
||||
void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req)
|
||||
{
|
||||
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||
|
||||
meshtastic_DeviceConnectionStatus conn;
|
||||
|
||||
conn.wifi = {0};
|
||||
#if HAS_WIFI
|
||||
conn.has_wifi = true;
|
||||
conn.wifi.has_status = true;
|
||||
#ifdef ARCH_PORTDUINO
|
||||
conn.wifi.status.is_connected = true;
|
||||
#else
|
||||
conn.wifi.status.is_connected = WiFi.status() != WL_CONNECTED;
|
||||
#endif
|
||||
strncpy(conn.wifi.ssid, config.network.wifi_ssid, 33);
|
||||
if (conn.wifi.status.is_connected) {
|
||||
conn.wifi.rssi = WiFi.RSSI();
|
||||
conn.wifi.status.ip_address = WiFi.localIP();
|
||||
conn.wifi.status.is_mqtt_connected = mqtt && mqtt->connected();
|
||||
conn.wifi.status.is_syslog_connected = false; // FIXME wire this up
|
||||
}
|
||||
#else
|
||||
conn.has_wifi = false;
|
||||
#endif
|
||||
|
||||
conn.ethernet = {0};
|
||||
#if HAS_ETHERNET
|
||||
conn.has_ethernet = true;
|
||||
conn.ethernet.has_status = true;
|
||||
if (Ethernet.linkStatus() == LinkON) {
|
||||
conn.ethernet.status.is_connected = true;
|
||||
conn.ethernet.status.ip_address = Ethernet.localIP();
|
||||
conn.ethernet.status.is_mqtt_connected = mqtt && mqtt->connected();
|
||||
conn.ethernet.status.is_syslog_connected = false; // FIXME wire this up
|
||||
} else {
|
||||
conn.ethernet.status.is_connected = false;
|
||||
}
|
||||
#else
|
||||
conn.has_ethernet = false;
|
||||
#endif
|
||||
|
||||
#if HAS_BLUETOOTH
|
||||
conn.has_bluetooth = true;
|
||||
conn.bluetooth.pin = config.bluetooth.fixed_pin;
|
||||
#endif
|
||||
#ifdef ARCH_ESP32
|
||||
conn.bluetooth.is_connected = nimbleBluetooth->isConnected();
|
||||
conn.bluetooth.rssi = nimbleBluetooth->getRssi();
|
||||
#elif defined(ARCH_NRF52)
|
||||
conn.bluetooth.is_connected = nrf52Bluetooth->isConnected();
|
||||
#endif
|
||||
conn.has_serial = true; // No serial-less devices
|
||||
conn.serial.is_connected = powerFSM.getState() == &stateSERIAL;
|
||||
conn.serial.baud = SERIAL_BAUD;
|
||||
|
||||
r.get_device_connection_status_response = conn;
|
||||
r.which_payload_variant = meshtastic_AdminMessage_get_device_connection_status_response_tag;
|
||||
myReply = allocDataProtobuf(r);
|
||||
}
|
||||
|
||||
void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex)
|
||||
{
|
||||
if (req.decoded.want_response) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
#include "ProtobufModule.h"
|
||||
#ifdef ARCH_ESP32
|
||||
#include "mesh/http/WiFiAPClient.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Admin module for admin messages
|
||||
@@ -31,7 +34,7 @@ class AdminModule : public ProtobufModule<meshtastic_AdminMessage>
|
||||
void handleGetModuleConfig(const meshtastic_MeshPacket &req, uint32_t configType);
|
||||
void handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex);
|
||||
void handleGetDeviceMetadata(const meshtastic_MeshPacket &req);
|
||||
|
||||
void handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req);
|
||||
/**
|
||||
* Setters
|
||||
*/
|
||||
|
||||
@@ -46,5 +46,5 @@ void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketI
|
||||
RoutingModule::RoutingModule() : ProtobufModule("routing", meshtastic_PortNum_ROUTING_APP, &meshtastic_Routing_msg)
|
||||
{
|
||||
isPromiscuous = true;
|
||||
encryptedOk = true;
|
||||
encryptedOk = config.device.rebroadcast_mode != meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
int32_t DeviceTelemetryModule::runOnce()
|
||||
{
|
||||
uint32_t now = millis();
|
||||
if ((lastSentToMesh == 0 ||
|
||||
(now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.device_update_interval)) &&
|
||||
if (((lastSentToMesh == 0) ||
|
||||
((now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.device_update_interval))) &&
|
||||
airTime->isTxAllowedChannelUtil() && airTime->isTxAllowedAirUtil()) {
|
||||
sendTelemetry();
|
||||
lastSentToMesh = now;
|
||||
@@ -35,8 +35,6 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
|
||||
t->variant.device_metrics.air_util_tx, t->variant.device_metrics.channel_utilization,
|
||||
t->variant.device_metrics.battery_level, t->variant.device_metrics.voltage);
|
||||
|
||||
lastMeasurementPacket = packetPool.allocCopy(mp);
|
||||
|
||||
nodeDB.updateTelemetry(getFrom(&mp), *t, RX_SRC_RADIO);
|
||||
}
|
||||
return false; // Let others look at this message also if they want
|
||||
@@ -63,7 +61,6 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
p->decoded.want_response = false;
|
||||
p->priority = meshtastic_MeshPacket_Priority_MIN;
|
||||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
|
||||
@@ -12,7 +12,6 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu
|
||||
: concurrency::OSThread("DeviceTelemetryModule"),
|
||||
ProtobufModule("DeviceTelemetry", meshtastic_PortNum_TELEMETRY_APP, &meshtastic_Telemetry_msg)
|
||||
{
|
||||
lastMeasurementPacket = nullptr;
|
||||
setIntervalFromNow(10 * 1000);
|
||||
}
|
||||
virtual bool wantUIFrame() { return false; }
|
||||
@@ -31,5 +30,4 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu
|
||||
private:
|
||||
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
||||
uint32_t lastSentToMesh = 0;
|
||||
const meshtastic_MeshPacket *lastMeasurementPacket;
|
||||
};
|
||||
|
||||
@@ -103,8 +103,8 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
||||
return result;
|
||||
|
||||
uint32_t now = millis();
|
||||
if ((lastSentToMesh == 0 ||
|
||||
(now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval)) &&
|
||||
if (((lastSentToMesh == 0) ||
|
||||
((now - lastSentToMesh) >= getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval))) &&
|
||||
airTime->isTxAllowedAirUtil()) {
|
||||
sendTelemetry();
|
||||
lastSentToMesh = now;
|
||||
@@ -193,6 +193,10 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac
|
||||
t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity,
|
||||
t->variant.environment_metrics.temperature, t->variant.environment_metrics.voltage);
|
||||
|
||||
// release previous packet before occupying a new spot
|
||||
if (lastMeasurementPacket != nullptr)
|
||||
packetPool.release(lastMeasurementPacket);
|
||||
|
||||
lastMeasurementPacket = packetPool.allocCopy(mp);
|
||||
}
|
||||
|
||||
@@ -244,6 +248,10 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
|
||||
p->decoded.want_response = false;
|
||||
p->priority = meshtastic_MeshPacket_Priority_MIN;
|
||||
|
||||
// release previous packet before occupying a new spot
|
||||
if (lastMeasurementPacket != nullptr)
|
||||
packetPool.release(lastMeasurementPacket);
|
||||
|
||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||
if (phoneOnly) {
|
||||
LOG_INFO("Sending packet to phone\n");
|
||||
|
||||
@@ -36,7 +36,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu
|
||||
private:
|
||||
float CelsiusToFahrenheit(float c);
|
||||
bool firstTime = 1;
|
||||
const meshtastic_MeshPacket *lastMeasurementPacket;
|
||||
meshtastic_MeshPacket *lastMeasurementPacket;
|
||||
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
||||
uint32_t lastSentToMesh = 0;
|
||||
uint32_t sensor_read_error_count = 0;
|
||||
|
||||
@@ -93,7 +93,6 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
|
||||
passkeyShowing = false;
|
||||
screen->stopBluetoothPinScreen();
|
||||
}
|
||||
// bluetoothPhoneAPI->setInitialState();
|
||||
}
|
||||
|
||||
virtual void onDisconnect(NimBLEServer *pServer, ble_gap_conn_desc *desc) { LOG_INFO("BLE disconnect\n"); }
|
||||
@@ -117,6 +116,21 @@ bool NimbleBluetooth::isActive()
|
||||
return bleServer;
|
||||
}
|
||||
|
||||
bool NimbleBluetooth::isConnected()
|
||||
{
|
||||
return bleServer->getConnectedCount() > 0;
|
||||
}
|
||||
|
||||
int NimbleBluetooth::getRssi()
|
||||
{
|
||||
if (bleServer && isConnected()) {
|
||||
auto service = bleServer->getServiceByUUID(MESH_SERVICE_UUID);
|
||||
uint16_t handle = service->getHandle();
|
||||
return NimBLEDevice::getClientByID(handle)->getRssi();
|
||||
}
|
||||
return 0; // FIXME figure out where to source this
|
||||
}
|
||||
|
||||
void NimbleBluetooth::setup()
|
||||
{
|
||||
// Uncomment for testing
|
||||
@@ -135,7 +149,6 @@ void NimbleBluetooth::setup()
|
||||
|
||||
NimbleBluetoothServerCallback *serverCallbacks = new NimbleBluetoothServerCallback();
|
||||
bleServer->setCallbacks(serverCallbacks, true);
|
||||
|
||||
setupService();
|
||||
startAdvertising();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
#include "BluetoothCommon.h"
|
||||
|
||||
class NimbleBluetooth
|
||||
class NimbleBluetooth : BluetoothApi
|
||||
{
|
||||
public:
|
||||
void setup();
|
||||
void shutdown();
|
||||
void clearBonds();
|
||||
bool isActive();
|
||||
bool isConnected();
|
||||
int getRssi();
|
||||
|
||||
private:
|
||||
void setupService();
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_WSL_V3
|
||||
#elif defined(TLORA_T3S3_V1)
|
||||
#define HW_VENDOR meshtastic_HardwareModel_TLORA_T3_S3
|
||||
#elif defined(BETAFPV_2400_TX)
|
||||
#define HW_VENDOR meshtastic_HardwareModel_BETAFPV_2400_TX
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
#include <nvs_flash.h>
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
NimbleBluetooth *nimbleBluetooth;
|
||||
|
||||
void setBluetoothEnable(bool on)
|
||||
{
|
||||
|
||||
if (!isWifiAvailable() && config.bluetooth.enabled == true) {
|
||||
if (!nimbleBluetooth) {
|
||||
nimbleBluetooth = new NimbleBluetooth();
|
||||
|
||||
@@ -213,6 +213,16 @@ void NRF52Bluetooth::shutdown()
|
||||
Bluefruit.Advertising.stop();
|
||||
}
|
||||
|
||||
bool NRF52Bluetooth::isConnected()
|
||||
{
|
||||
return Bluefruit.connected(connectionHandle);
|
||||
}
|
||||
|
||||
int NRF52Bluetooth::getRssi()
|
||||
{
|
||||
return 0; // FIXME figure out where to source this
|
||||
}
|
||||
|
||||
void NRF52Bluetooth::setup()
|
||||
{
|
||||
// Initialise the Bluefruit module
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
class NRF52Bluetooth
|
||||
class NRF52Bluetooth : BluetoothApi
|
||||
{
|
||||
public:
|
||||
void setup();
|
||||
void shutdown();
|
||||
void clearBonds();
|
||||
bool isConnected();
|
||||
int getRssi();
|
||||
|
||||
private:
|
||||
static void onConnectionSecured(uint16_t conn_handle);
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
#include <stdio.h>
|
||||
// #include <Adafruit_USBD_Device.h>
|
||||
#include "NodeDB.h"
|
||||
|
||||
#include "NRF52Bluetooth.h"
|
||||
#include "error.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifdef BQ25703A_ADDR
|
||||
#include "BQ25713.h"
|
||||
@@ -63,8 +62,6 @@ static void initBrownout()
|
||||
// We don't bother with setting up brownout if soft device is disabled - because during production we always use softdevice
|
||||
}
|
||||
|
||||
NRF52Bluetooth *nrf52Bluetooth;
|
||||
|
||||
static bool bleOn = false;
|
||||
static const bool useSoftDevice = true; // Set to false for easier debugging
|
||||
|
||||
|
||||
@@ -298,9 +298,18 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
if (pmu_found)
|
||||
gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_LOW_LEVEL); // pmu irq
|
||||
#endif
|
||||
assert(esp_sleep_enable_gpio_wakeup() == ESP_OK);
|
||||
assert(esp_sleep_enable_timer_wakeup(sleepUsec) == ESP_OK);
|
||||
assert(esp_light_sleep_start() == ESP_OK);
|
||||
auto res = esp_sleep_enable_gpio_wakeup();
|
||||
if (res != ESP_OK)
|
||||
LOG_DEBUG("esp_sleep_enable_gpio_wakeup result %d\n", res);
|
||||
assert(res == ESP_OK);
|
||||
res = esp_sleep_enable_timer_wakeup(sleepUsec);
|
||||
if (res != ESP_OK)
|
||||
LOG_DEBUG("esp_sleep_enable_timer_wakeup result %d\n", res);
|
||||
assert(res == ESP_OK);
|
||||
res = esp_light_sleep_start();
|
||||
if (res != ESP_OK)
|
||||
LOG_DEBUG("esp_light_sleep_start result %d\n", res);
|
||||
assert(res == ESP_OK);
|
||||
|
||||
esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause();
|
||||
#ifdef BUTTON_PIN
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[VERSION]
|
||||
major = 2
|
||||
minor = 0
|
||||
build = 16
|
||||
build = 18
|
||||
|
||||
Reference in New Issue
Block a user