Compare commits

..
17 changed files with 177 additions and 390 deletions
-39
View File
@@ -1,39 +0,0 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_MODE=0",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [["0x303A", "0x1001"]],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": ["wifi", "bluetooth", "lora"],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": ["esp-builtin"],
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "LilyGO T-Display S3 Pro LR1121 (16 MB FLASH, 8 MB PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 921600
},
"url": "https://lilygo.cc/en-de/products/t-display-s3-pro-lr1121",
"vendor": "LilyGO"
}
+1 -2
View File
@@ -126,8 +126,7 @@ lib_deps =
[device-ui_base]
lib_deps =
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
https://github.com/meshtastic/device-ui/archive/91d4f76d9fc523fb86ea31ebf48fd4bcdaea43c9.zip
https://github.com/meshtastic/device-ui/archive/7b1485b86c8d55a40e5226749097767e8b87f396.zip
; Common libs for environmental measurements in telemetry module
[environmental_base]
+7 -26
View File
@@ -1495,15 +1495,7 @@ bool Power::cw2015Init()
class LipoCharger : public HasBatteryLevel
{
private:
#if defined(XPOWERS_CHIP_SY6970)
#define PPM_ADDR SY6970_ADDR
#define CHARGE_TARGET_VOLTAGE 4352
#elif defined(XPOWERS_CHIP_BQ25896)
#define PPM_CLASS BQ27220
BQ27220 *bq = nullptr;
#define PPM_ADDR BQ25896_ADDR
#define CHARGE_TARGET_VOLTAGE 4288
#endif
public:
/**
@@ -1513,11 +1505,12 @@ class LipoCharger : public HasBatteryLevel
{
if (PPM == nullptr) {
PPM = new XPowersPPM;
bool result = PPM->init(Wire, I2C_SDA, I2C_SCL, PPM_ADDR);
bool result = PPM->init(Wire, I2C_SDA, I2C_SCL, BQ25896_ADDR);
if (result) {
LOG_INFO("PPM init succeeded");
LOG_INFO("PPM BQ25896 init succeeded");
// Set the minimum operating voltage. Below this voltage, the PPM will
// protect PPM->setSysPowerDownVoltage(3100);
// Set input current limit, default is 500mA
// PPM->setInputCurrentLimit(800);
@@ -1525,7 +1518,7 @@ class LipoCharger : public HasBatteryLevel
// PPM->disableCurrentLimitPin();
// Set the charging target voltage, Range:3840 ~ 4608mV ,step:16 mV
PPM->setChargeTargetVoltage(CHARGE_TARGET_VOLTAGE);
PPM->setChargeTargetVoltage(4288);
// Set the precharge current , Range: 64mA ~ 1024mA ,step:64mA
// PPM->setPrechargeCurr(64);
@@ -1549,9 +1542,8 @@ class LipoCharger : public HasBatteryLevel
return false;
}
}
#if HAS_BQ27220
if (bq == nullptr) {
bq = new PPM_CLASS;
bq = new BQ27220;
bq->setDefaultCapacity(BQ27220_DESIGN_CAPACITY);
bool result = bq->init();
@@ -1561,15 +1553,13 @@ class LipoCharger : public HasBatteryLevel
LOG_DEBUG("BQ27220 remaining capacity: %d", bq->getRemainingCapacity());
return true;
} else {
LOG_WARN("PPM init failed");
LOG_WARN("BQ27220 init failed");
delete bq;
bq = nullptr;
return false;
}
}
return false;
#endif
return true;
}
/**
@@ -1585,14 +1575,7 @@ class LipoCharger : public HasBatteryLevel
/**
* The raw voltage of the battery in millivolts, or NAN if unknown
*/
virtual uint16_t getBattVoltage() override
{
#if HAS_BQ27220
return bq->getVoltage();
#else
return PPM->getBattVoltage();
#endif
}
virtual uint16_t getBattVoltage() override { return bq->getVoltage(); }
/**
* return true if there is a battery installed in this unit
@@ -1610,7 +1593,6 @@ class LipoCharger : public HasBatteryLevel
virtual bool isCharging() override
{
bool isCharging = PPM->isCharging();
#if HAS_BQ27220
if (isCharging) {
LOG_DEBUG("BQ27220 time to full charge: %d min", bq->getTimeToFull());
} else {
@@ -1618,7 +1600,6 @@ class LipoCharger : public HasBatteryLevel
LOG_DEBUG("BQ27220 time to empty: %d min (%d mAh)", bq->getTimeToEmpty(), bq->getRemainingCapacity());
}
}
#endif
return isCharging;
}
};
+1 -1
View File
@@ -1496,7 +1496,7 @@ bool TFTDisplay::connect()
attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING);
#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2) || defined(HELTEC_MESH_NODE_T096)
tft->setRotation(1); // T-Deck has the TFT in landscape
#elif defined(T_WATCH_S3) || defined(T_DISPLAY_S3_PRO)
#elif defined(T_WATCH_S3)
tft->setRotation(2); // T-Watch S3 left-handed orientation
#elif ARCH_PORTDUINO || defined(SENSECAP_INDICATOR) || defined(T_LORA_PAGER)
tft->setRotation(0); // use config.yaml to set rotation
+1 -1
View File
@@ -681,7 +681,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32);
#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR) || \
defined(ELECROW_PANEL) || defined(HELTEC_V4_TFT) || defined(T_DISPLAY_S3_PRO)) && \
defined(ELECROW_PANEL) || defined(HELTEC_V4_TFT)) && \
HAS_TFT
// switch BT off by default; use TFT programming mode or hotkey to enable
config.bluetooth.enabled = false;
+125 -15
View File
@@ -18,10 +18,7 @@
#include "concurrency/LockGuard.h"
#include "main.h"
#include "xmodem.h"
#if FromRadio_size > MAX_TO_FROM_RADIO_SIZE
#error FromRadio is too big
#endif
#include <pb_encode.h>
#if ToRadio_size > MAX_TO_FROM_RADIO_SIZE
#error ToRadio is too big
@@ -61,13 +58,14 @@ void PhoneAPI::handleStartConfig()
onConfigStart();
// even if we were already connected - restart our state machine
if (config_nonce == SPECIAL_NONCE_ONLY_NODES) {
if (config_nonce == SPECIAL_NONCE_ONLY_NODES || config_nonce == SPECIAL_NONCE_BATCH_ONLY_NODES) {
// If client only wants node info, jump directly to sending nodes
state = STATE_SEND_OWN_NODEINFO;
LOG_INFO("Client only wants node info, skipping other config");
} else {
state = STATE_SEND_MY_INFO;
}
batchNodeInfo = (config_nonce == SPECIAL_NONCE_BATCH || config_nonce == SPECIAL_NONCE_BATCH_ONLY_NODES);
pauseBluetoothLogging = true;
spiLock->lock();
filesManifest = getFiles("/", 10);
@@ -223,6 +221,48 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
STATE_SEND_PACKETS // send packets or debug strings
*/
/// Context passed to the nanopb encoding callback for batched NodeInfo
struct NodeInfoBatchEncodeContext {
std::deque<meshtastic_NodeInfo> *items;
size_t itemCount; // How many items from the front of the deque to encode
};
/// Nanopb encoding callback for repeated NodeInfo items in a NodeInfoBatch.
/// Called by pb_encode during both sizing and actual encoding passes.
static bool nodeInfoBatchEncodeCallback(pb_ostream_t *stream, const pb_field_iter_t *field, void *const *arg)
{
auto *ctx = static_cast<NodeInfoBatchEncodeContext *>(*arg);
for (size_t i = 0; i < ctx->itemCount && i < ctx->items->size(); i++) {
if (!pb_encode_tag_for_field(stream, field))
return false;
if (!pb_encode_submessage(stream, meshtastic_NodeInfo_fields, &(*ctx->items)[i]))
return false;
}
return true;
}
/// Calculate how many NodeInfos from the front of the deque fit within maxPayloadBytes.
/// maxPayloadBytes is the budget for the inner NodeInfoBatch content (repeated field entries).
static size_t calculateBatchCount(std::deque<meshtastic_NodeInfo> &items, size_t maxPayloadBytes)
{
size_t totalSize = 0;
size_t count = 0;
for (const auto &info : items) {
pb_ostream_t sizestream = PB_OSTREAM_SIZING;
if (!pb_encode(&sizestream, meshtastic_NodeInfo_fields, &info))
break;
size_t itemSize = sizestream.bytes_written;
// Per-item overhead: 1 byte tag (field 1, wire type 2) + varint length prefix
size_t overhead = 1 + (itemSize < 128 ? 1 : 2);
if (totalSize + overhead + itemSize > maxPayloadBytes)
break;
totalSize += overhead + itemSize;
count++;
}
// Always include at least 1 item if available (even if it slightly exceeds budget)
return count > 0 ? count : (items.empty() ? 0 : 1);
}
size_t PhoneAPI::getFromRadio(uint8_t *buf)
{
// Respond to heartbeat by sending queue status
@@ -231,7 +271,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag;
fromRadioScratch.queueStatus = router->getQueueStatus();
heartbeatReceived = false;
size_t numbytes = pb_encode_to_bytes(buf, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch);
size_t numbytes = pb_encode_to_bytes(buf, MAX_TO_FROM_RADIO_SIZE, &meshtastic_FromRadio_msg, &fromRadioScratch);
LOG_DEBUG("FromRadio=STATE_SEND_QUEUE_STATUS, numbytes=%u", numbytes);
return numbytes;
}
@@ -286,7 +326,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
nodeInfoForPhone.num = 0;
}
}
if (config_nonce == SPECIAL_NONCE_ONLY_NODES) {
if (config_nonce == SPECIAL_NONCE_ONLY_NODES || config_nonce == SPECIAL_NONCE_BATCH_ONLY_NODES) {
// If client only wants node info, jump directly to sending nodes
state = STATE_SEND_OTHER_NODEINFOS;
onNowHasData(0);
@@ -479,6 +519,81 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
LOG_INFO("Start sending nodeinfos millis=%u", millis());
}
if (batchNodeInfo) {
// Batched path: pack multiple NodeInfos into a single FromRadio packet.
// Consolidate any pending nodeInfoForPhone into the queue, then top it up.
{
concurrency::LockGuard guard(&nodeInfoMutex);
if (nodeInfoForPhone.num != 0) {
nodeInfoQueue.push_front(nodeInfoForPhone);
nodeInfoForPhone = {};
}
}
prefetchNodeInfos();
bool queueEmpty;
{
concurrency::LockGuard guard(&nodeInfoMutex);
queueEmpty = nodeInfoQueue.empty();
}
if (queueEmpty) {
LOG_DEBUG("Done sending %d of %d nodeinfos (batched) millis=%u", readIndex, nodeDB->getNumMeshNodes(), millis());
concurrency::LockGuard guard(&nodeInfoMutex);
nodeInfoQueue.clear();
state = STATE_SEND_FILEMANIFEST;
return getFromRadio(buf);
}
// Fix up user IDs and log progress
{
concurrency::LockGuard guard(&nodeInfoMutex);
for (auto &info : nodeInfoQueue) {
sprintf(info.user.id, "!%08x", info.num);
}
}
// Estimate overhead: FromRadio id (~2B) + oneof tag 18 (~2B) + NodeInfoBatch length varint (~2B) = ~6 bytes
constexpr size_t kFromRadioOverhead = 10; // conservative
size_t batchCount;
{
concurrency::LockGuard guard(&nodeInfoMutex);
batchCount = calculateBatchCount(nodeInfoQueue, MAX_TO_FROM_RADIO_SIZE - kFromRadioOverhead);
}
if (readIndex == 2 || readIndex % 20 == 0) {
concurrency::LockGuard guard(&nodeInfoMutex);
LOG_DEBUG("nodeinfo batch: %d items, %d/%d total", batchCount, readIndex, nodeDB->getNumMeshNodes());
}
// Use a local FromRadio so the callback context pointer doesn't outlive its scope.
meshtastic_FromRadio batchRadio = {};
NodeInfoBatchEncodeContext ctx;
{
concurrency::LockGuard guard(&nodeInfoMutex);
ctx.items = &nodeInfoQueue;
ctx.itemCount = batchCount;
}
batchRadio.which_payload_variant = meshtastic_FromRadio_node_info_batch_tag;
batchRadio.node_info_batch.items.funcs.encode = nodeInfoBatchEncodeCallback;
batchRadio.node_info_batch.items.arg = &ctx;
size_t numbytes = pb_encode_to_bytes(buf, MAX_TO_FROM_RADIO_SIZE, &meshtastic_FromRadio_msg, &batchRadio);
// Remove consumed items from the queue
{
concurrency::LockGuard guard(&nodeInfoMutex);
for (size_t i = 0; i < batchCount && !nodeInfoQueue.empty(); i++) {
nodeInfoQueue.pop_front();
}
}
prefetchNodeInfos();
return numbytes;
}
// Non-batched path: send one NodeInfo per FromRadio packet (legacy behavior)
meshtastic_NodeInfo infoToSend = {};
{
concurrency::LockGuard guard(&nodeInfoMutex);
@@ -496,11 +611,6 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Just in case we stored a different user.id in the past, but should never happen going forward
sprintf(infoToSend.user.id, "!%08x", infoToSend.num);
// Logging this really slows down sending nodes on initial connection because the serial console is so slow, so only
// uncomment if you really need to:
// LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
// nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name);
// Occasional progress logging. (readIndex==2 will be true for the first non-us node)
if (readIndex == 2 || readIndex % 20 == 0) {
LOG_DEBUG("nodeinfo: %d/%d", readIndex, nodeDB->getNumMeshNodes());
@@ -523,8 +633,8 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_FILEMANIFEST: {
LOG_DEBUG("FromRadio=STATE_SEND_FILEMANIFEST");
// last element
if (config_state == filesManifest.size() ||
config_nonce == SPECIAL_NONCE_ONLY_NODES) { // also handles an empty filesManifest
if (config_state == filesManifest.size() || config_nonce == SPECIAL_NONCE_ONLY_NODES ||
config_nonce == SPECIAL_NONCE_BATCH_ONLY_NODES) { // also handles an empty filesManifest
config_state = 0;
filesManifest.clear();
// Skip to complete packet
@@ -579,7 +689,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Do we have a message from the mesh?
if (fromRadioScratch.which_payload_variant != 0) {
// Encapsulate as a FromRadio packet
size_t numbytes = pb_encode_to_bytes(buf, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch);
size_t numbytes = pb_encode_to_bytes(buf, MAX_TO_FROM_RADIO_SIZE, &meshtastic_FromRadio_msg, &fromRadioScratch);
// VERY IMPORTANT to not print debug messages while writing to fromRadioScratch - because we use that same buffer
// for logging (when we are encapsulating with protobufs)
+5 -3
View File
@@ -13,15 +13,14 @@
// Make sure that we never let our packets grow too large for one BLE packet
#define MAX_TO_FROM_RADIO_SIZE 512
#if meshtastic_FromRadio_size > MAX_TO_FROM_RADIO_SIZE
#error "meshtastic_FromRadio_size is too large for our BLE packets"
#endif
#if meshtastic_ToRadio_size > MAX_TO_FROM_RADIO_SIZE
#error "meshtastic_ToRadio_size is too large for our BLE packets"
#endif
#define SPECIAL_NONCE_ONLY_CONFIG 69420
#define SPECIAL_NONCE_ONLY_NODES 69421 // ( ͡° ͜ʖ ͡°)
#define SPECIAL_NONCE_BATCH 69422
#define SPECIAL_NONCE_BATCH_ONLY_NODES 69423
/**
* Provides our protobuf based API which phone/PC clients can use to talk to our device
@@ -88,6 +87,9 @@ class PhoneAPI
// Protect nodeInfoForPhone + nodeInfoQueue because NimBLE callbacks run in a separate FreeRTOS task.
concurrency::Lock nodeInfoMutex;
// When true, bundle multiple NodeInfos per FromRadio packet (opt-in via batch nonce)
bool batchNodeInfo = false;
meshtastic_ToRadio toRadioScratch = {
0}; // this is a static scratch object, any data must be copied elsewhere before returning
+2 -2
View File
@@ -190,7 +190,7 @@ void StreamAPI::emitRebooted()
fromRadioScratch.rebooted = true;
// LOG_DEBUG("Emitting reboot packet for serial shell");
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch));
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, MAX_TO_FROM_RADIO_SIZE, &meshtastic_FromRadio_msg, &fromRadioScratch));
}
void StreamAPI::emitLogRecord(meshtastic_LogRecord_Level level, const char *src, const char *format, va_list arg)
@@ -209,7 +209,7 @@ void StreamAPI::emitLogRecord(meshtastic_LogRecord_Level level, const char *src,
if (num_printed > 0 && fromRadioScratch.log_record.message[num_printed - 1] ==
'\n') // Strip any ending newline, because we have records for framing instead.
fromRadioScratch.log_record.message[num_printed - 1] = '\0';
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch));
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, MAX_TO_FROM_RADIO_SIZE, &meshtastic_FromRadio_msg, &fromRadioScratch));
}
/// Hookable to find out when connection changes
@@ -42,6 +42,9 @@ PB_BIND(meshtastic_MeshPacket, meshtastic_MeshPacket, 2)
PB_BIND(meshtastic_NodeInfo, meshtastic_NodeInfo, 2)
PB_BIND(meshtastic_NodeInfoBatch, meshtastic_NodeInfoBatch, AUTO)
PB_BIND(meshtastic_MyNodeInfo, meshtastic_MyNodeInfo, AUTO)
+28 -3
View File
@@ -1037,6 +1037,12 @@ typedef struct _meshtastic_NodeInfo {
bool is_muted;
} meshtastic_NodeInfo;
/* Batched NodeInfo wrapper for efficient bulk transfer during want_config flow.
Allows multiple NodeInfo messages to be packed into a single FromRadio packet. */
typedef struct _meshtastic_NodeInfoBatch {
pb_callback_t items;
} meshtastic_NodeInfoBatch;
typedef PB_BYTES_ARRAY_T(16) meshtastic_MyNodeInfo_device_id_t;
/* Unique local debugging info for this node
Note: we don't include position or the user info, because that will come in the
@@ -1262,6 +1268,9 @@ typedef struct _meshtastic_FromRadio {
meshtastic_ClientNotification clientNotification;
/* Persistent data for device-ui */
meshtastic_DeviceUIConfig deviceuiConfig;
/* Batched NodeInfo messages for efficient bulk transfer.
Used when client opts in via special nonce value. */
meshtastic_NodeInfoBatch node_info_batch;
};
} meshtastic_FromRadio;
@@ -1421,6 +1430,7 @@ extern "C" {
#define meshtastic_MeshPacket_transport_mechanism_ENUMTYPE meshtastic_MeshPacket_TransportMechanism
#define meshtastic_MyNodeInfo_firmware_edition_ENUMTYPE meshtastic_FirmwareEdition
#define meshtastic_LogRecord_level_ENUMTYPE meshtastic_LogRecord_Level
@@ -1462,6 +1472,7 @@ extern "C" {
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0, 0}
#define meshtastic_NodeInfoBatch_init_default {{{NULL}, NULL}}
#define meshtastic_MyNodeInfo_init_default {0, 0, 0, {0, {0}}, "", _meshtastic_FirmwareEdition_MIN, 0}
#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN}
#define meshtastic_QueueStatus_init_default {0, 0, 0, 0}
@@ -1495,6 +1506,7 @@ extern "C" {
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0, 0}
#define meshtastic_NodeInfoBatch_init_zero {{{NULL}, NULL}}
#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, {0, {0}}, "", _meshtastic_FirmwareEdition_MIN, 0}
#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN}
#define meshtastic_QueueStatus_init_zero {0, 0, 0, 0}
@@ -1626,6 +1638,7 @@ extern "C" {
#define meshtastic_NodeInfo_is_ignored_tag 11
#define meshtastic_NodeInfo_is_key_manually_verified_tag 12
#define meshtastic_NodeInfo_is_muted_tag 13
#define meshtastic_NodeInfoBatch_items_tag 1
#define meshtastic_MyNodeInfo_my_node_num_tag 1
#define meshtastic_MyNodeInfo_reboot_count_tag 8
#define meshtastic_MyNodeInfo_min_app_version_tag 11
@@ -1700,6 +1713,7 @@ extern "C" {
#define meshtastic_FromRadio_fileInfo_tag 15
#define meshtastic_FromRadio_clientNotification_tag 16
#define meshtastic_FromRadio_deviceuiConfig_tag 17
#define meshtastic_FromRadio_node_info_batch_tag 18
#define meshtastic_Heartbeat_nonce_tag 1
#define meshtastic_ToRadio_packet_tag 1
#define meshtastic_ToRadio_want_config_id_tag 3
@@ -1882,6 +1896,12 @@ X(a, STATIC, SINGULAR, BOOL, is_muted, 13)
#define meshtastic_NodeInfo_position_MSGTYPE meshtastic_Position
#define meshtastic_NodeInfo_device_metrics_MSGTYPE meshtastic_DeviceMetrics
#define meshtastic_NodeInfoBatch_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, MESSAGE, items, 1)
#define meshtastic_NodeInfoBatch_CALLBACK pb_default_field_callback
#define meshtastic_NodeInfoBatch_DEFAULT NULL
#define meshtastic_NodeInfoBatch_items_MSGTYPE meshtastic_NodeInfo
#define meshtastic_MyNodeInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, my_node_num, 1) \
X(a, STATIC, SINGULAR, UINT32, reboot_count, 8) \
@@ -1926,7 +1946,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,metadata,metadata), 13) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,mqttClientProxyMessage,mqttClientProxyMessage), 14) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,fileInfo,fileInfo), 15) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,clientNotification,clientNotification), 16) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,deviceuiConfig,deviceuiConfig), 17)
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,deviceuiConfig,deviceuiConfig), 17) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,node_info_batch,node_info_batch), 18)
#define meshtastic_FromRadio_CALLBACK NULL
#define meshtastic_FromRadio_DEFAULT NULL
#define meshtastic_FromRadio_payload_variant_packet_MSGTYPE meshtastic_MeshPacket
@@ -1943,6 +1964,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,deviceuiConfig,deviceuiConfi
#define meshtastic_FromRadio_payload_variant_fileInfo_MSGTYPE meshtastic_FileInfo
#define meshtastic_FromRadio_payload_variant_clientNotification_MSGTYPE meshtastic_ClientNotification
#define meshtastic_FromRadio_payload_variant_deviceuiConfig_MSGTYPE meshtastic_DeviceUIConfig
#define meshtastic_FromRadio_payload_variant_node_info_batch_MSGTYPE meshtastic_NodeInfoBatch
#define meshtastic_ClientNotification_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, UINT32, reply_id, 1) \
@@ -2098,6 +2120,7 @@ extern const pb_msgdesc_t meshtastic_StatusMessage_msg;
extern const pb_msgdesc_t meshtastic_MqttClientProxyMessage_msg;
extern const pb_msgdesc_t meshtastic_MeshPacket_msg;
extern const pb_msgdesc_t meshtastic_NodeInfo_msg;
extern const pb_msgdesc_t meshtastic_NodeInfoBatch_msg;
extern const pb_msgdesc_t meshtastic_MyNodeInfo_msg;
extern const pb_msgdesc_t meshtastic_LogRecord_msg;
extern const pb_msgdesc_t meshtastic_QueueStatus_msg;
@@ -2133,6 +2156,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
#define meshtastic_MqttClientProxyMessage_fields &meshtastic_MqttClientProxyMessage_msg
#define meshtastic_MeshPacket_fields &meshtastic_MeshPacket_msg
#define meshtastic_NodeInfo_fields &meshtastic_NodeInfo_msg
#define meshtastic_NodeInfoBatch_fields &meshtastic_NodeInfoBatch_msg
#define meshtastic_MyNodeInfo_fields &meshtastic_MyNodeInfo_msg
#define meshtastic_LogRecord_fields &meshtastic_LogRecord_msg
#define meshtastic_QueueStatus_fields &meshtastic_QueueStatus_msg
@@ -2156,9 +2180,11 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
#define meshtastic_ChunkedPayloadResponse_fields &meshtastic_ChunkedPayloadResponse_msg
/* Maximum encoded size of messages (where known) */
/* meshtastic_NodeInfoBatch_size depends on runtime parameters */
/* meshtastic_FromRadio_size depends on runtime parameters */
/* meshtastic_resend_chunks_size depends on runtime parameters */
/* meshtastic_ChunkedPayloadResponse_size depends on runtime parameters */
#define MESHTASTIC_MESHTASTIC_MESH_PB_H_MAX_SIZE meshtastic_FromRadio_size
#define MESHTASTIC_MESHTASTIC_MESH_PB_H_MAX_SIZE meshtastic_ToRadio_size
#define meshtastic_ChunkedPayload_size 245
#define meshtastic_ClientNotification_size 482
#define meshtastic_Compressed_size 239
@@ -2166,7 +2192,6 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
#define meshtastic_DeviceMetadata_size 54
#define meshtastic_DuplicatedPublicKey_size 0
#define meshtastic_FileInfo_size 236
#define meshtastic_FromRadio_size 510
#define meshtastic_Heartbeat_size 6
#define meshtastic_KeyVerificationFinal_size 65
#define meshtastic_KeyVerificationNumberInform_size 58
+3 -3
View File
@@ -145,7 +145,7 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread
std::mutex toPhoneMutex;
std::atomic<size_t> toPhoneQueueSize{0};
// We use array here (and pay the cost of memcpy) to avoid dynamic memory allocations and frees across FreeRTOS tasks.
std::array<std::array<uint8_t, meshtastic_FromRadio_size>, NIMBLE_BLUETOOTH_TO_PHONE_QUEUE_SIZE> toPhoneQueue{};
std::array<std::array<uint8_t, MAX_TO_FROM_RADIO_SIZE>, NIMBLE_BLUETOOTH_TO_PHONE_QUEUE_SIZE> toPhoneQueue{};
std::array<size_t, NIMBLE_BLUETOOTH_TO_PHONE_QUEUE_SIZE> toPhoneQueueByteSizes{};
// The onReadCallbackIsWaitingForData flag provides synchronization between the NimBLE task's onRead callback and our main
// task's runOnce. It's only set by onRead, and only cleared by runOnce.
@@ -245,7 +245,7 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread
void runOnceHandleToPhoneQueue()
{
// Stack buffer for getFromRadio packet
uint8_t fromRadioBytes[meshtastic_FromRadio_size] = {0};
uint8_t fromRadioBytes[MAX_TO_FROM_RADIO_SIZE] = {0};
size_t numBytes = 0;
if (onReadCallbackIsWaitingForData || runOnceToPhoneCanPreloadNextPacket()) {
@@ -524,7 +524,7 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks
}
// Pop from toPhoneQueue, protected by toPhoneMutex. Hold the mutex as briefly as possible.
uint8_t fromRadioBytes[meshtastic_FromRadio_size] = {0}; // Stack buffer for getFromRadio packet
uint8_t fromRadioBytes[MAX_TO_FROM_RADIO_SIZE] = {0}; // Stack buffer for getFromRadio packet
size_t numBytes = 0;
{ // scope for toPhoneMutex mutex
std::lock_guard<std::mutex> guard(bluetoothPhoneAPI->toPhoneMutex);
+1 -1
View File
@@ -25,7 +25,7 @@ static BLEDfuSecure bledfusecure; //
// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in
// process at once
// static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
static uint8_t fromRadioBytes[meshtastic_FromRadio_size];
static uint8_t fromRadioBytes[MAX_TO_FROM_RADIO_SIZE];
static uint8_t toRadioBytes[meshtastic_ToRadio_size];
// Last ToRadio value received from the phone
@@ -1,19 +0,0 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <stdint.h>
#define USB_VID 0x303a
#define USB_PID 0x1001
// used for keyboard, battery gauge, charger and haptic driver
static const uint8_t SDA = 5;
static const uint8_t SCL = 6;
// Default SPI will be mapped to Radio
static const uint8_t SS = 7;
static const uint8_t MOSI = 17;
static const uint8_t MISO = 8;
static const uint8_t SCK = 18;
#endif /* Pins_Arduino_h */
@@ -1,81 +0,0 @@
; LilyGo T-Display S3 Pro LR1121
[env:tdisplay-s3-pro]
custom_meshtastic_hw_model = 126
custom_meshtastic_hw_model_slug = T_DISPLAY_S3_PRO
custom_meshtastic_architecture = esp32-s3
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 1
custom_meshtastic_display_name = LILYGO T-Display S3 Pro
custom_meshtastic_images = lilygo-tdisplay-s3-pro.svg
custom_meshtastic_tags = LilyGo
custom_meshtastic_requires_dfu = true
custom_meshtastic_partition_scheme = 16MB
extends = esp32s3_base
board = t-display-s3
board_check = true
board_build.partitions = default_16MB.csv
upload_protocol = esptool
build_src_filter =
${esp32s3_base.build_src_filter}
+<../variants/esp32s3/tdisplay-s3pro>
build_flags = ${esp32s3_base.build_flags}
-I variants/esp32s3/tdisplay-s3pro
-D T_DISPLAY_S3_PRO
-D BOARD_HAS_PSRAM
-D HAS_SDCARD
lib_deps = ${esp32s3_base.lib_deps}
# renovate: datasource=custom.pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX
lovyan03/LovyanGFX@1.2.19
# renovate: datasource=custom.pio depName=ESP8266Audio packageName=earlephilhower/library/ESP8266Audio
earlephilhower/ESP8266Audio@1.9.9
# renovate: datasource=custom.pio depName=ESP8266SAM packageName=earlephilhower/library/ESP8266SAM
earlephilhower/ESP8266SAM@1.1.0
# renovate: datasource=custom.pio depName=SensorLib packageName=lewisxhe/library/SensorLib
lewisxhe/SensorLib@0.3.4
[env:tdisplay-s3-pro-tft]
board_level = extra
extends = env:tdisplay-s3-pro
build_flags =
${env:tdisplay-s3-pro.build_flags}
-D CONFIG_DISABLE_HAL_LOCKS=1
-D INPUTDRIVER_ENCODER_TYPE=2
-D INPUTDRIVER_ENCODER_LEFT=12
-D INPUTDRIVER_ENCODER_RIGHT=16
-D INPUTDRIVER_ENCODER_BTN=0
-D HAS_SCREEN=1
-D HAS_TFT=1
-D USE_I2S_BUZZER
-D RAM_SIZE=5120
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D LV_USE_SYSMON=0
-D LV_USE_PROFILER=0
-D LV_USE_PERF_MONITOR=0
-D LV_USE_MEM_MONITOR=0
-D LV_USE_LOG=0
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D RADIOLIB_SPI_PARANOID=0
-D LGFX_SCREEN_WIDTH=222
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_BUFSIZE=617460
-D DISPLAY_SIZE=480x222 ; landscape mode
-D DISPLAY_SET_RESOLUTION
-D LGFX_DRIVER=LGFX_TDISPLAY_S3PRO
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_TDISPLAY_S3PRO.h\"
; -D LVGL_DRIVER=LVGL_TDISPLAY_S3PRO
; -D LV_USE_ST7796=1
-D VIEW_480x222
-D CUSTOM_TOUCH_DRIVER
-D USE_PACKET_API
-D MAP_FULL_REDRAW
lib_deps =
${env:tdisplay-s3-pro.lib_deps}
${device-ui_base.lib_deps}
@@ -1,11 +0,0 @@
#include "RadioLib.h"
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}},
{LR11x0::MODE_TX, {LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}},
{LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}},
{LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE,
};
@@ -1,57 +0,0 @@
#include "variant.h"
#include "Arduino.h"
#include "configuration.h"
void earlyInitVariant()
{
pinMode(LORA_CS, OUTPUT);
digitalWrite(LORA_CS, HIGH);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH);
pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH);
pinMode(MAX98357A_EN, OUTPUT);
digitalWrite(MAX98357A_EN, HIGH);
}
#ifdef HAS_CST226SE // only for BaseUI
#include "TouchDrvCSTXXX.hpp"
#include "input/TouchScreenImpl1.h"
#include <Wire.h>
TouchDrvCSTXXX tsPanel;
static constexpr uint8_t PossibleAddresses[2] = {CST328_ADDR, CST226SE_ADDR_ALT};
uint8_t i2cAddress = 0;
bool readTouch(int16_t *x, int16_t *y)
{
int16_t x_array[1], y_array[1];
uint8_t touched = tsPanel.getPoint(x_array, y_array, 1);
if (touched > 0) {
*y = x_array[0];
*x = (TFT_WIDTH - y_array[0]);
// Check bounds
if (*x < 0 || *x >= TFT_WIDTH || *y < 0 || *y >= TFT_HEIGHT) {
return false;
}
return true; // Valid touch detected
}
return false; // No valid touch data
}
void lateInitVariant()
{
tsPanel.setTouchDrvModel(TouchDrv_CST226);
for (uint8_t addr : PossibleAddresses) {
if (tsPanel.begin(Wire, addr, I2C_SDA, I2C_SCL)) {
i2cAddress = addr;
LOG_DEBUG("CST226SE init OK at address 0x%02X", addr);
touchScreenImpl1 = new TouchScreenImpl1(TFT_WIDTH, TFT_HEIGHT, readTouch);
touchScreenImpl1->init();
return;
}
}
LOG_ERROR("CST226SE init failed at all known addresses");
}
#endif
-126
View File
@@ -1,126 +0,0 @@
// ST7796 TFT LCD
#define TFT_CS 39
#define ST7796_CS TFT_CS
#define ST7796_RS 9 // DC
#define ST7796_SDA MOSI // MOSI
#define ST7796_SCK SCK
#define ST7796_RESET -1
#define ST7796_MISO MISO
#define ST7796_BUSY -1
#define ST7796_BL 48
#define ST7796_SPI_HOST SPI2_HOST
#define TFT_BL 48
#define SPI_FREQUENCY 75000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_HEIGHT 480
#define TFT_WIDTH 222
#define TFT_OFFSET_X 49
#define TFT_OFFSET_Y 0
#define TFT_OFFSET_ROTATION 3
#define SCREEN_ROTATE
#define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
#define USE_TFTDISPLAY 1
#define I2C_SDA SDA
#define I2C_SCL SCL
// #define I2C_SDA1
// #define I2C_SCL1
#define USE_POWERSAVE
#define SLEEP_TIME 120
#define PIN_POWER_EN 42
// GNSS
#define GPS_DEFAULT_NOT_PRESENT 1
// PCF85063 RTC Module
#define PCF85063_RTC 0x51
// SY6970 battery charger
#define SY6970_ADDR 0x6A
#define SY6970_INT 21
#define HAS_PPM 1
#define XPOWERS_CHIP_SY6970
// MAX98357A PCM amplifier
#define HAS_I2S
#define DAC_I2S_BCK 4
#define DAC_I2S_WS 15
#define DAC_I2S_DOUT 11
#define DAC_I2S_MCLK 13 // not used
#define MAX98357A_EN 41
// ICM20948 motion tracker
#define ICM20948_ADDRESS 0x28
#define ICM20948_INT 21
// MP34DT05TRF MEMS mic
#define MP34DT05TR_LRCLK 1
#define MP34DT05TR_DATA 2
#define MP34DT05TR_EN 3
#define BUTTON_PIN 16
#define BUTTON_NEED_PULLUP
#define ALT_BUTTON_PIN 12
#define ALT_BUTTON_ACTIVE_LOW true
#define ALT_BUTTON_ACTIVE_PULLUP true
#define PIN_BUTTON3 0
// vibration motor
#define PIN_VIBRATION 45
// SPI interface SD card slot
#define SPI_MOSI MOSI
#define SPI_SCK SCK
#define SPI_MISO MISO
#define SPI_CS 14
#define SDCARD_CS SPI_CS
#define SD_SPI_FREQUENCY 75000000U
// LoRa
// #define USE_SX1262
// #define USE_SX1268
// #define USE_SX1280
#define USE_LR1121
#define LORA_SCK 18
#define LORA_MISO 8
#define LORA_MOSI 17
#define LORA_CS 7
#define LORA_RESET 10
#define LORA_DIO0 -1 // a No connect on the SX1262 module
#define LORA_DIO1 40 // SX1262 IRQ
#define LORA_DIO2 46 // SX1262 BUSY
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
#if defined(USE_SX1262) || defined(USE_SX1268)
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 3.0
#endif
#ifdef USE_SX1280
#define SX128X_CS LORA_CS
#define SX128X_DIO1 LORA_DIO1
#define SX128X_BUSY LORA_DIO2
#define SX128X_RESET LORA_RESET
#endif
#ifdef USE_LR1121
#define LR1121_IRQ_PIN LORA_DIO1
#define LR1121_NRESET_PIN LORA_RESET
#define LR1121_BUSY_PIN LORA_DIO2
#define LR1121_SPI_NSS_PIN LORA_CS
#define LR1121_SPI_SCK_PIN LORA_SCK
#define LR1121_SPI_MOSI_PIN LORA_MOSI
#define LR1121_SPI_MISO_PIN LORA_MISO
#define LR11X0_DIO3_TCXO_VOLTAGE 3.0
#define LR11X0_DIO_AS_RF_SWITCH
#endif