mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 14:10:53 +00:00
* Refactor GPS to not probe if pins not defined * Use Named Constructor to clean up code * Move doGPSPowerSave to GPS class * Make sure to set GPS awake on triple-click * Cleanup and remove dead code * Rename GPS_PIN_WAKE to GPS_PIN_STANDBY * Actually put GPS to sleep between fixes * add GPS_POWER_TOGGLE for heltec-tracker and t-deck * Change GPS_THREAD_INTERVAL to 200 ms * More dead code, compiler warnings, and add returns * Add Number of sats to log output * Add pgs enable and triple-click config * Track average GPS fix time to judge low-power time * Feed PositionModule on GPS fix * Don't turn off the 3v3_s line on RAK4631 when the rotary is present. * Add GPS power standbyOnly option * Delay setting time currentQuality to avoid strange log message. * Typos, comments, and remove unused variable * Short-circuit the setAwake logic on GPS disable * heltec-tracker 0.3 GPS power saving * set en_gpio to defined state * Fix fixed_position logic with GPS disabled * Don't process GPS serial when not isAwake * Add quirk for Heltec Tracker GPS powersave --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: mverch67 <manuel.verch@gmx.de> Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com>
52 lines
1.6 KiB
C++
52 lines
1.6 KiB
C++
#pragma once
|
|
#include "ProtobufModule.h"
|
|
#include "concurrency/OSThread.h"
|
|
|
|
/**
|
|
* Position module for sending/receiving positions into the mesh
|
|
*/
|
|
class PositionModule : public ProtobufModule<meshtastic_Position>, private concurrency::OSThread
|
|
{
|
|
/// The id of the last packet we sent, to allow us to cancel it if we make something fresher
|
|
PacketId prevPacketId = 0;
|
|
|
|
/// We limit our GPS broadcasts to a max rate
|
|
uint32_t lastGpsSend = 0;
|
|
|
|
// Store the latest good lat / long
|
|
int32_t lastGpsLatitude = 0;
|
|
int32_t lastGpsLongitude = 0;
|
|
|
|
/// We force a rebroadcast if the radio settings change
|
|
uint32_t currentGeneration = 0;
|
|
|
|
public:
|
|
/** Constructor
|
|
* name is for debugging output
|
|
*/
|
|
PositionModule();
|
|
|
|
/**
|
|
* Send our position into the mesh
|
|
*/
|
|
void sendOurPosition(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false, uint8_t channel = 0);
|
|
|
|
void handleNewPosition();
|
|
|
|
protected:
|
|
/** Called to handle a particular incoming message
|
|
|
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
|
*/
|
|
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *p) override;
|
|
|
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
|
virtual meshtastic_MeshPacket *allocReply() override;
|
|
|
|
/** Does our periodic broadcast */
|
|
virtual int32_t runOnce() override;
|
|
};
|
|
|
|
extern PositionModule *positionModule;
|