mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 19:29:17 +00:00

* protobufs * initial mods, not tested * manual telem packet creation, compiles. * add gust and lull computation * telem packet is getting fired off * new pb ? * pb and gust lull * need to set the variant type for it to work. * add gust and lull to mqtt json output. * parse bat voltage and cap voltage and send the larger of the two in telem packet also use the new ws85 serial mode (6). must set it with cli. : meshtastic --set serial.mode 6 * set hard coded average/transmit interval to 5 minutes. * proper direction averging with trig. * Update protobufs * sweep some crud * read in 512 bytes at a time and break and clear serial input if we got wind data * factor out sendTelemetry function * Revert "factor out sendTelemetry function" This reverts commitb61ba1a3c5
. * Reapply "factor out sendTelemetry function" This reverts commitd0af9cfd7d
. * update protobufs * put WS85 Serial2 is tcho and canaryone exclusion #ifdef * include GeoCoord.h so dr-dev will compile. * remove old TODO comment. * breakout WS85 serial operation to it's own function called processWXSerial() * canaryone and t-echo exclusion for Serial2 --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
80 lines
2.0 KiB
C++
80 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "MeshModule.h"
|
|
#include "Router.h"
|
|
#include "SinglePortModule.h"
|
|
#include "concurrency/OSThread.h"
|
|
#include "configuration.h"
|
|
#include <Arduino.h>
|
|
#include <functional>
|
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
|
|
class SerialModule : public StreamAPI, private concurrency::OSThread
|
|
{
|
|
bool firstTime = 1;
|
|
unsigned long lastNmeaTime = millis();
|
|
char outbuf[90] = "";
|
|
|
|
public:
|
|
SerialModule();
|
|
|
|
protected:
|
|
virtual int32_t runOnce() override;
|
|
|
|
/// Check the current underlying physical link to see if the client is currently connected
|
|
virtual bool checkIsConnected() override;
|
|
|
|
private:
|
|
uint32_t getBaudRate();
|
|
void sendTelemetry(meshtastic_Telemetry m);
|
|
void processWXSerial();
|
|
};
|
|
|
|
extern SerialModule *serialModule;
|
|
|
|
/*
|
|
* Radio interface for SerialModule
|
|
*
|
|
*/
|
|
class SerialModuleRadio : public MeshModule
|
|
{
|
|
uint32_t lastRxID = 0;
|
|
char outbuf[90] = "";
|
|
|
|
public:
|
|
SerialModuleRadio();
|
|
|
|
/**
|
|
* Send our payload into the mesh
|
|
*/
|
|
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
|
|
|
protected:
|
|
virtual meshtastic_MeshPacket *allocReply() override;
|
|
|
|
/** Called to handle a particular incoming message
|
|
|
|
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
|
it
|
|
*/
|
|
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
|
|
|
meshtastic_PortNum ourPortNum;
|
|
|
|
virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return p->decoded.portnum == ourPortNum; }
|
|
|
|
meshtastic_MeshPacket *allocDataPacket()
|
|
{
|
|
// Update our local node info with our position (even if we don't decide to update anyone else)
|
|
meshtastic_MeshPacket *p = router->allocForSending();
|
|
p->decoded.portnum = ourPortNum;
|
|
|
|
return p;
|
|
}
|
|
};
|
|
|
|
extern SerialModuleRadio *serialModuleRadio;
|
|
|
|
#endif |