mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-09 07:05:07 +00:00
Added waypoint module routing
This commit is contained in:
parent
579ebbffe2
commit
d6811b9e35
@ -13,8 +13,9 @@
|
|||||||
#include "modules/ReplyModule.h"
|
#include "modules/ReplyModule.h"
|
||||||
#include "modules/RoutingModule.h"
|
#include "modules/RoutingModule.h"
|
||||||
#include "modules/TextMessageModule.h"
|
#include "modules/TextMessageModule.h"
|
||||||
#include "modules/Telemetry/DeviceTelemetry.h"
|
#include "modules/WaypointModule.h"
|
||||||
#if HAS_TELEMETRY
|
#if HAS_TELEMETRY
|
||||||
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
||||||
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
@ -34,6 +35,7 @@ void setupModules()
|
|||||||
adminModule = new AdminModule();
|
adminModule = new AdminModule();
|
||||||
nodeInfoModule = new NodeInfoModule();
|
nodeInfoModule = new NodeInfoModule();
|
||||||
positionModule = new PositionModule();
|
positionModule = new PositionModule();
|
||||||
|
waypointModule = new WaypointModule();
|
||||||
textMessageModule = new TextMessageModule();
|
textMessageModule = new TextMessageModule();
|
||||||
|
|
||||||
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
||||||
|
17
src/modules/WaypointModule.cpp
Normal file
17
src/modules/WaypointModule.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
#include "WaypointModule.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
|
#include "PowerFSM.h"
|
||||||
|
|
||||||
|
WaypointModule *waypointModule;
|
||||||
|
|
||||||
|
ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp)
|
||||||
|
{
|
||||||
|
auto &p = mp.decoded;
|
||||||
|
DEBUG_MSG("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes);
|
||||||
|
|
||||||
|
|
||||||
|
notifyObservers(&mp);
|
||||||
|
|
||||||
|
return ProcessMessage::CONTINUE; // Let others look at this message also if they want
|
||||||
|
}
|
25
src/modules/WaypointModule.h
Normal file
25
src/modules/WaypointModule.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "SinglePortModule.h"
|
||||||
|
#include "Observer.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waypoint message handling for meshtastic
|
||||||
|
*/
|
||||||
|
class WaypointModule : public SinglePortModule, public Observable<const MeshPacket *>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Constructor
|
||||||
|
* name is for debugging output
|
||||||
|
*/
|
||||||
|
WaypointModule() : SinglePortModule("waypoint", PortNum_WAYPOINT_APP) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/** 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 MeshPacket &mp) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern WaypointModule *waypointModule;
|
Loading…
Reference in New Issue
Block a user