mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 09:06:02 +00:00
Merge pull request #4891 from meshtastic/store-n-forward
First stab at enabling store and forward for Native
This commit is contained in:
commit
5a2c58197b
@ -58,10 +58,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#include "esp_task_wdt.h"
|
||||
#include "modules/esp32/StoreForwardModule.h"
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#endif
|
||||
|
||||
#if ARCH_PORTDUINO
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#endif
|
||||
|
||||
@ -2822,4 +2823,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg)
|
||||
} // namespace graphics
|
||||
#else
|
||||
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
|
||||
#endif // HAS_SCREEN
|
||||
#endif // HAS_SCREEN
|
@ -57,6 +57,8 @@ uint32_t MemGet::getFreePsram()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
return ESP.getFreePsram();
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
return 4194252;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
@ -71,6 +73,8 @@ uint32_t MemGet::getPsramSize()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
return ESP.getPsramSize();
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
return 4194252;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -13,9 +13,9 @@
|
||||
#if defined(ARCH_PORTDUINO) && !HAS_RADIO
|
||||
#include "../platform/portduino/SimRadio.h"
|
||||
#endif
|
||||
#ifdef ARCH_ESP32
|
||||
#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO)
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
#include "modules/esp32/StoreForwardModule.h"
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -32,12 +32,13 @@
|
||||
#if HAS_WIFI
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#endif
|
||||
#include "modules/esp32/StoreForwardModule.h"
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#include <Preferences.h>
|
||||
#include <nvs_flash.h>
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#endif
|
||||
|
||||
|
@ -47,6 +47,9 @@
|
||||
#endif
|
||||
#if ARCH_PORTDUINO
|
||||
#include "input/LinuxInputImpl.h"
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_TELEMETRY
|
||||
#include "modules/Telemetry/DeviceTelemetry.h"
|
||||
@ -67,7 +70,7 @@
|
||||
#include "modules/esp32/PaxcounterModule.h"
|
||||
#endif
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
#include "modules/esp32/StoreForwardModule.h"
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
||||
|
@ -35,7 +35,7 @@ uint32_t heartbeatInterval = 60; // Default to 60 seconds, adjust as needed
|
||||
|
||||
int32_t StoreForwardModule::runOnce()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO)
|
||||
if (moduleConfig.store_forward.enabled && is_server) {
|
||||
// Send out the message queue.
|
||||
if (this->busy) {
|
||||
@ -82,8 +82,12 @@ void StoreForwardModule::populatePSRAM()
|
||||
uint32_t numberOfPackets =
|
||||
(this->records ? this->records : (((memGet.getFreePsram() / 3) * 2) / sizeof(PacketHistoryStruct)));
|
||||
this->records = numberOfPackets;
|
||||
|
||||
#if defined(ARCH_ESP32)
|
||||
this->packetHistory = static_cast<PacketHistoryStruct *>(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
this->packetHistory = static_cast<PacketHistoryStruct *>(calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
||||
|
||||
#endif
|
||||
|
||||
LOG_DEBUG("*** After PSRAM initialization: heap %d/%d PSRAM %d/%d\n", memGet.getFreeHeap(), memGet.getHeapSize(),
|
||||
memGet.getFreePsram(), memGet.getPsramSize());
|
||||
@ -376,7 +380,7 @@ void StoreForwardModule::statsSend(uint32_t to)
|
||||
*/
|
||||
ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &mp)
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO)
|
||||
if (moduleConfig.store_forward.enabled) {
|
||||
|
||||
if ((mp.decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) && is_server) {
|
||||
@ -559,7 +563,7 @@ StoreForwardModule::StoreForwardModule()
|
||||
ProtobufModule("StoreForward", meshtastic_PortNum_STORE_FORWARD_APP, &meshtastic_StoreAndForward_msg)
|
||||
{
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO)
|
||||
|
||||
isPromiscuous = true; // Brown chicken brown cow
|
||||
|
Loading…
Reference in New Issue
Block a user