2025-06-01 09:25:17 -07:00
|
|
|
|
#pragma once
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
#include <Mesh.h>
|
2025-08-16 20:04:54 +10:00
|
|
|
|
#include "AbstractUITask.h"
|
2026-05-26 21:26:07 +02:00
|
|
|
|
#include <helpers/ui/DisplayDriver.h>
|
|
|
|
|
|
|
|
|
|
|
|
// Forward declaration for UITask
|
|
|
|
|
|
class UITask;
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
|
|
|
|
|
/*------------ Frame Protocol --------------*/
|
2026-04-15 20:47:17 +10:00
|
|
|
|
#define FIRMWARE_VER_CODE 11
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
|
|
|
|
|
#ifndef FIRMWARE_BUILD_DATE
|
2026-05-12 21:13:46 +02:00
|
|
|
|
#define FIRMWARE_BUILD_DATE "12 May 2026"
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2026-05-12 21:13:46 +02:00
|
|
|
|
// Versioning: vX.Y = upstream base, plus.N = fork revision
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#ifndef FIRMWARE_VERSION
|
2026-05-12 21:13:46 +02:00
|
|
|
|
#define FIRMWARE_VERSION "v1.15-plus.1"
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
|
|
|
|
|
#include <InternalFileSystem.h>
|
|
|
|
|
|
#elif defined(RP2040_PLATFORM)
|
|
|
|
|
|
#include <LittleFS.h>
|
|
|
|
|
|
#elif defined(ESP32)
|
|
|
|
|
|
#include <SPIFFS.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-06-06 15:30:35 +10:00
|
|
|
|
#include "DataStore.h"
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#include "NodePrefs.h"
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#include <RTClib.h>
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#include <helpers/ArduinoHelpers.h>
|
|
|
|
|
|
#include <helpers/BaseSerialInterface.h>
|
|
|
|
|
|
#include <helpers/IdentityStore.h>
|
|
|
|
|
|
#include <helpers/SimpleMeshTables.h>
|
|
|
|
|
|
#include <helpers/StaticPoolPacketManager.h>
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#include <target.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* ---------------------------------- CONFIGURATION ------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LORA_FREQ
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define LORA_FREQ 915.0
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef LORA_BW
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define LORA_BW 250
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef LORA_SF
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define LORA_SF 10
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef LORA_CR
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define LORA_CR 5
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef LORA_TX_POWER
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define LORA_TX_POWER 20
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef MAX_LORA_TX_POWER
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define MAX_LORA_TX_POWER LORA_TX_POWER
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef MAX_CONTACTS
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define MAX_CONTACTS 100
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OFFLINE_QUEUE_SIZE
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define OFFLINE_QUEUE_SIZE 16
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef BLE_NAME_PREFIX
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define BLE_NAME_PREFIX "MeshCore-"
|
2025-05-29 13:06:24 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include <helpers/BaseChatMesh.h>
|
2025-11-04 01:21:56 +11:00
|
|
|
|
#include <helpers/TransportKeyStore.h>
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------------------- */
|
|
|
|
|
|
|
2025-06-01 09:25:17 -07:00
|
|
|
|
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
|
|
|
|
|
#define REQ_TYPE_KEEP_ALIVE 0x02
|
|
|
|
|
|
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
2025-08-08 20:01:31 +10:00
|
|
|
|
struct AdvertPath {
|
|
|
|
|
|
uint8_t pubkey_prefix[7];
|
|
|
|
|
|
uint8_t path_len;
|
|
|
|
|
|
char name[32];
|
|
|
|
|
|
uint32_t recv_timestamp;
|
|
|
|
|
|
uint8_t path[MAX_PATH_SIZE];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-21 07:57:21 +02:00
|
|
|
|
struct DiscoverResult {
|
|
|
|
|
|
char name[32]; // contact name if known, "" if unknown (use type label)
|
2026-05-21 00:13:36 +02:00
|
|
|
|
uint8_t type; // ADV_TYPE_REPEATER / ADV_TYPE_SENSOR / ADV_TYPE_ROOM
|
2026-05-21 07:57:21 +02:00
|
|
|
|
bool is_known; // true = in contacts[], false = new unknown node
|
2026-05-21 08:51:43 +02:00
|
|
|
|
int8_t rssi; // RSSI of the response as received by us (dBm)
|
2026-05-21 08:56:54 +02:00
|
|
|
|
int8_t snr_x4; // SNR of the response as received by us (dB × 4)
|
|
|
|
|
|
int8_t remote_snr_x4; // SNR at which responder heard our request (dB × 4)
|
2026-05-21 09:11:32 +02:00
|
|
|
|
uint8_t pub_key[PUB_KEY_SIZE];
|
2026-05-21 07:57:21 +02:00
|
|
|
|
uint32_t timestamp;
|
2026-05-21 00:13:36 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-14 11:30:43 +02:00
|
|
|
|
#define EXPECTED_ACK_TABLE_SIZE 8
|
|
|
|
|
|
|
2025-06-06 15:30:35 +10:00
|
|
|
|
class MyMesh : public BaseChatMesh, public DataStoreHost {
|
2025-05-29 13:06:24 -07:00
|
|
|
|
public:
|
2025-08-16 20:04:54 +10:00
|
|
|
|
MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMeshTables &tables, DataStore& store, AbstractUITask* ui=NULL);
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
2025-06-06 15:30:35 +10:00
|
|
|
|
void begin(bool has_display);
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void startInterface(BaseSerialInterface &serial);
|
|
|
|
|
|
|
|
|
|
|
|
const char *getNodeName();
|
|
|
|
|
|
NodePrefs *getNodePrefs();
|
|
|
|
|
|
uint32_t getBLEPin();
|
|
|
|
|
|
|
|
|
|
|
|
void loop();
|
|
|
|
|
|
void handleCmdFrame(size_t len);
|
|
|
|
|
|
bool advert();
|
2026-05-21 00:13:36 +02:00
|
|
|
|
void sendNodeDiscoverReq();
|
2025-06-04 21:33:48 +10:00
|
|
|
|
void enterCLIRescue();
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
2025-08-08 20:01:31 +10:00
|
|
|
|
int getRecentlyHeard(AdvertPath dest[], int max_num);
|
2026-05-21 07:57:21 +02:00
|
|
|
|
int getDiscoverResults(DiscoverResult dest[], int max_count);
|
2025-08-08 20:01:31 +10:00
|
|
|
|
|
2025-05-29 13:06:24 -07:00
|
|
|
|
protected:
|
2025-06-01 09:25:17 -07:00
|
|
|
|
float getAirtimeBudgetFactor() const override;
|
|
|
|
|
|
int getInterferenceThreshold() const override;
|
|
|
|
|
|
int calcRxDelay(float score, uint32_t air_time) const override;
|
2026-02-17 20:25:56 +11:00
|
|
|
|
uint32_t getRetransmitDelay(const mesh::Packet *packet) override;
|
|
|
|
|
|
uint32_t getDirectRetransmitDelay(const mesh::Packet *packet) override;
|
2025-07-16 19:25:28 +10:00
|
|
|
|
uint8_t getExtraAckTransmitCount() const override;
|
2025-11-05 14:34:44 +11:00
|
|
|
|
bool filterRecvFloodPacket(mesh::Packet* packet) override;
|
2026-02-14 15:50:06 +11:00
|
|
|
|
bool allowPacketForward(const mesh::Packet* packet) override;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
2026-04-10 17:01:41 +10:00
|
|
|
|
void sendFloodScoped(const TransportKey& scope, mesh::Packet* pkt, uint32_t delay_millis);
|
2025-11-04 01:21:56 +11:00
|
|
|
|
void sendFloodScoped(const ContactInfo& recipient, mesh::Packet* pkt, uint32_t delay_millis=0) override;
|
|
|
|
|
|
void sendFloodScoped(const mesh::GroupChannel& channel, mesh::Packet* pkt, uint32_t delay_millis=0) override;
|
|
|
|
|
|
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override;
|
|
|
|
|
|
bool isAutoAddEnabled() const override;
|
2026-01-13 00:38:20 +11:00
|
|
|
|
bool shouldAutoAddContactType(uint8_t type) const override;
|
|
|
|
|
|
bool shouldOverwriteWhenFull() const override;
|
2026-03-02 20:41:41 +01:00
|
|
|
|
uint8_t getAutoAddMaxHops() const override;
|
2026-01-13 00:38:20 +11:00
|
|
|
|
void onContactsFull() override;
|
|
|
|
|
|
void onContactOverwrite(const uint8_t* pub_key) override;
|
2025-07-31 13:04:16 +10:00
|
|
|
|
bool onContactPathRecv(ContactInfo& from, uint8_t* in_path, uint8_t in_path_len, uint8_t* out_path, uint8_t out_path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override;
|
2025-06-18 16:02:09 +10:00
|
|
|
|
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void onContactPathUpdated(const ContactInfo &contact) override;
|
2025-09-08 19:22:59 +10:00
|
|
|
|
ContactInfo* processAck(const uint8_t *data) override;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packet *pkt, uint32_t sender_timestamp,
|
|
|
|
|
|
const uint8_t *extra, int extra_len, const char *text);
|
|
|
|
|
|
|
|
|
|
|
|
void onMessageRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
|
|
|
|
|
const char *text) override;
|
|
|
|
|
|
void onCommandDataRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
|
|
|
|
|
const char *text) override;
|
|
|
|
|
|
void onSignedMessageRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
|
|
|
|
|
const uint8_t *sender_prefix, const char *text) override;
|
|
|
|
|
|
void onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packet *pkt, uint32_t timestamp,
|
|
|
|
|
|
const char *text) override;
|
2026-03-19 09:25:42 +01:00
|
|
|
|
void onChannelDataRecv(const mesh::GroupChannel &channel, mesh::Packet *pkt, uint16_t data_type,
|
2026-03-05 13:23:23 +01:00
|
|
|
|
const uint8_t *data, size_t data_len) override;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
|
|
|
|
|
uint8_t onContactRequest(const ContactInfo &contact, uint32_t sender_timestamp, const uint8_t *data,
|
|
|
|
|
|
uint8_t len, uint8_t *reply) override;
|
|
|
|
|
|
void onContactResponse(const ContactInfo &contact, const uint8_t *data, uint8_t len) override;
|
2025-11-06 22:10:20 +11:00
|
|
|
|
void onControlDataRecv(mesh::Packet *packet) override;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void onRawDataRecv(mesh::Packet *packet) override;
|
|
|
|
|
|
void onTraceRecv(mesh::Packet *packet, uint32_t tag, uint32_t auth_code, uint8_t flags,
|
|
|
|
|
|
const uint8_t *path_snrs, const uint8_t *path_hashes, uint8_t path_len) override;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const override;
|
|
|
|
|
|
uint32_t calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const override;
|
|
|
|
|
|
void onSendTimeout() override;
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
2025-06-06 15:30:35 +10:00
|
|
|
|
// DataStoreHost methods
|
|
|
|
|
|
bool onContactLoaded(const ContactInfo& contact) override { return addContact(contact); }
|
|
|
|
|
|
bool getContactForSave(uint32_t idx, ContactInfo& contact) override { return getContactByIdx(idx, contact); }
|
|
|
|
|
|
bool onChannelLoaded(uint8_t channel_idx, const ChannelDetails& ch) override { return setChannel(channel_idx, ch); }
|
|
|
|
|
|
bool getChannelForSave(uint8_t channel_idx, ChannelDetails& ch) override { return getChannel(channel_idx, ch); }
|
|
|
|
|
|
|
2025-07-31 13:45:53 +10:00
|
|
|
|
void clearPendingReqs() {
|
|
|
|
|
|
pending_login = pending_status = pending_telemetry = pending_discovery = pending_req = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-20 18:55:39 -08:00
|
|
|
|
public:
|
|
|
|
|
|
void savePrefs() { _store->savePrefs(_prefs, sensors.node_lat, sensors.node_lon); }
|
2026-05-10 18:23:25 +02:00
|
|
|
|
void saveRTCTime() { _store->saveRTCTime(); }
|
2026-05-26 07:49:17 +02:00
|
|
|
|
DataStore* getDataStore() const { return _store; }
|
2025-11-20 18:55:39 -08:00
|
|
|
|
|
feat: NearbyScreen, configurable clock dashboard, memory optimizations
- Add NearbyScreen: GPS contact list with haversine distance sort,
type filter (ALL/Chat/Rpt/Room/Snsr), detail view with ping (RTT via
ACK poll), node scan via advert(), context menu
- Add DashboardConfigScreen: configure up to 3 data fields on the clock
page (Battery, Temp, Humidity, Pressure, GPS, Altitude, Lux, CO2,
Contacts); entered via long-press ENTER on clock page
- Rework HP_CLOCK layout: full-screen clock (size 2 at y=0), date at
y=19, separator at y=28, three data field rows at y=31/41/51;
hide node name/battery indicator on clock page
- Persist dashboard_fields[3] in NodePrefs and DataStore
- Add isAckPending() to MyMesh for NearbyScreen ping detection
- Wire NearbyScreen into ToolsScreen and UITask
- Reduce NearbyScreen entry buffer from MAX_CONTACTS(100) to 32,
saving ~3.3 KB RAM
- Switch haversine/bearing math from double to float (sinf/cosf/atan2f),
eliminating double libm and saving ~5-10 KB flash
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 11:28:36 +02:00
|
|
|
|
bool isAckPending(uint32_t expected_ack) const {
|
|
|
|
|
|
for (int i = 0; i < EXPECTED_ACK_TABLE_SIZE; i++)
|
|
|
|
|
|
if (expected_ack_table[i].ack == expected_ack) return true;
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-14 15:57:00 +02:00
|
|
|
|
|
2026-03-13 15:12:59 -05:00
|
|
|
|
#if ENV_INCLUDE_GPS == 1
|
|
|
|
|
|
void applyGpsPrefs() {
|
|
|
|
|
|
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");
|
2026-03-25 16:26:51 +11:00
|
|
|
|
if (_prefs.gps_interval > 0) {
|
|
|
|
|
|
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
|
|
|
|
|
|
sprintf(interval_str, "%u", _prefs.gps_interval);
|
|
|
|
|
|
sensors.setSettingValue("gps_interval", interval_str);
|
|
|
|
|
|
}
|
2026-03-13 15:12:59 -05:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-05-29 13:06:24 -07:00
|
|
|
|
private:
|
2026-05-12 14:51:19 +02:00
|
|
|
|
void tryBotReplyDM(const ContactInfo& from, const char* text);
|
|
|
|
|
|
void tryBotReplyChannel(uint8_t channel_idx, const char* text);
|
|
|
|
|
|
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void writeOKFrame();
|
|
|
|
|
|
void writeErrFrame(uint8_t err_code);
|
|
|
|
|
|
void writeDisabledFrame();
|
|
|
|
|
|
void writeContactRespFrame(uint8_t code, const ContactInfo &contact);
|
2025-07-25 22:59:48 +10:00
|
|
|
|
void updateContactFromFrame(ContactInfo &contact, uint32_t& last_mod, const uint8_t *frame, int len);
|
2025-06-01 09:25:17 -07:00
|
|
|
|
void addToOfflineQueue(const uint8_t frame[], int len);
|
|
|
|
|
|
int getFromOfflineQueue(uint8_t frame[]);
|
2025-06-06 21:35:54 +10:00
|
|
|
|
int getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]) override {
|
|
|
|
|
|
return _store->getBlobByKey(key, key_len, dest_buf);
|
|
|
|
|
|
}
|
|
|
|
|
|
bool putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], int len) override {
|
|
|
|
|
|
return _store->putBlobByKey(key, key_len, src_buf, len);
|
|
|
|
|
|
}
|
2025-05-29 13:06:24 -07:00
|
|
|
|
|
2025-06-04 21:33:48 +10:00
|
|
|
|
void checkCLIRescueCmd();
|
|
|
|
|
|
void checkSerialInterface();
|
2026-02-14 15:50:06 +11:00
|
|
|
|
bool isValidClientRepeatFreq(uint32_t f) const;
|
2026-05-26 21:26:07 +02:00
|
|
|
|
#ifdef ENABLE_SCREENSHOT
|
|
|
|
|
|
void handleScreenshotRequest();
|
|
|
|
|
|
void sendScreenshotResponse(DisplayDriver* display, uint8_t* buffer, int bufferSize);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
UITask* getUITask() { return (UITask*)_ui; }
|
2025-06-06 15:30:35 +10:00
|
|
|
|
|
|
|
|
|
|
// helpers, short-cuts
|
|
|
|
|
|
void saveChannels() { _store->saveChannels(this); }
|
|
|
|
|
|
void saveContacts() { _store->saveContacts(this); }
|
2025-06-04 21:33:48 +10:00
|
|
|
|
|
2025-06-06 15:30:35 +10:00
|
|
|
|
DataStore* _store;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
NodePrefs _prefs;
|
|
|
|
|
|
uint32_t pending_login;
|
|
|
|
|
|
uint32_t pending_status;
|
2025-07-31 13:04:16 +10:00
|
|
|
|
uint32_t pending_telemetry, pending_discovery; // pending _TELEMETRY_REQ
|
2025-07-14 12:46:51 +10:00
|
|
|
|
uint32_t pending_req; // pending _BINARY_REQ
|
2025-06-01 09:25:17 -07:00
|
|
|
|
BaseSerialInterface *_serial;
|
2025-08-16 20:04:54 +10:00
|
|
|
|
AbstractUITask* _ui;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
|
|
|
|
|
ContactsIterator _iter;
|
|
|
|
|
|
uint32_t _iter_filter_since;
|
|
|
|
|
|
uint32_t _most_recent_lastmod;
|
|
|
|
|
|
uint32_t _active_ble_pin;
|
|
|
|
|
|
bool _iter_started;
|
2025-06-04 21:33:48 +10:00
|
|
|
|
bool _cli_rescue;
|
|
|
|
|
|
char cli_command[80];
|
2025-06-01 09:25:17 -07:00
|
|
|
|
uint8_t app_target_ver;
|
|
|
|
|
|
uint8_t *sign_data;
|
|
|
|
|
|
uint32_t sign_data_len;
|
|
|
|
|
|
unsigned long dirty_contacts_expiry;
|
2026-05-16 23:26:31 +02:00
|
|
|
|
unsigned long _bot_last_dm_reply_ms;
|
|
|
|
|
|
unsigned long _bot_last_ch_reply_ms;
|
2026-05-14 16:08:33 +02:00
|
|
|
|
unsigned long _next_auto_advert_ms;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
|
2026-04-13 23:11:21 +10:00
|
|
|
|
TransportKey send_scope;
|
2025-11-04 01:21:56 +11:00
|
|
|
|
|
2025-06-01 09:25:17 -07:00
|
|
|
|
uint8_t cmd_frame[MAX_FRAME_SIZE + 1];
|
|
|
|
|
|
uint8_t out_frame[MAX_FRAME_SIZE + 1];
|
|
|
|
|
|
CayenneLPP telemetry;
|
|
|
|
|
|
|
|
|
|
|
|
struct Frame {
|
|
|
|
|
|
uint8_t len;
|
|
|
|
|
|
uint8_t buf[MAX_FRAME_SIZE];
|
2025-09-22 15:01:28 +10:00
|
|
|
|
|
|
|
|
|
|
bool isChannelMsg() const;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
};
|
|
|
|
|
|
int offline_queue_len;
|
|
|
|
|
|
Frame offline_queue[OFFLINE_QUEUE_SIZE];
|
|
|
|
|
|
|
|
|
|
|
|
struct AckTableEntry {
|
|
|
|
|
|
unsigned long msg_sent;
|
|
|
|
|
|
uint32_t ack;
|
2025-09-08 19:22:59 +10:00
|
|
|
|
ContactInfo* contact;
|
2025-06-01 09:25:17 -07:00
|
|
|
|
};
|
|
|
|
|
|
AckTableEntry expected_ack_table[EXPECTED_ACK_TABLE_SIZE]; // circular table
|
|
|
|
|
|
int next_ack_idx;
|
2025-06-18 16:02:09 +10:00
|
|
|
|
|
|
|
|
|
|
#define ADVERT_PATH_TABLE_SIZE 16
|
|
|
|
|
|
AdvertPath advert_paths[ADVERT_PATH_TABLE_SIZE]; // circular table
|
2026-05-21 00:13:36 +02:00
|
|
|
|
|
2026-05-21 07:57:21 +02:00
|
|
|
|
#define DISCOVER_RESULTS_MAX 16
|
|
|
|
|
|
DiscoverResult _discover_results[DISCOVER_RESULTS_MAX];
|
|
|
|
|
|
int _discover_count;
|
2026-05-21 00:13:36 +02:00
|
|
|
|
uint32_t _pending_node_discover_tag;
|
|
|
|
|
|
unsigned long _pending_node_discover_until;
|
2025-05-29 13:06:24 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern MyMesh the_mesh;
|