Chat app update, EspNow v2 & GPS Info (#460)

This commit is contained in:
Shadowtrance
2026-01-27 02:32:57 +10:00
committed by GitHub
parent dfe2c865d1
commit 10381b10cd
18 changed files with 1547 additions and 124 deletions
@@ -16,6 +16,10 @@ namespace tt::service::espnow {
typedef int ReceiverSubscription;
constexpr ReceiverSubscription NO_SUBSCRIPTION = -1;
// ESP-NOW version payload limits
constexpr size_t MAX_DATA_LEN_V1 = 250; // ESP-NOW v1.0 max payload
constexpr size_t MAX_DATA_LEN_V2 = 1470; // ESP-NOW v2.0 max payload (requires ESP-IDF v5.4+)
enum class Mode {
Station,
AccessPoint
@@ -54,6 +58,12 @@ ReceiverSubscription subscribeReceiver(std::function<void(const esp_now_recv_inf
void unsubscribeReceiver(ReceiverSubscription subscription);
/** Get the ESP-NOW protocol version (1 for v1.0, 2 for v2.0). Returns 0 if service not running. */
uint32_t getVersion();
/** Get the maximum data length for current ESP-NOW version (250 for v1.0, 1470 for v2.0). Returns 0 if service not running. */
size_t getMaxDataLength();
}
#endif // CONFIG_SOC_WIFI_SUPPORTED && !CONFIG_SLAVE_SOC_WIFI_SUPPORTED
@@ -21,6 +21,9 @@ class GpsService final : public Service {
minmea_sentence_rmc rmcRecord;
TickType_t rmcTime = 0;
minmea_sentence_gga ggaRecord;
TickType_t ggaTime = 0;
RecursiveMutex mutex;
Mutex stateMutex;
std::vector<GpsDeviceRecord> deviceRecords;
@@ -58,6 +61,7 @@ public:
bool hasCoordinates() const;
bool getCoordinates(minmea_sentence_rmc& rmc) const;
bool getGga(minmea_sentence_gga& gga) const;
/** @return GPS service pubsub that broadcasts State* objects */
std::shared_ptr<PubSub<State>> getStatePubsub() const { return statePubSub; }