mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 19:20:41 +00:00
Merge branch 'master' into xmodem-proto
This commit is contained in:
7
.github/workflows/build_esp32.yml
vendored
7
.github/workflows/build_esp32.yml
vendored
@@ -29,6 +29,13 @@ jobs:
|
|||||||
tar -xf build.tar -C data/static
|
tar -xf build.tar -C data/static
|
||||||
rm build.tar
|
rm build.tar
|
||||||
|
|
||||||
|
- name: Remove debug flags for release
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
run: |
|
||||||
|
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
||||||
|
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
||||||
|
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
||||||
|
|
||||||
- name: Build ESP32
|
- name: Build ESP32
|
||||||
run: bin/build-esp32.sh ${{ inputs.board }}
|
run: bin/build-esp32.sh ${{ inputs.board }}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ build_flags =
|
|||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||||
-DHAS_BLUETOOTH=0
|
-DHAS_BLUETOOTH=0
|
||||||
-DDEBUG_HEAP
|
-DDEBUG_HEAP
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ build_flags =
|
|||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||||
-DDEBUG_HEAP
|
-DDEBUG_HEAP
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
|
|||||||
Submodule protobufs updated: e00b5ba7d0...1763fe4a38
@@ -80,7 +80,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
listDir(file.path(), levels -1, del);
|
listDir(file.path(), levels -1, del);
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Removing %s\n", file.path());
|
LOG_DEBUG("Removing %s\n", file.path());
|
||||||
strcpy(buffer, file.path());
|
strncpy(buffer, file.path(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
} else {
|
} else {
|
||||||
@@ -90,7 +90,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
listDir(file.name(), levels -1, del);
|
listDir(file.name(), levels -1, del);
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Removing %s\n", file.name());
|
LOG_DEBUG("Removing %s\n", file.name());
|
||||||
strcpy(buffer, file.name());
|
strncpy(buffer, file.name(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
} else {
|
} else {
|
||||||
@@ -105,7 +105,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Deleting %s\n", file.path());
|
LOG_DEBUG("Deleting %s\n", file.path());
|
||||||
strcpy(buffer, file.path());
|
strncpy(buffer, file.path(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.remove(buffer);
|
FSCom.remove(buffer);
|
||||||
} else {
|
} else {
|
||||||
@@ -115,7 +115,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Deleting %s\n", file.name());
|
LOG_DEBUG("Deleting %s\n", file.name());
|
||||||
strcpy(buffer, file.name());
|
strncpy(buffer, file.name(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.remove(buffer);
|
FSCom.remove(buffer);
|
||||||
} else {
|
} else {
|
||||||
@@ -132,7 +132,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Removing %s\n", root.path());
|
LOG_DEBUG("Removing %s\n", root.path());
|
||||||
strcpy(buffer, root.path());
|
strncpy(buffer, root.path(), sizeof(buffer));
|
||||||
root.close();
|
root.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
} else {
|
} else {
|
||||||
@@ -141,7 +141,7 @@ void listDir(const char * dirname, uint8_t levels, boolean del = false)
|
|||||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
if(del) {
|
if(del) {
|
||||||
LOG_DEBUG("Removing %s\n", root.name());
|
LOG_DEBUG("Removing %s\n", root.name());
|
||||||
strcpy(buffer, root.name());
|
strncpy(buffer, root.name(), sizeof(buffer));
|
||||||
root.close();
|
root.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ bool AirTime::isTxAllowedChannelUtil(bool polite)
|
|||||||
bool AirTime::isTxAllowedAirUtil()
|
bool AirTime::isTxAllowedAirUtil()
|
||||||
{
|
{
|
||||||
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
||||||
if (utilizationTXPercent() < polite_tx_util_percent) {
|
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("Tx air utilization is >%d percent. Skipping this opportunity to send.\n", polite_tx_util_percent);
|
LOG_WARN("Tx air utilization is >%d percent. Skipping this opportunity to send.\n", myRegion->dutyCycle * polite_duty_cycle_percent / 100);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class AirTime : private concurrency::OSThread
|
|||||||
uint32_t secSinceBoot = 0;
|
uint32_t secSinceBoot = 0;
|
||||||
uint8_t max_channel_util_percent = 40;
|
uint8_t max_channel_util_percent = 40;
|
||||||
uint8_t polite_channel_util_percent = 25;
|
uint8_t polite_channel_util_percent = 25;
|
||||||
uint8_t polite_tx_util_percent = 5;
|
uint8_t polite_duty_cycle_percent = 50; // half of Duty Cycle allowance is ok for metadata
|
||||||
|
|
||||||
struct airtimeStruct {
|
struct airtimeStruct {
|
||||||
uint32_t periodTX[PERIODS_TO_LOG]; // AirTime transmitted
|
uint32_t periodTX[PERIODS_TO_LOG]; // AirTime transmitted
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ GnssModel_t GPS::probe()
|
|||||||
//tips: extensionNo field is 0 on some 6M GNSS modules
|
//tips: extensionNo field is 0 on some 6M GNSS modules
|
||||||
for (int i = 0; i < info.extensionNo; ++i) {
|
for (int i = 0; i < info.extensionNo; ++i) {
|
||||||
if (!strncmp(info.extension[i], "OD=", 3)) {
|
if (!strncmp(info.extension[i], "OD=", 3)) {
|
||||||
strcpy((char *)buffer, &(info.extension[i][3]));
|
strncpy((char *)buffer, &(info.extension[i][3]), sizeof(buffer));
|
||||||
LOG_DEBUG("GetModel:%s\n",(char *)buffer);
|
LOG_DEBUG("GetModel:%s\n",(char *)buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
* -------------------------------------------
|
* -------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t printWPL(char *buf, const Position &pos, const char *name)
|
uint32_t printWPL(char *buf, size_t bufsz, const Position &pos, const char *name)
|
||||||
{
|
{
|
||||||
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
|
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
|
||||||
uint32_t len = sprintf(buf, "$GNWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s",
|
uint32_t len = snprintf(buf, bufsz, "$GNWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s",
|
||||||
geoCoord.getDMSLatDeg(),
|
geoCoord.getDMSLatDeg(),
|
||||||
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
|
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
|
||||||
geoCoord.getDMSLatCP(),
|
geoCoord.getDMSLatCP(),
|
||||||
@@ -31,7 +31,7 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name)
|
|||||||
for (uint32_t i = 1; i < len; i++) {
|
for (uint32_t i = 1; i < len; i++) {
|
||||||
chk ^= buf[i];
|
chk ^= buf[i];
|
||||||
}
|
}
|
||||||
len += sprintf(buf + len, "*%02X\r\n", chk);
|
len += snprintf(buf + len, bufsz - len, "*%02X\r\n", chk);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +59,10 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name)
|
|||||||
* -------------------------------------------
|
* -------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t printGGA(char *buf, const Position &pos)
|
uint32_t printGGA(char *buf, size_t bufsz, const Position &pos)
|
||||||
{
|
{
|
||||||
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
|
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
|
||||||
uint32_t len = sprintf(buf, "$GNGGA,%06u.%03u,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d",
|
uint32_t len = snprintf(buf, bufsz, "$GNGGA,%06u.%03u,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d",
|
||||||
pos.time / 1000,
|
pos.time / 1000,
|
||||||
pos.time % 1000,
|
pos.time % 1000,
|
||||||
geoCoord.getDMSLatDeg(),
|
geoCoord.getDMSLatDeg(),
|
||||||
@@ -85,6 +85,6 @@ uint32_t printGGA(char *buf, const Position &pos)
|
|||||||
for (uint32_t i = 1; i < len; i++) {
|
for (uint32_t i = 1; i < len; i++) {
|
||||||
chk ^= buf[i];
|
chk ^= buf[i];
|
||||||
}
|
}
|
||||||
len += sprintf(buf + len, "*%02X\r\n", chk);
|
len += snprintf(buf + len, bufsz - len, "*%02X\r\n", chk);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -3,5 +3,5 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
uint32_t printWPL(char *buf, const Position &pos, const char *name);
|
uint32_t printWPL(char *buf, size_t bufsz, const Position &pos, const char *name);
|
||||||
uint32_t printGGA(char *buf, const Position &pos);
|
uint32_t printGGA(char *buf, size_t bufsz, const Position &pos);
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ static void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *img
|
|||||||
static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatus *nodeStatus)
|
static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatus *nodeStatus)
|
||||||
{
|
{
|
||||||
char usersString[20];
|
char usersString[20];
|
||||||
sprintf(usersString, "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal());
|
snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal());
|
||||||
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS)
|
||||||
display->drawFastImage(x, y + 3, 8, 8, imgUser);
|
display->drawFastImage(x, y + 3, 8, 8, imgUser);
|
||||||
#else
|
#else
|
||||||
@@ -521,7 +521,7 @@ static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus
|
|||||||
display->drawFastImage(x + 24, y, 8, 8, imgSatellite);
|
display->drawFastImage(x + 24, y, 8, 8, imgSatellite);
|
||||||
|
|
||||||
// Draw the number of satellites
|
// Draw the number of satellites
|
||||||
sprintf(satsString, "%u", gps->getNumSatellites());
|
snprintf(satsString, sizeof(satsString), "%u", gps->getNumSatellites());
|
||||||
display->drawString(x + 34, y - 2, satsString);
|
display->drawString(x + 34, y - 2, satsString);
|
||||||
if(config.display.heading_bold)
|
if(config.display.heading_bold)
|
||||||
display->drawString(x + 35, y - 2, satsString);
|
display->drawString(x + 35, y - 2, satsString);
|
||||||
@@ -582,21 +582,21 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
|
|||||||
if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
|
if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
|
||||||
char coordinateLine[22];
|
char coordinateLine[22];
|
||||||
if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
|
if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
|
||||||
sprintf(coordinateLine, "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7);
|
snprintf(coordinateLine, sizeof(coordinateLine), "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7);
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator
|
||||||
sprintf(coordinateLine, "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
|
||||||
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System
|
||||||
sprintf(coordinateLine, "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(),
|
||||||
geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(),
|
geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(),
|
||||||
geoCoord.getMGRSNorthing());
|
geoCoord.getMGRSNorthing());
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code
|
||||||
geoCoord.getOLCCode(coordinateLine);
|
geoCoord.getOLCCode(coordinateLine);
|
||||||
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference
|
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // 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");
|
snprintf(coordinateLine, sizeof(coordinateLine), "%s", "Out of Boundary");
|
||||||
else
|
else
|
||||||
sprintf(coordinateLine, "%1c%1c %05u %05u", geoCoord.getOSGRE100k(), geoCoord.getOSGRN100k(),
|
snprintf(coordinateLine, sizeof(coordinateLine), "%1c%1c %05u %05u", geoCoord.getOSGRE100k(), geoCoord.getOSGRN100k(),
|
||||||
geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,9 +614,9 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
|
|||||||
} else {
|
} else {
|
||||||
char latLine[22];
|
char latLine[22];
|
||||||
char lonLine[22];
|
char lonLine[22];
|
||||||
sprintf(latLine, "%2i° %2i' %2u\" %1c", geoCoord.getDMSLatDeg(), geoCoord.getDMSLatMin(), geoCoord.getDMSLatSec(),
|
snprintf(latLine, sizeof(latLine), "%2i° %2i' %2u\" %1c", geoCoord.getDMSLatDeg(), geoCoord.getDMSLatMin(), geoCoord.getDMSLatSec(),
|
||||||
geoCoord.getDMSLatCP());
|
geoCoord.getDMSLatCP());
|
||||||
sprintf(lonLine, "%3i° %2i' %2u\" %1c", geoCoord.getDMSLonDeg(), geoCoord.getDMSLonMin(), geoCoord.getDMSLonSec(),
|
snprintf(lonLine, sizeof(lonLine), "%3i° %2i' %2u\" %1c", geoCoord.getDMSLonDeg(), geoCoord.getDMSLonMin(), geoCoord.getDMSLonSec(),
|
||||||
geoCoord.getDMSLonCP());
|
geoCoord.getDMSLonCP());
|
||||||
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(latLine))) / 2, y - FONT_HEIGHT_SMALL * 1, latLine);
|
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(latLine))) / 2, y - FONT_HEIGHT_SMALL * 1, latLine);
|
||||||
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(lonLine))) / 2, y, lonLine);
|
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(lonLine))) / 2, y, lonLine);
|
||||||
@@ -831,7 +831,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char distStr[20];
|
static char distStr[20];
|
||||||
strcpy(distStr, "? km"); // might not have location data
|
strncpy(distStr, "? km", sizeof(distStr)); // might not have location data
|
||||||
NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
||||||
int16_t compassX = 0, compassY = 0;
|
int16_t compassX = 0, compassY = 0;
|
||||||
@@ -1010,7 +1010,7 @@ void Screen::setup()
|
|||||||
// Get our hardware ID
|
// Get our hardware ID
|
||||||
uint8_t dmac[6];
|
uint8_t dmac[6];
|
||||||
getMacAddr(dmac);
|
getMacAddr(dmac);
|
||||||
sprintf(ourId, "%02x%02x", dmac[4], dmac[5]);
|
snprintf(ourId, sizeof(ourId), "%02x%02x", dmac[4], dmac[5]);
|
||||||
|
|
||||||
// Turn on the display.
|
// Turn on the display.
|
||||||
handleSetOn(true);
|
handleSetOn(true);
|
||||||
@@ -1738,7 +1738,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
|
|
||||||
// Display Channel Utilization
|
// Display Channel Utilization
|
||||||
char chUtil[13];
|
char chUtil[13];
|
||||||
sprintf(chUtil, "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
|
snprintf(chUtil, sizeof(chUtil), "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
|
||||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
||||||
if (config.position.gps_enabled) {
|
if (config.position.gps_enabled) {
|
||||||
// Line 3
|
// Line 3
|
||||||
|
|||||||
@@ -110,12 +110,12 @@ const char *getDeviceName()
|
|||||||
|
|
||||||
// Meshtastic_ab3c or Shortname_abcd
|
// Meshtastic_ab3c or Shortname_abcd
|
||||||
static char name[20];
|
static char name[20];
|
||||||
sprintf(name, "%02x%02x", dmac[4], dmac[5]);
|
snprintf(name, sizeof(name), "%02x%02x", dmac[4], dmac[5]);
|
||||||
// if the shortname exists and is NOT the new default of ab3c, use it for BLE name.
|
// if the shortname exists and is NOT the new default of ab3c, use it for BLE name.
|
||||||
if ((owner.short_name != NULL) && (strcmp(owner.short_name, name) != 0)) {
|
if ((owner.short_name != NULL) && (strcmp(owner.short_name, name) != 0)) {
|
||||||
sprintf(name, "%s_%02x%02x", owner.short_name, dmac[4], dmac[5]);
|
snprintf(name, sizeof(name), "%s_%02x%02x", owner.short_name, dmac[4], dmac[5]);
|
||||||
} else {
|
} else {
|
||||||
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
|
snprintf(name, sizeof(name), "Meshtastic_%02x%02x", dmac[4], dmac[5]);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
|
|||||||
uint8_t defaultpskIndex = 1;
|
uint8_t defaultpskIndex = 1;
|
||||||
channelSettings.psk.bytes[0] = defaultpskIndex;
|
channelSettings.psk.bytes[0] = defaultpskIndex;
|
||||||
channelSettings.psk.size = 1;
|
channelSettings.psk.size = 1;
|
||||||
strcpy(channelSettings.name, "");
|
strncpy(channelSettings.name, "", sizeof(channelSettings.name));
|
||||||
|
|
||||||
ch.has_settings = true;
|
ch.has_settings = true;
|
||||||
ch.role = Channel_Role_PRIMARY;
|
ch.role = Channel_Role_PRIMARY;
|
||||||
|
|||||||
@@ -265,10 +265,10 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
|
|
||||||
// Set default owner name
|
// Set default owner name
|
||||||
pickNewNodeNum(); // based on macaddr now
|
pickNewNodeNum(); // based on macaddr now
|
||||||
sprintf(owner.long_name, "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
snprintf(owner.long_name, sizeof(owner.long_name), "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
sprintf(owner.short_name, "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
|
|
||||||
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
||||||
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,18 @@ const RegionInfo regions[] = {
|
|||||||
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
|
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
|
||||||
*/
|
*/
|
||||||
RDEF(TH, 920.0f, 925.0f, 100, 0, 16, true, false, false),
|
RDEF(TH, 920.0f, 925.0f, 100, 0, 16, true, false, false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
433,05-434,7 Mhz 10 mW
|
||||||
|
https://nkrzi.gov.ua/images/upload/256/5810/PDF_UUZ_19_01_2016.pdf
|
||||||
|
*/
|
||||||
|
RDEF(UA_433, 433.0f, 434.7f, 10, 0, 10, true, false, false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
868,0-868,6 Mhz 25 mW
|
||||||
|
https://nkrzi.gov.ua/images/upload/256/5810/PDF_UUZ_19_01_2016.pdf
|
||||||
|
*/
|
||||||
|
RDEF(UA_868, 868.0f, 868.6f, 1, 0, 14, true, false, false),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
2.4 GHZ WLAN Band equivalent. Only for SX128x chips.
|
2.4 GHZ WLAN Band equivalent. Only for SX128x chips.
|
||||||
|
|||||||
@@ -147,7 +147,11 @@ typedef enum _Config_LoRaConfig_RegionCode {
|
|||||||
/* Thailand */
|
/* Thailand */
|
||||||
Config_LoRaConfig_RegionCode_TH = 12,
|
Config_LoRaConfig_RegionCode_TH = 12,
|
||||||
/* WLAN Band */
|
/* WLAN Band */
|
||||||
Config_LoRaConfig_RegionCode_LORA_24 = 13
|
Config_LoRaConfig_RegionCode_LORA_24 = 13,
|
||||||
|
/* Ukraine 433mhz */
|
||||||
|
Config_LoRaConfig_RegionCode_UA_433 = 14,
|
||||||
|
/* Ukraine 868mhz */
|
||||||
|
Config_LoRaConfig_RegionCode_UA_868 = 15
|
||||||
} Config_LoRaConfig_RegionCode;
|
} Config_LoRaConfig_RegionCode;
|
||||||
|
|
||||||
/* Standard predefined channel settings
|
/* Standard predefined channel settings
|
||||||
@@ -437,8 +441,8 @@ extern "C" {
|
|||||||
#define _Config_DisplayConfig_DisplayMode_ARRAYSIZE ((Config_DisplayConfig_DisplayMode)(Config_DisplayConfig_DisplayMode_COLOR+1))
|
#define _Config_DisplayConfig_DisplayMode_ARRAYSIZE ((Config_DisplayConfig_DisplayMode)(Config_DisplayConfig_DisplayMode_COLOR+1))
|
||||||
|
|
||||||
#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET
|
#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET
|
||||||
#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_LORA_24
|
#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_UA_868
|
||||||
#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_LORA_24+1))
|
#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_UA_868+1))
|
||||||
|
|
||||||
#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST
|
#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST
|
||||||
#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST
|
#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST
|
||||||
|
|||||||
@@ -438,8 +438,9 @@ typedef struct _Waypoint {
|
|||||||
int32_t longitude_i;
|
int32_t longitude_i;
|
||||||
/* Time the waypoint is to expire (epoch) */
|
/* Time the waypoint is to expire (epoch) */
|
||||||
uint32_t expire;
|
uint32_t expire;
|
||||||
/* If true, only allow the original sender to update the waypoint. */
|
/* If greater than zero, treat the value as a nodenum only allowing them to update the waypoint.
|
||||||
bool locked;
|
If zero, the waypoint is open to be edited by any member of the mesh. */
|
||||||
|
uint32_t locked_to;
|
||||||
/* Name of the waypoint - max 30 chars */
|
/* Name of the waypoint - max 30 chars */
|
||||||
char name[30];
|
char name[30];
|
||||||
/* Description of the waypoint - max 100 chars */
|
/* Description of the waypoint - max 100 chars */
|
||||||
@@ -855,7 +856,7 @@ extern "C" {
|
|||||||
#define Waypoint_latitude_i_tag 2
|
#define Waypoint_latitude_i_tag 2
|
||||||
#define Waypoint_longitude_i_tag 3
|
#define Waypoint_longitude_i_tag 3
|
||||||
#define Waypoint_expire_tag 4
|
#define Waypoint_expire_tag 4
|
||||||
#define Waypoint_locked_tag 5
|
#define Waypoint_locked_to_tag 5
|
||||||
#define Waypoint_name_tag 6
|
#define Waypoint_name_tag 6
|
||||||
#define Waypoint_description_tag 7
|
#define Waypoint_description_tag 7
|
||||||
#define Waypoint_icon_tag 8
|
#define Waypoint_icon_tag 8
|
||||||
@@ -989,7 +990,7 @@ X(a, STATIC, SINGULAR, UINT32, id, 1) \
|
|||||||
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
|
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
|
||||||
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
|
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
|
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, locked, 5) \
|
X(a, STATIC, SINGULAR, UINT32, locked_to, 5) \
|
||||||
X(a, STATIC, SINGULAR, STRING, name, 6) \
|
X(a, STATIC, SINGULAR, STRING, name, 6) \
|
||||||
X(a, STATIC, SINGULAR, STRING, description, 7) \
|
X(a, STATIC, SINGULAR, STRING, description, 7) \
|
||||||
X(a, STATIC, SINGULAR, FIXED32, icon, 8)
|
X(a, STATIC, SINGULAR, FIXED32, icon, 8)
|
||||||
@@ -1149,7 +1150,7 @@ extern const pb_msgdesc_t Compressed_msg;
|
|||||||
#define Routing_size 42
|
#define Routing_size 42
|
||||||
#define ToRadio_size 324
|
#define ToRadio_size 324
|
||||||
#define User_size 77
|
#define User_size 77
|
||||||
#define Waypoint_size 161
|
#define Waypoint_size 165
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ bool initWifi()
|
|||||||
if (*wifiName) {
|
if (*wifiName) {
|
||||||
uint8_t dmac[6];
|
uint8_t dmac[6];
|
||||||
getMacAddr(dmac);
|
getMacAddr(dmac);
|
||||||
sprintf(ourHost, "Meshtastic-%02x%02x", dmac[4], dmac[5]);
|
snprintf(ourHost, sizeof(ourHost), "Meshtastic-%02x%02x", dmac[4], dmac[5]);
|
||||||
|
|
||||||
WiFi.mode(WIFI_MODE_STA);
|
WiFi.mode(WIFI_MODE_STA);
|
||||||
WiFi.setHostname(ourHost);
|
WiFi.setHostname(ourHost);
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ bool hasOpenEditTransaction;
|
|||||||
static const char *secretReserved = "sekrit";
|
static const char *secretReserved = "sekrit";
|
||||||
|
|
||||||
/// If buf is the reserved secret word, replace the buffer with currentVal
|
/// If buf is the reserved secret word, replace the buffer with currentVal
|
||||||
static void writeSecret(char *buf, const char *currentVal)
|
static void writeSecret(char *buf, size_t bufsz, const char *currentVal)
|
||||||
{
|
{
|
||||||
if (strcmp(buf, secretReserved) == 0) {
|
if (strcmp(buf, secretReserved) == 0) {
|
||||||
strcpy(buf, currentVal);
|
strncpy(buf, currentVal, bufsz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,15 +199,15 @@ void AdminModule::handleSetOwner(const User &o)
|
|||||||
|
|
||||||
if (*o.long_name) {
|
if (*o.long_name) {
|
||||||
changed |= strcmp(owner.long_name, o.long_name);
|
changed |= strcmp(owner.long_name, o.long_name);
|
||||||
strcpy(owner.long_name, o.long_name);
|
strncpy(owner.long_name, o.long_name, sizeof(owner.long_name));
|
||||||
}
|
}
|
||||||
if (*o.short_name) {
|
if (*o.short_name) {
|
||||||
changed |= strcmp(owner.short_name, o.short_name);
|
changed |= strcmp(owner.short_name, o.short_name);
|
||||||
strcpy(owner.short_name, o.short_name);
|
strncpy(owner.short_name, o.short_name, sizeof(owner.short_name));
|
||||||
}
|
}
|
||||||
if (*o.id) {
|
if (*o.id) {
|
||||||
changed |= strcmp(owner.id, o.id);
|
changed |= strcmp(owner.id, o.id);
|
||||||
strcpy(owner.id, o.id);
|
strncpy(owner.id, o.id, sizeof(owner.id));
|
||||||
}
|
}
|
||||||
if (owner.is_licensed != o.is_licensed) {
|
if (owner.is_licensed != o.is_licensed) {
|
||||||
changed = 1;
|
changed = 1;
|
||||||
@@ -381,7 +381,7 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
|
|||||||
LOG_INFO("Getting config: Network\n");
|
LOG_INFO("Getting config: Network\n");
|
||||||
res.get_config_response.which_payload_variant = Config_network_tag;
|
res.get_config_response.which_payload_variant = Config_network_tag;
|
||||||
res.get_config_response.payload_variant.network = config.network;
|
res.get_config_response.payload_variant.network = config.network;
|
||||||
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, config.network.wifi_psk);
|
writeSecret(res.get_config_response.payload_variant.network.wifi_psk, sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
||||||
break;
|
break;
|
||||||
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||||
LOG_INFO("Getting config: Display\n");
|
LOG_INFO("Getting config: Display\n");
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ int CannedMessageModule::splitConfiguredMessages()
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// collect all the message parts
|
// collect all the message parts
|
||||||
strcpy(this->messageStore, cannedMessageModuleConfig.messages);
|
strncpy(this->messageStore, cannedMessageModuleConfig.messages, sizeof(this->messageStore));
|
||||||
|
|
||||||
// The first message points to the beginning of the store.
|
// The first message points to the beginning of the store.
|
||||||
this->messages[messageIndex++] = this->messageStore;
|
this->messages[messageIndex++] = this->messageStore;
|
||||||
@@ -454,7 +454,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
|
|||||||
}
|
}
|
||||||
display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest));
|
display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest));
|
||||||
// used chars right aligned
|
// used chars right aligned
|
||||||
sprintf(buffer, "%d left", Constants_DATA_PAYLOAD_LEN - this->freetext.length());
|
snprintf(buffer, sizeof(buffer), "%d left", Constants_DATA_PAYLOAD_LEN - this->freetext.length());
|
||||||
display->drawString(x + display->getWidth() - display->getStringWidth(buffer), y + 0, buffer);
|
display->drawString(x + display->getWidth() - display->getStringWidth(buffer), y + 0, buffer);
|
||||||
if (this->destSelect) {
|
if (this->destSelect) {
|
||||||
display->drawString(x + display->getWidth() - display->getStringWidth(buffer) - 1, y + 0, buffer);
|
display->drawString(x + display->getWidth() - display->getStringWidth(buffer) - 1, y + 0, buffer);
|
||||||
@@ -551,7 +551,7 @@ void CannedMessageModule::handleGetCannedMessageModuleMessages(const MeshPacket
|
|||||||
LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n");
|
LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n");
|
||||||
if(req.decoded.want_response) {
|
if(req.decoded.want_response) {
|
||||||
response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag;
|
response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag;
|
||||||
strcpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages);
|
strncpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages, sizeof(response->get_canned_message_module_messages_response));
|
||||||
} // Don't send anything if not instructed to. Better than asserting.
|
} // Don't send anything if not instructed to. Better than asserting.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ void CannedMessageModule::handleSetCannedMessageModuleMessages(const char *from_
|
|||||||
|
|
||||||
if (*from_msg) {
|
if (*from_msg) {
|
||||||
changed |= strcmp(cannedMessageModuleConfig.messages, from_msg);
|
changed |= strcmp(cannedMessageModuleConfig.messages, from_msg);
|
||||||
strcpy(cannedMessageModuleConfig.messages, from_msg);
|
strncpy(cannedMessageModuleConfig.messages, from_msg, sizeof(cannedMessageModuleConfig.messages));
|
||||||
LOG_DEBUG("*** from_msg.text:%s\n", from_msg);
|
LOG_DEBUG("*** from_msg.text:%s\n", from_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminM
|
|||||||
LOG_INFO("*** handleGetRingtone\n");
|
LOG_INFO("*** handleGetRingtone\n");
|
||||||
if(req.decoded.want_response) {
|
if(req.decoded.want_response) {
|
||||||
response->which_payload_variant = AdminMessage_get_ringtone_response_tag;
|
response->which_payload_variant = AdminMessage_get_ringtone_response_tag;
|
||||||
strcpy(response->get_ringtone_response, rtttlConfig.ringtone);
|
strncpy(response->get_ringtone_response, rtttlConfig.ringtone, sizeof(response->get_ringtone_response));
|
||||||
} // Don't send anything if not instructed to. Better than asserting.
|
} // Don't send anything if not instructed to. Better than asserting.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg)
|
|||||||
|
|
||||||
if (*from_msg) {
|
if (*from_msg) {
|
||||||
changed |= strcmp(rtttlConfig.ringtone, from_msg);
|
changed |= strcmp(rtttlConfig.ringtone, from_msg);
|
||||||
strcpy(rtttlConfig.ringtone, from_msg);
|
strncpy(rtttlConfig.ringtone, from_msg, sizeof(rtttlConfig.ringtone));
|
||||||
LOG_INFO("*** from_msg.text:%s\n", from_msg);
|
LOG_INFO("*** from_msg.text:%s\n", from_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ SerialModuleRadio *serialModuleRadio;
|
|||||||
|
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("SerialModule") {}
|
SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("SerialModule") {}
|
||||||
|
|
||||||
char serialStringChar[Constants_DATA_PAYLOAD_LEN];
|
char serialBytes[Constants_DATA_PAYLOAD_LEN];
|
||||||
|
size_t serialPayloadSize;
|
||||||
|
|
||||||
SerialModuleRadio::SerialModuleRadio() : MeshModule("SerialModuleRadio")
|
SerialModuleRadio::SerialModuleRadio() : MeshModule("SerialModuleRadio")
|
||||||
{
|
{
|
||||||
@@ -199,19 +200,13 @@ int32_t SerialModule::runOnce()
|
|||||||
// in NMEA mode send out GGA every 2 seconds, Don't read from Port
|
// in NMEA mode send out GGA every 2 seconds, Don't read from Port
|
||||||
if (millis() - lastNmeaTime > 2000) {
|
if (millis() - lastNmeaTime > 2000) {
|
||||||
lastNmeaTime = millis();
|
lastNmeaTime = millis();
|
||||||
printGGA(outbuf, nodeDB.getNode(myNodeInfo.my_node_num)->position);
|
printGGA(outbuf, sizeof(outbuf), nodeDB.getNode(myNodeInfo.my_node_num)->position);
|
||||||
Serial2.printf("%s", outbuf);
|
Serial2.printf("%s", outbuf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String serialString;
|
|
||||||
|
|
||||||
while (Serial2.available()) {
|
while (Serial2.available()) {
|
||||||
serialString = Serial2.readString();
|
serialPayloadSize = Serial2.readBytes(serialBytes, Constants_DATA_PAYLOAD_LEN);
|
||||||
serialString.toCharArray(serialStringChar, Constants_DATA_PAYLOAD_LEN);
|
|
||||||
|
|
||||||
serialModuleRadio->sendPayload();
|
serialModuleRadio->sendPayload();
|
||||||
|
|
||||||
LOG_INFO("Received: %s\n", serialStringChar);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,14 +226,18 @@ MeshPacket *SerialModuleRadio::allocReply()
|
|||||||
|
|
||||||
void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
||||||
{
|
{
|
||||||
|
Channel *ch = (boundChannel != NULL) ? &channels.getByName(boundChannel) : NULL;
|
||||||
MeshPacket *p = allocReply();
|
MeshPacket *p = allocReply();
|
||||||
p->to = dest;
|
p->to = dest;
|
||||||
|
if (ch != NULL) {
|
||||||
|
p->channel = ch->index;
|
||||||
|
}
|
||||||
p->decoded.want_response = wantReplies;
|
p->decoded.want_response = wantReplies;
|
||||||
|
|
||||||
p->want_ack = ACK;
|
p->want_ack = ACK;
|
||||||
|
|
||||||
p->decoded.payload.size = strlen(serialStringChar); // You must specify how many bytes are in the reply
|
p->decoded.payload.size = serialPayloadSize; // You must specify how many bytes are in the reply
|
||||||
memcpy(p->decoded.payload.bytes, serialStringChar, p->decoded.payload.size);
|
memcpy(p->decoded.payload.bytes, serialBytes, p->decoded.payload.size);
|
||||||
|
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p);
|
||||||
}
|
}
|
||||||
@@ -294,7 +293,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
|
|||||||
decoded = &scratch;
|
decoded = &scratch;
|
||||||
}
|
}
|
||||||
// send position packet as WPL to the serial port
|
// send position packet as WPL to the serial port
|
||||||
printWPL(outbuf, *decoded, nodeDB.getNode(getFrom(&mp))->user.long_name);
|
printWPL(outbuf, sizeof(outbuf), *decoded, nodeDB.getNode(getFrom(&mp))->user.long_name);
|
||||||
Serial2.printf("%s", outbuf);
|
Serial2.printf("%s", outbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,9 +237,31 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
|
|||||||
// The router node should not be sending messages as a client. Unless he is a ROUTER_CLIENT
|
// The router node should not be sending messages as a client. Unless he is a ROUTER_CLIENT
|
||||||
if ((getFrom(&mp) != nodeDB.getNodeNum()) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
if ((getFrom(&mp) != nodeDB.getNodeNum()) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) {
|
||||||
|
|
||||||
if (mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) {
|
if ((mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) && is_server) {
|
||||||
storeForwardModule->historyAdd(mp);
|
auto &p = mp.decoded;
|
||||||
LOG_INFO("*** S&F stored. Message history contains %u records now.\n", this->packetHistoryCurrent);
|
if ((p.payload.bytes[0] == 'S') && (p.payload.bytes[1] == 'F') && (p.payload.bytes[2] == 0x00)) {
|
||||||
|
LOG_DEBUG("*** Legacy Request to send\n");
|
||||||
|
|
||||||
|
// Send the last 60 minutes of messages.
|
||||||
|
if (this->busy) {
|
||||||
|
storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY);
|
||||||
|
LOG_INFO("*** S&F - Busy. Try again shortly.\n");
|
||||||
|
MeshPacket *pr = allocReply();
|
||||||
|
pr->to = getFrom(&mp);
|
||||||
|
pr->priority = MeshPacket_Priority_MIN;
|
||||||
|
pr->want_ack = false;
|
||||||
|
pr->decoded.want_response = false;
|
||||||
|
pr->decoded.portnum = PortNum_TEXT_MESSAGE_APP;
|
||||||
|
memcpy(pr->decoded.payload.bytes, "** S&F - Busy. Try again shortly.", 34);
|
||||||
|
pr->decoded.payload.size = 34;
|
||||||
|
service.sendToMesh(pr);
|
||||||
|
} else {
|
||||||
|
storeForwardModule->historySend(historyReturnWindow * 60000, getFrom(&mp));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
storeForwardModule->historyAdd(mp);
|
||||||
|
LOG_INFO("*** S&F stored. Message history contains %u records now.\n", this->packetHistoryCurrent);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) {
|
} else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) {
|
||||||
auto &p = mp.decoded;
|
auto &p = mp.decoded;
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp)
|
|||||||
msgPayload["name"] = new JSONValue(decoded->name);
|
msgPayload["name"] = new JSONValue(decoded->name);
|
||||||
msgPayload["description"] = new JSONValue(decoded->description);
|
msgPayload["description"] = new JSONValue(decoded->description);
|
||||||
msgPayload["expire"] = new JSONValue((int)decoded->expire);
|
msgPayload["expire"] = new JSONValue((int)decoded->expire);
|
||||||
msgPayload["locked"] = new JSONValue(decoded->locked);
|
msgPayload["locked_to"] = new JSONValue((int)decoded->locked_to);
|
||||||
msgPayload["latitude_i"] = new JSONValue((int)decoded->latitude_i);
|
msgPayload["latitude_i"] = new JSONValue((int)decoded->latitude_i);
|
||||||
msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i);
|
msgPayload["longitude_i"] = new JSONValue((int)decoded->longitude_i);
|
||||||
jsonObj["payload"] = new JSONValue(msgPayload);
|
jsonObj["payload"] = new JSONValue(msgPayload);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#define LED_PIN LED
|
#define LED_PIN LED
|
||||||
|
|
||||||
#define HAS_SCREEN 0
|
#define HAS_SCREEN 0
|
||||||
#define HAS_GPS 0
|
|
||||||
|
|
||||||
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 0
|
minor = 0
|
||||||
build = 13
|
build = 14
|
||||||
|
|||||||
Reference in New Issue
Block a user