firmware/src/modules/MeshTipsModule.h
Steve Gilberd 7d3af3aa8e
Tips robot virtual node / relayer to different LoRa modes & channels
Note that this commit has details hardcoded for the Wellington (NZ)
mesh, and also requires the following patch to the protobufs:

-----
diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto
index 03162d8..ec54c99 100644
--- a/meshtastic/mesh.proto
+++ b/meshtastic/mesh.proto
@@ -1393,6 +1393,21 @@ message MeshPacket {
    * Set by the firmware internally, clients are not supposed to set this.
    */
   uint32 tx_after = 20;
+
+  /*
+   * The modem preset to use fo rthis packet
+   */
+  uint32 modem_preset = 21;
+
+  /*
+   * The frequency slot to use for this packet
+   */
+  uint32 frequency_slot = 22;
+
+  /*
+   * Whether the packet has a nonstandard radio config
+   */
+  bool nonstandard_radio_config = 23;
 }

 /*
-----
2025-07-01 11:42:27 +12:00

80 lines
2.0 KiB
C++

#pragma once
#include "Observer.h"
#include "ProtobufModule.h"
#include "RadioInterface.h"
#include "SinglePortModule.h"
typedef struct {
meshtastic_Config_LoRaConfig_ModemPreset preset;
uint16_t slot;
} MeshTipsModule_TXSettings;
/**
* Base class for the tips robot
*/
class MeshTipsModule
{
public:
/**
* Constructor
*/
MeshTipsModule();
/**
* Configure the radio to send the target packet, or return to default config if p is NULL
*/
static bool configureRadioForPacket(RadioInterface *iface, meshtastic_MeshPacket *p);
/**
* Get target modem settings
*/
MeshTipsModule_TXSettings stripTargetRadioSettings(meshtastic_MeshPacket *p);
};
/**
* Tips module for sending tips into the mesh
*/
class MeshTipsNodeInfoModule : private MeshTipsModule, public ProtobufModule<meshtastic_User>, private concurrency::OSThread
{
public:
/**
* Constructor
*/
MeshTipsNodeInfoModule();
protected:
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_User *p) override;
/**
* Send NodeInfo to the mesh
*/
void sendTipsNodeInfo();
/** Does our periodic broadcast */
virtual int32_t runOnce() override;
};
extern MeshTipsNodeInfoModule *meshTipsNodeInfoModule;
/**
* Text message handling for the tips robot
*/
class MeshTipsMessageModule : private MeshTipsModule, public SinglePortModule, public Observable<const meshtastic_MeshPacket *>
{
public:
/**
* Constructor
*/
MeshTipsMessageModule() : MeshTipsModule(), SinglePortModule("tips", meshtastic_PortNum_TEXT_MESSAGE_APP) {}
protected:
/**
* Called to handle a particular incoming message
*/
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
/**
* Indicate whether this module wants to process the packet
*/
virtual bool wantPacket(const meshtastic_MeshPacket *p) override;
};
extern MeshTipsMessageModule *meshTipsMessageModule;