mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
fix for message time
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "SPILock.h"
|
||||
#include "buzz.h"
|
||||
#include "detect/ScanI2C.h"
|
||||
#include "gps/RTC.h"
|
||||
#include "graphics/Screen.h"
|
||||
#include "graphics/SharedUIDisplay.h"
|
||||
#include "graphics/draw/MessageRenderer.h"
|
||||
@@ -974,7 +975,17 @@ void CannedMessageModule::sendText(NodeNum dest, ChannelIndex channel, const cha
|
||||
|
||||
// Save outgoing message
|
||||
StoredMessage sm;
|
||||
sm.timestamp = millis() / 1000;
|
||||
|
||||
// Always use our local time, consistent with other paths
|
||||
uint32_t nowSecs = getValidTime(RTCQuality::RTCQualityDevice, true);
|
||||
if (nowSecs > 0) {
|
||||
sm.timestamp = nowSecs;
|
||||
sm.isBootRelative = false;
|
||||
} else {
|
||||
sm.timestamp = millis() / 1000;
|
||||
sm.isBootRelative = true; // mark for later upgrade
|
||||
}
|
||||
|
||||
sm.sender = nodeDB->getNodeNum(); // us
|
||||
sm.channelIndex = channel;
|
||||
sm.text = std::string(message);
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
#include "SinglePortModule.h"
|
||||
|
||||
/**
|
||||
* Text message handling for meshtastic - draws on the OLED display the most recent received message
|
||||
* Text message handling for Meshtastic.
|
||||
*
|
||||
* This module is responsible for receiving and storing incoming text messages
|
||||
* from the mesh. It updates device state and notifies observers so that other
|
||||
* components (such as the MessageRenderer) can later display or process them.
|
||||
*
|
||||
* Rendering of messages on screen is no longer done here.
|
||||
*/
|
||||
class TextMessageModule : public SinglePortModule, public Observable<const meshtastic_MeshPacket *>
|
||||
{
|
||||
@@ -15,12 +21,12 @@ class TextMessageModule : public SinglePortModule, public Observable<const mesht
|
||||
|
||||
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
|
||||
*/
|
||||
*
|
||||
* @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;
|
||||
virtual bool wantPacket(const meshtastic_MeshPacket *p) override;
|
||||
};
|
||||
|
||||
extern TextMessageModule *textMessageModule;
|
||||
extern TextMessageModule *textMessageModule;
|
||||
|
||||
Reference in New Issue
Block a user