mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-25 14:30:28 +00:00
Merge branch 'meshtastic:master' into master
This commit is contained in:
commit
f3427084c2
50
.gitlab-ci.yml
Normal file
50
.gitlab-ci.yml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
image: python:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
# make sure GitLab check out submodules
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- buildall
|
||||||
|
- upload
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: buildall
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# we need zip later for packaging
|
||||||
|
- "apt update;apt -y install zip"
|
||||||
|
- "pip install -U platformio"
|
||||||
|
|
||||||
|
script:
|
||||||
|
# clean up residues from previous run
|
||||||
|
- rm -rf release
|
||||||
|
- bin/build-all.sh
|
||||||
|
|
||||||
|
# This is for my local environment, if your runners are tagged differently, modify or remove
|
||||||
|
tags:
|
||||||
|
- dockerized
|
||||||
|
|
||||||
|
# The files which are to be made available in GitLab
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- release/archive/firmware*.zip
|
||||||
|
|
||||||
|
|
||||||
|
upload:
|
||||||
|
image: curlimages/curl:latest
|
||||||
|
|
||||||
|
stage: upload
|
||||||
|
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/master"
|
||||||
|
cd release/archive
|
||||||
|
for f in *.zip; do
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${f} ${PACKAGE_REGISTRY_URL}/${f}
|
||||||
|
done
|
||||||
|
echo 'Package uploaded!'
|
||||||
|
|
||||||
|
# This is for my local environment, if your runners are tagged differently, modify or remove
|
||||||
|
tags:
|
||||||
|
- dockerized
|
@ -46,10 +46,10 @@ shift "$((OPTIND-1))"
|
|||||||
|
|
||||||
if [ -f "${FILENAME}" ]; then
|
if [ -f "${FILENAME}" ]; then
|
||||||
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
||||||
$PYTHON -m esptool --baud 921600 erase_flash
|
$PYTHON -m esptool erase_flash
|
||||||
$PYTHON -m esptool --baud 921600 write_flash 0x1000 system-info.bin
|
$PYTHON -m esptool write_flash 0x1000 system-info.bin
|
||||||
$PYTHON -m esptool --baud 921600 write_flash 0x00390000 spiffs-*.bin
|
$PYTHON -m esptool write_flash 0x00390000 spiffs-*.bin
|
||||||
$PYTHON -m esptool --baud 921600 write_flash 0x10000 ${FILENAME}
|
$PYTHON -m esptool write_flash 0x10000 ${FILENAME}
|
||||||
else
|
else
|
||||||
echo "Invalid file: ${FILENAME}"
|
echo "Invalid file: ${FILENAME}"
|
||||||
show_help
|
show_help
|
||||||
|
@ -325,7 +325,7 @@ Items after the first final candidate release.
|
|||||||
- add "store and forward" support for messages, or move to the DB sync model. This would allow messages to be eventually delivered even if nodes are out of contact at the moment.
|
- add "store and forward" support for messages, or move to the DB sync model. This would allow messages to be eventually delivered even if nodes are out of contact at the moment.
|
||||||
- use variable length Strings in protobufs (instead of current fixed buffers). This would save lots of RAM
|
- use variable length Strings in protobufs (instead of current fixed buffers). This would save lots of RAM
|
||||||
- use BLEDevice::setPower to lower our BLE transmit power - extra range doesn't help us, it costs amps and it increases snoopability
|
- use BLEDevice::setPower to lower our BLE transmit power - extra range doesn't help us, it costs amps and it increases snoopability
|
||||||
- make a HAM build: just a new frequency list, a bool to say 'never do encryption' and use hte callsign as that node's unique id. -from Girts
|
- make a Ham build: just a new frequency list, a bool to say 'never do encryption' and use the callsign as that node's unique id. -from Girts
|
||||||
- don't forward redundant pings or ping responses to the phone, it just wastes phone battery
|
- don't forward redundant pings or ping responses to the phone, it just wastes phone battery
|
||||||
- don't send location packets if we haven't moved significantly
|
- don't send location packets if we haven't moved significantly
|
||||||
- scrub default radio config settings for bandwidth/range/speed
|
- scrub default radio config settings for bandwidth/range/speed
|
||||||
|
@ -27,20 +27,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
|
#include "gps/GeoCoord.h"
|
||||||
#include "gps/RTC.h"
|
#include "gps/RTC.h"
|
||||||
#include "graphics/images.h"
|
#include "graphics/images.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "mesh/Channels.h"
|
#include "mesh/Channels.h"
|
||||||
#include "plugins/TextMessagePlugin.h"
|
#include "plugins/TextMessagePlugin.h"
|
||||||
|
#include "sleep.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gps/GeoCoord.h"
|
|
||||||
#include "sleep.h"
|
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
|
||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace meshtastic; /** @todo remove */
|
using namespace meshtastic; /** @todo remove */
|
||||||
@ -253,10 +253,10 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward plugin are enabled
|
// Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward plugin are enabled
|
||||||
static bool shouldDrawMessage(const MeshPacket *packet) {
|
static bool shouldDrawMessage(const MeshPacket *packet)
|
||||||
return packet->from != 0 &&
|
{
|
||||||
!radioConfig.preferences.range_test_plugin_enabled &&
|
return packet->from != 0 && !radioConfig.preferences.range_test_plugin_enabled &&
|
||||||
!radioConfig.preferences.store_forward_plugin_enabled;
|
!radioConfig.preferences.store_forward_plugin_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
@ -445,15 +445,16 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
|
|||||||
sprintf(coordinateLine, "%2i%1c %06i %07i", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
sprintf(coordinateLine, "%2i%1c %06i %07i", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
||||||
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
||||||
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatMGRS) { // Military Grid Reference System
|
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatMGRS) { // Military Grid Reference System
|
||||||
sprintf(coordinateLine, "%2i%1c %1c%1c %05i %05i", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(), geoCoord.getMGRSEast100k(),
|
sprintf(coordinateLine, "%2i%1c %1c%1c %05i %05i", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(),
|
||||||
geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(), geoCoord.getMGRSNorthing());
|
geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(),
|
||||||
|
geoCoord.getMGRSNorthing());
|
||||||
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatOLC) { // Open Location Code
|
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatOLC) { // Open Location Code
|
||||||
geoCoord.getOLCCode(coordinateLine);
|
geoCoord.getOLCCode(coordinateLine);
|
||||||
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatOSGR) { // Ordnance Survey Grid Reference
|
} else if (gpsFormat == GpsCoordinateFormat_GpsFormatOSGR) { // Ordnance Survey Grid Reference
|
||||||
if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region
|
if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region
|
||||||
sprintf(coordinateLine, "%s", "Out of Boundary");
|
sprintf(coordinateLine, "%s", "Out of Boundary");
|
||||||
else
|
else
|
||||||
sprintf(coordinateLine, "%1c%1c %05i %05i", geoCoord.getOSGRE100k(),geoCoord.getOSGRN100k(),
|
sprintf(coordinateLine, "%1c%1c %05i %05i", geoCoord.getOSGRE100k(), geoCoord.getOSGRN100k(),
|
||||||
geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,11 +619,6 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
n = nodeDB.getNodeByIndex(nodeIndex);
|
n = nodeDB.getNodeByIndex(nodeIndex);
|
||||||
}
|
}
|
||||||
displayedNodeNum = n->num;
|
displayedNodeNum = n->num;
|
||||||
|
|
||||||
// We just changed to a new node screen, ask that node for updated state if it's older than 2 minutes
|
|
||||||
if (sinceLastSeen(n) > 120) {
|
|
||||||
service.sendNetworkPing(displayedNodeNum, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);
|
NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);
|
||||||
@ -665,7 +661,8 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
// display direction toward node
|
// display direction toward node
|
||||||
hasNodeHeading = true;
|
hasNodeHeading = true;
|
||||||
Position &p = node->position;
|
Position &p = node->position;
|
||||||
float d = GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
float d =
|
||||||
|
GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
||||||
if (d < 2000)
|
if (d < 2000)
|
||||||
snprintf(distStr, sizeof(distStr), "%.0f m", d);
|
snprintf(distStr, sizeof(distStr), "%.0f m", d);
|
||||||
else
|
else
|
||||||
@ -673,7 +670,8 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
|
|
||||||
// FIXME, also keep the guess at the operators heading and add/substract
|
// FIXME, also keep the guess at the operators heading and add/substract
|
||||||
// it. currently we don't do this and instead draw north up only.
|
// it. currently we don't do this and instead draw north up only.
|
||||||
float bearingToOther = GeoCoord::bearing(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
float bearingToOther =
|
||||||
|
GeoCoord::bearing(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
||||||
headingRadian = bearingToOther - myHeading;
|
headingRadian = bearingToOther - myHeading;
|
||||||
drawNodeHeading(display, compassX, compassY, headingRadian);
|
drawNodeHeading(display, compassX, compassY, headingRadian);
|
||||||
}
|
}
|
||||||
@ -1450,7 +1448,8 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Screen::handleTextMessage(const MeshPacket *packet) {
|
int Screen::handleTextMessage(const MeshPacket *packet)
|
||||||
|
{
|
||||||
if (showingNormalScreen) {
|
if (showingNormalScreen) {
|
||||||
setFrames(); // Regen the list of screens (will show new text message)
|
setFrames(); // Regen the list of screens (will show new text message)
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,6 @@ void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer)
|
|||||||
insecureServer->registerNode(nodeJsonDelete);
|
insecureServer->registerNode(nodeJsonDelete);
|
||||||
insecureServer->registerNode(nodeJsonReport);
|
insecureServer->registerNode(nodeJsonReport);
|
||||||
insecureServer->registerNode(nodeRoot);
|
insecureServer->registerNode(nodeRoot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
||||||
@ -176,7 +175,6 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res)
|
|||||||
res->setHeader("Access-Control-Allow-Methods", "PUT, OPTIONS");
|
res->setHeader("Access-Control-Allow-Methods", "PUT, OPTIONS");
|
||||||
res->setHeader("X-Protobuf-Schema", "https://raw.githubusercontent.com/meshtastic/Meshtastic-protobufs/master/mesh.proto");
|
res->setHeader("X-Protobuf-Schema", "https://raw.githubusercontent.com/meshtastic/Meshtastic-protobufs/master/mesh.proto");
|
||||||
|
|
||||||
|
|
||||||
if (req->getMethod() == "OPTIONS") {
|
if (req->getMethod() == "OPTIONS") {
|
||||||
res->setStatusCode(204); // Success with no content
|
res->setStatusCode(204); // Success with no content
|
||||||
// res->print(""); @todo remove
|
// res->print(""); @todo remove
|
||||||
@ -285,7 +283,6 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||||||
std::string filename = "/static/" + parameter1;
|
std::string filename = "/static/" + parameter1;
|
||||||
std::string filenameGzip = "/static/" + parameter1 + ".gz";
|
std::string filenameGzip = "/static/" + parameter1 + ".gz";
|
||||||
|
|
||||||
|
|
||||||
// Try to open the file from SPIFFS
|
// Try to open the file from SPIFFS
|
||||||
File file;
|
File file;
|
||||||
|
|
||||||
|
@ -3,6 +3,4 @@
|
|||||||
|
|
||||||
#define BoolToString(x) ((x) ? "true" : "false")
|
#define BoolToString(x) ((x) ? "true" : "false")
|
||||||
|
|
||||||
|
|
||||||
void replaceAll(std::string &str, const std::string &from, const std::string &to);
|
void replaceAll(std::string &str, const std::string &from, const std::string &to);
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
#include "main.h"
|
|
||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
|
#include "graphics/Screen.h"
|
||||||
|
#include "main.h"
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
|
#include "sleep.h"
|
||||||
#include <HTTPBodyParser.hpp>
|
#include <HTTPBodyParser.hpp>
|
||||||
#include <HTTPMultipartBodyParser.hpp>
|
#include <HTTPMultipartBodyParser.hpp>
|
||||||
#include <HTTPURLEncodedBodyParser.hpp>
|
#include <HTTPURLEncodedBodyParser.hpp>
|
||||||
#include "sleep.h"
|
|
||||||
#include "graphics/Screen.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
@ -60,10 +59,9 @@ static void handleWebResponse()
|
|||||||
// will be ignored by the NRF boards.
|
// will be ignored by the NRF boards.
|
||||||
handleDNSResponse();
|
handleDNSResponse();
|
||||||
|
|
||||||
if(secureServer)
|
if (secureServer)
|
||||||
secureServer->loop();
|
secureServer->loop();
|
||||||
insecureServer->loop();
|
insecureServer->loop();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,7 +70,6 @@ static void taskCreateCert(void *parameter)
|
|||||||
{
|
{
|
||||||
prefs.begin("MeshtasticHTTPS", false);
|
prefs.begin("MeshtasticHTTPS", false);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Delete the saved certs (used in debugging)
|
// Delete the saved certs (used in debugging)
|
||||||
DEBUG_MSG("Deleting any saved SSL keys ...\n");
|
DEBUG_MSG("Deleting any saved SSL keys ...\n");
|
||||||
@ -81,7 +78,6 @@ static void taskCreateCert(void *parameter)
|
|||||||
prefs.remove("cert");
|
prefs.remove("cert");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
DEBUG_MSG("Checking if we have a previously saved SSL Certificate.\n");
|
DEBUG_MSG("Checking if we have a previously saved SSL Certificate.\n");
|
||||||
|
|
||||||
size_t pkLen = prefs.getBytesLength("PK");
|
size_t pkLen = prefs.getBytesLength("PK");
|
||||||
@ -142,11 +138,11 @@ void createSSLCert()
|
|||||||
// jm@casler.org (Oct 2020)
|
// jm@casler.org (Oct 2020)
|
||||||
xTaskCreate(taskCreateCert, /* Task function. */
|
xTaskCreate(taskCreateCert, /* Task function. */
|
||||||
"createCert", /* String with name of task. */
|
"createCert", /* String with name of task. */
|
||||||
//16384, /* Stack size in bytes. */
|
// 16384, /* Stack size in bytes. */
|
||||||
8192, /* Stack size in bytes. */
|
8192, /* Stack size in bytes. */
|
||||||
NULL, /* Parameter passed as input of the task */
|
NULL, /* Parameter passed as input of the task */
|
||||||
16, /* Priority of the task. */
|
16, /* Priority of the task. */
|
||||||
NULL); /* Task handle. */
|
NULL); /* Task handle. */
|
||||||
|
|
||||||
DEBUG_MSG("Waiting for SSL Cert to be generated.\n");
|
DEBUG_MSG("Waiting for SSL Cert to be generated.\n");
|
||||||
while (!isCertReady) {
|
while (!isCertReady) {
|
||||||
@ -193,7 +189,7 @@ void initWebServer()
|
|||||||
|
|
||||||
registerHandlers(insecureServer, secureServer);
|
registerHandlers(insecureServer, secureServer);
|
||||||
|
|
||||||
if(secureServer) {
|
if (secureServer) {
|
||||||
DEBUG_MSG("Starting Secure Web Server...\n");
|
DEBUG_MSG("Starting Secure Web Server...\n");
|
||||||
secureServer->start();
|
secureServer->start();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ class WebServerThread : private concurrency::OSThread
|
|||||||
WebServerThread();
|
WebServerThread();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,4 +21,3 @@ void handleDNSResponse();
|
|||||||
bool isSoftAPForced();
|
bool isSoftAPForced();
|
||||||
|
|
||||||
uint8_t getWifiDisconnectReason();
|
uint8_t getWifiDisconnectReason();
|
||||||
|
|
||||||
|
@ -38,18 +38,13 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c
|
|||||||
|
|
||||||
void getMacAddr(uint8_t *dmac)
|
void getMacAddr(uint8_t *dmac)
|
||||||
{
|
{
|
||||||
ble_gap_addr_t addr;
|
const uint8_t *src = (const uint8_t *)NRF_FICR->DEVICEADDR;
|
||||||
if (sd_ble_gap_addr_get(&addr) == NRF_SUCCESS) {
|
dmac[5] = src[0];
|
||||||
memcpy(dmac, addr.addr, 6);
|
dmac[4] = src[1];
|
||||||
} else {
|
dmac[3] = src[2];
|
||||||
const uint8_t *src = (const uint8_t *)NRF_FICR->DEVICEADDR;
|
dmac[2] = src[3];
|
||||||
dmac[5] = src[0];
|
dmac[1] = src[4];
|
||||||
dmac[4] = src[1];
|
dmac[0] = src[5] | 0xc0; // MSB high two bits get set elsewhere in the bluetooth stack
|
||||||
dmac[3] = src[2];
|
|
||||||
dmac[2] = src[3];
|
|
||||||
dmac[1] = src[4];
|
|
||||||
dmac[0] = src[5] | 0xc0; // MSB high two bits get set elsewhere in the bluetooth stack
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initBrownout()
|
static void initBrownout()
|
||||||
|
@ -80,8 +80,7 @@ void StoreForwardPlugin::populatePSRAM()
|
|||||||
/* Use a maximum of 2/3 the available PSRAM unless otherwise specified.
|
/* Use a maximum of 2/3 the available PSRAM unless otherwise specified.
|
||||||
Note: This needs to be done after every thing that would use PSRAM
|
Note: This needs to be done after every thing that would use PSRAM
|
||||||
*/
|
*/
|
||||||
uint32_t numberOfPackets =
|
uint32_t numberOfPackets = (this->records ? this->records : (((ESP.getFreePsram() / 3) * 2) / sizeof(PacketHistoryStruct)));
|
||||||
(this->records ? this->records : (((ESP.getFreePsram() / 3) * 2) / sizeof(PacketHistoryStruct)));
|
|
||||||
|
|
||||||
this->packetHistory = static_cast<PacketHistoryStruct *>(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
this->packetHistory = static_cast<PacketHistoryStruct *>(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct)));
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ void StoreForwardPlugin::historyReport()
|
|||||||
void StoreForwardPlugin::historySend(uint32_t msAgo, uint32_t to)
|
void StoreForwardPlugin::historySend(uint32_t msAgo, uint32_t to)
|
||||||
{
|
{
|
||||||
|
|
||||||
//uint32_t packetsSent = 0;
|
// uint32_t packetsSent = 0;
|
||||||
|
|
||||||
uint32_t queueSize = storeForwardPlugin->historyQueueCreate(msAgo, to);
|
uint32_t queueSize = storeForwardPlugin->historyQueueCreate(msAgo, to);
|
||||||
|
|
||||||
@ -144,13 +143,16 @@ uint32_t StoreForwardPlugin::historyQueueCreate(uint32_t msAgo, uint32_t to)
|
|||||||
Copy the messages that were received by the router in the last msAgo
|
Copy the messages that were received by the router in the last msAgo
|
||||||
to the packetHistoryTXQueue structure.
|
to the packetHistoryTXQueue structure.
|
||||||
|
|
||||||
TODO: The condition (this->packetHistory[i].to & 0xffffffff) == to) is not tested since
|
TODO: The condition (this->packetHistory[i].to & NODENUM_BROADCAST) == to) is not tested since
|
||||||
I don't have an easy way to target a specific user. Will need to do this soon.
|
I don't have an easy way to target a specific user. Will need to do this soon.
|
||||||
*/
|
*/
|
||||||
if ((this->packetHistory[i].to & 0xffffffff) == 0xffffffff || ((this->packetHistory[i].to & 0xffffffff) == to)) {
|
if ((this->packetHistory[i].to & NODENUM_BROADCAST) == NODENUM_BROADCAST ||
|
||||||
|
((this->packetHistory[i].to & NODENUM_BROADCAST) == to)) {
|
||||||
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].time = this->packetHistory[i].time;
|
||||||
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].time = this->packetHistory[i].time;
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].time = this->packetHistory[i].time;
|
||||||
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].to = this->packetHistory[i].to;
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].to = this->packetHistory[i].to;
|
||||||
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].from = this->packetHistory[i].from;
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].from = this->packetHistory[i].from;
|
||||||
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].channel = this->packetHistory[i].channel;
|
||||||
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload_size = this->packetHistory[i].payload_size;
|
this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload_size = this->packetHistory[i].payload_size;
|
||||||
memcpy(this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload, this->packetHistory[i].payload,
|
memcpy(this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload, this->packetHistory[i].payload,
|
||||||
Constants_DATA_PAYLOAD_LEN);
|
Constants_DATA_PAYLOAD_LEN);
|
||||||
@ -171,6 +173,7 @@ void StoreForwardPlugin::historyAdd(const MeshPacket &mp)
|
|||||||
|
|
||||||
this->packetHistory[this->packetHistoryCurrent].time = millis();
|
this->packetHistory[this->packetHistoryCurrent].time = millis();
|
||||||
this->packetHistory[this->packetHistoryCurrent].to = mp.to;
|
this->packetHistory[this->packetHistoryCurrent].to = mp.to;
|
||||||
|
this->packetHistory[this->packetHistoryCurrent].channel = mp.channel;
|
||||||
this->packetHistory[this->packetHistoryCurrent].from = mp.from;
|
this->packetHistory[this->packetHistoryCurrent].from = mp.from;
|
||||||
this->packetHistory[this->packetHistoryCurrent].payload_size = p.payload.size;
|
this->packetHistory[this->packetHistoryCurrent].payload_size = p.payload.size;
|
||||||
memcpy(this->packetHistory[this->packetHistoryCurrent].payload, p.payload.bytes, Constants_DATA_PAYLOAD_LEN);
|
memcpy(this->packetHistory[this->packetHistoryCurrent].payload, p.payload.bytes, Constants_DATA_PAYLOAD_LEN);
|
||||||
@ -191,6 +194,7 @@ void StoreForwardPlugin::sendPayload(NodeNum dest, uint32_t packetHistory_index)
|
|||||||
|
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
p->from = this->packetHistoryTXQueue[packetHistory_index].from;
|
p->from = this->packetHistoryTXQueue[packetHistory_index].from;
|
||||||
|
p->channel = this->packetHistoryTXQueue[packetHistory_index].channel;
|
||||||
|
|
||||||
// Let's assume that if the router received the S&F request that the client is in range.
|
// Let's assume that if the router received the S&F request that the client is in range.
|
||||||
// TODO: Make this configurable.
|
// TODO: Make this configurable.
|
||||||
@ -210,6 +214,10 @@ void StoreForwardPlugin::sendMessage(NodeNum dest, char *str)
|
|||||||
|
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
|
|
||||||
|
// FIXME - Determine if the delayed packet is broadcast or delayed. For now, assume
|
||||||
|
// everything is broadcast.
|
||||||
|
p->delayed = MeshPacket_Delayed_DELAYED_BROADCAST;
|
||||||
|
|
||||||
// Let's assume that if the router received the S&F request that the client is in range.
|
// Let's assume that if the router received the S&F request that the client is in range.
|
||||||
// TODO: Make this configurable.
|
// TODO: Make this configurable.
|
||||||
p->want_ack = false;
|
p->want_ack = false;
|
||||||
@ -351,7 +359,6 @@ ProcessMessage StoreForwardPlugin::handleReceivedProtobuf(const MeshPacket &mp,
|
|||||||
DEBUG_MSG("StoreAndForward_RequestResponse_ROUTER_PONG\n");
|
DEBUG_MSG("StoreAndForward_RequestResponse_ROUTER_PONG\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0); // unexpected state - FIXME, make an error code and reboot
|
assert(0); // unexpected state - FIXME, make an error code and reboot
|
||||||
}
|
}
|
||||||
@ -407,9 +414,8 @@ StoreForwardPlugin::StoreForwardPlugin()
|
|||||||
// Popupate PSRAM with our data structures.
|
// Popupate PSRAM with our data structures.
|
||||||
this->populatePSRAM();
|
this->populatePSRAM();
|
||||||
|
|
||||||
|
// this->packetTimeMax = 2000;
|
||||||
//this->packetTimeMax = 2000;
|
// DEBUG_MSG("SF Time to Transmit maxPacketSize (%d bytes) %d ms\n", maxPacketSize, this->packetTimeMax);
|
||||||
//DEBUG_MSG("SF Time to Transmit maxPacketSize (%d bytes) %d ms\n", maxPacketSize, this->packetTimeMax);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Device has less than 1M of PSRAM free. Aborting startup.\n");
|
DEBUG_MSG("Device has less than 1M of PSRAM free. Aborting startup.\n");
|
||||||
|
@ -12,6 +12,7 @@ struct PacketHistoryStruct {
|
|||||||
uint32_t time;
|
uint32_t time;
|
||||||
uint32_t to;
|
uint32_t to;
|
||||||
uint32_t from;
|
uint32_t from;
|
||||||
|
uint8_t channel;
|
||||||
bool ack;
|
bool ack;
|
||||||
uint8_t payload[Constants_DATA_PAYLOAD_LEN];
|
uint8_t payload[Constants_DATA_PAYLOAD_LEN];
|
||||||
pb_size_t payload_size;
|
pb_size_t payload_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user