mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-14 15:31:31 +10:00
Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c89cc1da44 | ||
|
|
9980c56d81 | ||
|
|
191d20ed04 | ||
|
|
3c25652cdf | ||
|
|
fd5ca8b73c | ||
|
|
18058ef507 | ||
|
|
68fc931518 | ||
|
|
0ad6b813fc | ||
|
|
47a82bdb98 | ||
|
|
371313080b | ||
|
|
db55d8a59d | ||
|
|
949f881ae8 | ||
|
|
ca3c45a2f3 | ||
|
|
c33c368315 | ||
|
|
1835ff2d78 | ||
|
|
8e04f9f631 | ||
|
|
83be632a1a | ||
|
|
1ed7aad976 | ||
|
|
94d4bdf05c | ||
|
|
1968a009dd | ||
|
|
8e608e8186 | ||
|
|
d998f70b56 | ||
|
|
f55db903b2 | ||
|
|
91efaba389 | ||
|
|
a8c66547cc | ||
|
|
f77ca2533b | ||
|
|
07b58a82d5 | ||
|
|
e1485b530f | ||
|
|
db941bff3b | ||
|
|
13e1f99c7e |
+5
-5
@@ -9,24 +9,24 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.471
|
- checkov@3.2.471
|
||||||
- renovate@41.115.6
|
- renovate@41.127.2
|
||||||
- prettier@3.6.2
|
- prettier@3.6.2
|
||||||
- trufflehog@3.90.6
|
- trufflehog@3.90.8
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
- bandit@1.8.6
|
- bandit@1.8.6
|
||||||
- trivy@0.66.0
|
- trivy@0.66.0
|
||||||
- taplo@0.10.0
|
- taplo@0.10.0
|
||||||
- ruff@0.13.0
|
- ruff@0.13.1
|
||||||
- isort@6.0.1
|
- isort@6.0.1
|
||||||
- markdownlint@0.45.0
|
- markdownlint@0.45.0
|
||||||
- oxipng@9.1.5
|
- oxipng@9.1.5
|
||||||
- svgo@4.0.0
|
- svgo@4.0.0
|
||||||
- actionlint@1.7.7
|
- actionlint@1.7.7
|
||||||
- flake8@7.3.0
|
- flake8@7.3.0
|
||||||
- hadolint@2.13.1
|
- hadolint@2.14.0
|
||||||
- shfmt@3.6.0
|
- shfmt@3.6.0
|
||||||
- shellcheck@0.11.0
|
- shellcheck@0.11.0
|
||||||
- black@25.1.0
|
- black@25.9.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.28.0
|
- gitleaks@8.28.0
|
||||||
- clang-format@16.0.3
|
- clang-format@16.0.3
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform =
|
platform =
|
||||||
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
||||||
https://github.com/meshtastic/platform-native/archive/c490bcd019e0658404088a61b96e653c9da22c45.zip
|
https://github.com/meshtastic/platform-native/archive/d3f6e339534233c7217818867368767590ce549e.zip
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
|||||||
@@ -87,6 +87,9 @@
|
|||||||
</screenshots>
|
</screenshots>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="2.7.11" date="2025-09-24">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.11</url>
|
||||||
|
</release>
|
||||||
<release version="2.7.10" date="2025-09-18">
|
<release version="2.7.10" date="2025-09-18">
|
||||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.10</url>
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.10</url>
|
||||||
</release>
|
</release>
|
||||||
|
|||||||
Vendored
+3
-42
@@ -1,49 +1,10 @@
|
|||||||
meshtasticd (2.7.10.0) UNRELEASED; urgency=medium
|
meshtasticd (2.7.11.0) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
[ Austin Lane ]
|
||||||
* Initial packaging
|
* Initial packaging
|
||||||
* Version 2.5.19
|
* Version 2.5.19
|
||||||
|
|
||||||
[ ]
|
[ ]
|
||||||
* GitHub Actions Automatic version bump
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
[ ]
|
-- <github-actions[bot]@users.noreply.github.com> Wed, 24 Sep 2025 11:01:13 +0000
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ Ubuntu ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
[ ]
|
|
||||||
* GitHub Actions Automatic version bump
|
|
||||||
|
|
||||||
-- <github-actions[bot]@users.noreply.github.com> Thu, 18 Sep 2025 22:11:37 +0000
|
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ lib_deps =
|
|||||||
[environmental_base]
|
[environmental_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
|
# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
|
||||||
adafruit/Adafruit BusIO@1.17.3
|
adafruit/Adafruit BusIO@1.17.4
|
||||||
# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
|
# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
|
||||||
adafruit/Adafruit Unified Sensor@1.1.15
|
adafruit/Adafruit Unified Sensor@1.1.15
|
||||||
# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
|
# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->setRotation(1);
|
adafruitDisplay->setRotation(1);
|
||||||
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
|
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
|
||||||
}
|
}
|
||||||
#elif defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK)
|
#elif defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK) || defined(HELTEC_MESH_SOLAR_EINK)
|
||||||
{
|
{
|
||||||
spi1 = &SPI1;
|
spi1 = &SPI1;
|
||||||
spi1->begin();
|
spi1->begin();
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
SPIClass *hspi = NULL;
|
SPIClass *hspi = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK)
|
#if defined(HELTEC_MESH_POCKET) || defined(SEEED_WIO_TRACKER_L1_EINK) || defined(HELTEC_MESH_SOLAR_EINK)
|
||||||
SPIClass *spi1 = NULL;
|
SPIClass *spi1 = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,11 @@ extern uint16_t TFT_MESH;
|
|||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(T_LORA_PAGER)
|
||||||
|
// KB backlight control
|
||||||
|
#include "input/cardKbI2cImpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace meshtastic; /** @todo remove */
|
using namespace meshtastic; /** @todo remove */
|
||||||
|
|
||||||
namespace graphics
|
namespace graphics
|
||||||
@@ -655,6 +660,19 @@ void Screen::setup()
|
|||||||
MeshModule::observeUIEvents(&uiFrameEventObserver);
|
MeshModule::observeUIEvents(&uiFrameEventObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Screen::setOn(bool on, FrameCallback einkScreensaver)
|
||||||
|
{
|
||||||
|
#if defined(T_LORA_PAGER)
|
||||||
|
if (cardKbI2cImpl)
|
||||||
|
cardKbI2cImpl->toggleBacklight(on);
|
||||||
|
#endif
|
||||||
|
if (!on)
|
||||||
|
// We handle off commands immediately, because they might be called because the CPU is shutting down
|
||||||
|
handleSetOn(false, einkScreensaver);
|
||||||
|
else
|
||||||
|
enqueueCmd(ScreenCmd{.cmd = Cmd::SET_ON});
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::forceDisplay(bool forceUiUpdate)
|
void Screen::forceDisplay(bool forceUiUpdate)
|
||||||
{
|
{
|
||||||
// Nasty hack to force epaper updates for 'key' frames. FIXME, cleanup.
|
// Nasty hack to force epaper updates for 'key' frames. FIXME, cleanup.
|
||||||
|
|||||||
@@ -259,15 +259,7 @@ class Screen : public concurrency::OSThread
|
|||||||
void setup();
|
void setup();
|
||||||
|
|
||||||
/// Turns the screen on/off. Optionally, pass a custom screensaver frame for E-Ink
|
/// Turns the screen on/off. Optionally, pass a custom screensaver frame for E-Ink
|
||||||
void setOn(bool on, FrameCallback einkScreensaver = NULL)
|
void setOn(bool on, FrameCallback einkScreensaver = NULL);
|
||||||
{
|
|
||||||
if (!on)
|
|
||||||
// We handle off commands immediately, because they might be called because the CPU is shutting down
|
|
||||||
handleSetOn(false, einkScreensaver);
|
|
||||||
else
|
|
||||||
enqueueCmd(ScreenCmd{.cmd = Cmd::SET_ON});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the display for the unit going to the lowest power mode possible. Most screens will just
|
* Prepare the display for the unit going to the lowest power mode possible. Most screens will just
|
||||||
* poweroff, but eink screens will show a "I'm sleeping" graphic, possibly with a QR code
|
* poweroff, but eink screens will show a "I'm sleeping" graphic, possibly with a QR code
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti
|
|||||||
int iconX = iconRightEdge - mute_symbol_big_width;
|
int iconX = iconRightEdge - mute_symbol_big_width;
|
||||||
int iconY = textY + (FONT_HEIGHT_SMALL - mute_symbol_big_height) / 2;
|
int iconY = textY + (FONT_HEIGHT_SMALL - mute_symbol_big_height) / 2;
|
||||||
|
|
||||||
if (isInverted) {
|
if (isInverted && !force_no_invert) {
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
display->fillRect(iconX - 1, iconY - 1, mute_symbol_big_width + 2, mute_symbol_big_height + 2);
|
display->fillRect(iconX - 1, iconY - 1, mute_symbol_big_width + 2, mute_symbol_big_height + 2);
|
||||||
display->setColor(BLACK);
|
display->setColor(BLACK);
|
||||||
|
|||||||
@@ -200,6 +200,11 @@ uint8_t TCA8418KeyboardBase::flush()
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TCA8418KeyboardBase::clearInt()
|
||||||
|
{
|
||||||
|
writeRegister(TCA8418_REG_INT_STAT, 3);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t TCA8418KeyboardBase::digitalRead(uint8_t pinnum) const
|
uint8_t TCA8418KeyboardBase::digitalRead(uint8_t pinnum) const
|
||||||
{
|
{
|
||||||
if (pinnum > TCA8418_COL9)
|
if (pinnum > TCA8418_COL9)
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class TCA8418KeyboardBase
|
|||||||
virtual void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = TCA8418_KB_ADDR);
|
virtual void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = TCA8418_KB_ADDR);
|
||||||
|
|
||||||
virtual void reset(void);
|
virtual void reset(void);
|
||||||
|
void clearInt(void);
|
||||||
|
|
||||||
virtual void trigger(void);
|
virtual void trigger(void);
|
||||||
|
|
||||||
virtual void setBacklight(bool on);
|
virtual void setBacklight(bool on);
|
||||||
|
|||||||
@@ -105,7 +105,14 @@ void TLoraPagerKeyboard::trigger()
|
|||||||
|
|
||||||
void TLoraPagerKeyboard::setBacklight(bool on)
|
void TLoraPagerKeyboard::setBacklight(bool on)
|
||||||
{
|
{
|
||||||
toggleBacklight(!on);
|
uint32_t _brightness = 0;
|
||||||
|
if (on)
|
||||||
|
_brightness = brightness;
|
||||||
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
|
ledcWrite(KB_BL_PIN, _brightness);
|
||||||
|
#else
|
||||||
|
ledcWrite(LEDC_BACKLIGHT_CHANNEL, _brightness);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLoraPagerKeyboard::pressed(uint8_t key)
|
void TLoraPagerKeyboard::pressed(uint8_t key)
|
||||||
@@ -192,7 +199,6 @@ void TLoraPagerKeyboard::hapticFeedback()
|
|||||||
// toggle brightness of the backlight in three steps
|
// toggle brightness of the backlight in three steps
|
||||||
void TLoraPagerKeyboard::toggleBacklight(bool off)
|
void TLoraPagerKeyboard::toggleBacklight(bool off)
|
||||||
{
|
{
|
||||||
static uint32_t brightness = 0;
|
|
||||||
if (off) {
|
if (off) {
|
||||||
brightness = 0;
|
brightness = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -206,11 +212,7 @@ void TLoraPagerKeyboard::toggleBacklight(bool off)
|
|||||||
}
|
}
|
||||||
LOG_DEBUG("Toggle backlight: %d", brightness);
|
LOG_DEBUG("Toggle backlight: %d", brightness);
|
||||||
|
|
||||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
|
setBacklight(true);
|
||||||
ledcWrite(KB_BL_PIN, brightness);
|
|
||||||
#else
|
|
||||||
ledcWrite(LEDC_BACKLIGHT_CHANNEL, brightness);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLoraPagerKeyboard::updateModifierFlag(uint8_t key)
|
void TLoraPagerKeyboard::updateModifierFlag(uint8_t key)
|
||||||
|
|||||||
@@ -26,4 +26,5 @@ class TLoraPagerKeyboard : public TCA8418KeyboardBase
|
|||||||
uint32_t last_tap;
|
uint32_t last_tap;
|
||||||
uint8_t char_idx;
|
uint8_t char_idx;
|
||||||
int32_t tap_interval;
|
int32_t tap_interval;
|
||||||
|
uint32_t brightness = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ int32_t KbI2cBase::runOnce()
|
|||||||
}
|
}
|
||||||
TCAKeyboard.trigger();
|
TCAKeyboard.trigger();
|
||||||
}
|
}
|
||||||
|
TCAKeyboard.clearInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x02: {
|
case 0x02: {
|
||||||
@@ -519,4 +520,11 @@ int32_t KbI2cBase::runOnce()
|
|||||||
LOG_WARN("Unknown kb_model 0x%02x", kb_model);
|
LOG_WARN("Unknown kb_model 0x%02x", kb_model);
|
||||||
}
|
}
|
||||||
return 300;
|
return 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KbI2cBase::toggleBacklight(bool on)
|
||||||
|
{
|
||||||
|
#if defined(T_LORA_PAGER)
|
||||||
|
TCAKeyboard.setBacklight(on);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class KbI2cBase : public Observable<const InputEvent *>, public concurrency::OST
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit KbI2cBase(const char *name);
|
explicit KbI2cBase(const char *name);
|
||||||
|
void toggleBacklight(bool on);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int32_t runOnce() override;
|
virtual int32_t runOnce() override;
|
||||||
|
|||||||
@@ -369,6 +369,7 @@ void setup()
|
|||||||
digitalWrite(SDCARD_CS, HIGH);
|
digitalWrite(SDCARD_CS, HIGH);
|
||||||
pinMode(TFT_CS, OUTPUT);
|
pinMode(TFT_CS, OUTPUT);
|
||||||
digitalWrite(TFT_CS, HIGH);
|
digitalWrite(TFT_CS, HIGH);
|
||||||
|
pinMode(KB_INT, INPUT_PULLUP);
|
||||||
// io expander
|
// io expander
|
||||||
io.begin(Wire, XL9555_SLAVE_ADDRESS0, SDA, SCL);
|
io.begin(Wire, XL9555_SLAVE_ADDRESS0, SDA, SCL);
|
||||||
io.pinMode(EXPANDS_DRV_EN, OUTPUT);
|
io.pinMode(EXPANDS_DRV_EN, OUTPUT);
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
#include "FloodingRouter.h"
|
#include "FloodingRouter.h"
|
||||||
|
#include "MeshTypes.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
|
#include "meshUtils.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
|
#include "modules/TraceRouteModule.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
FloodingRouter::FloodingRouter() {}
|
FloodingRouter::FloodingRouter() {}
|
||||||
|
|
||||||
@@ -21,7 +26,37 @@ ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
bool wasUpgraded = false;
|
||||||
|
bool seenRecently =
|
||||||
|
wasSeenRecently(p, true, nullptr, nullptr, &wasUpgraded); // Updates history; returns false when an upgrade is detected
|
||||||
|
|
||||||
|
// Handle hop_limit upgrade scenario for rebroadcasters
|
||||||
|
// isRebroadcaster() is duplicated in perhapsRebroadcast(), but this avoids confusing log messages
|
||||||
|
if (wasUpgraded && isRebroadcaster() && iface && p->hop_limit > 0) {
|
||||||
|
// wasSeenRecently() reports false in upgrade cases so we handle replacement before the duplicate short-circuit
|
||||||
|
// If we overhear a duplicate copy of the packet with more hops left than the one we are waiting to
|
||||||
|
// rebroadcast, then remove the packet currently sitting in the TX queue and use this one instead.
|
||||||
|
uint8_t dropThreshold = p->hop_limit; // remove queued packets that have fewer hops remaining
|
||||||
|
if (iface->removePendingTXPacket(getFrom(p), p->id, dropThreshold)) {
|
||||||
|
LOG_DEBUG("Processing upgraded packet 0x%08x for rebroadcast with hop limit %d (dropping queued < %d)", p->id,
|
||||||
|
p->hop_limit, dropThreshold);
|
||||||
|
|
||||||
|
if (nodeDB)
|
||||||
|
nodeDB->updateFrom(*p);
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
|
if (traceRouteModule && p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
|
||||||
|
p->decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP)
|
||||||
|
traceRouteModule->processUpgradedPacket(*p);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
perhapsRebroadcast(p);
|
||||||
|
|
||||||
|
// We already enqueued the improved copy, so make sure the incoming packet stops here.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seenRecently) {
|
||||||
printPacket("Ignore dupe incoming msg", p);
|
printPacket("Ignore dupe incoming msg", p);
|
||||||
rxDupe++;
|
rxDupe++;
|
||||||
|
|
||||||
@@ -90,7 +125,12 @@ void FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
|||||||
if (isRebroadcaster()) {
|
if (isRebroadcaster()) {
|
||||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||||
|
|
||||||
tosend->hop_limit--; // bump down the hop count
|
// Use shared logic to determine if hop_limit should be decremented
|
||||||
|
if (shouldDecrementHopLimit(p)) {
|
||||||
|
tosend->hop_limit--; // bump down the hop count
|
||||||
|
} else {
|
||||||
|
LOG_INFO("favorite-ROUTER/CLIENT_BASE-to-ROUTER/CLIENT_BASE flood: preserving hop_limit");
|
||||||
|
}
|
||||||
#if USERPREFS_EVENT_MODE
|
#if USERPREFS_EVENT_MODE
|
||||||
if (tosend->hop_limit > 2) {
|
if (tosend->hop_limit > 2) {
|
||||||
// if we are "correcting" the hop_limit, "correct" the hop_start by the same amount to preserve hops away.
|
// if we are "correcting" the hop_limit, "correct" the hop_start by the same amount to preserve hops away.
|
||||||
@@ -98,6 +138,7 @@ void FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
|||||||
tosend->hop_limit = 2;
|
tosend->hop_limit = 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tosend->next_hop = NO_NEXT_HOP_PREFERENCE; // this should already be the case, but just in case
|
tosend->next_hop = NO_NEXT_HOP_PREFERENCE; // this should already be the case, but just in case
|
||||||
|
|
||||||
LOG_INFO("Rebroadcast received floodmsg");
|
LOG_INFO("Rebroadcast received floodmsg");
|
||||||
@@ -127,4 +168,4 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||||||
|
|
||||||
// handle the packet as normal
|
// handle the packet as normal
|
||||||
Router::sniffReceived(p, c);
|
Router::sniffReceived(p, c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ template <typename T> bool LR11x0Interface<T>::reconfigure()
|
|||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||||
|
|
||||||
err = lora.setBandwidth(bw);
|
err = lora.setBandwidth(bw, wideLora() && (getFreq() > 1000.0f));
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||||
|
|
||||||
@@ -181,6 +181,9 @@ template <typename T> bool LR11x0Interface<T>::reconfigure()
|
|||||||
err = lora.setOutputPower(power);
|
err = lora.setOutputPower(power);
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
// Initialize AGC/AFC reset timing (30 second interval)
|
||||||
|
nextAgcResetMs = millis() + THIRY_SECONDS_MS;
|
||||||
|
|
||||||
startReceive(); // restart receiving
|
startReceive(); // restart receiving
|
||||||
|
|
||||||
return RADIOLIB_ERR_NONE;
|
return RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -103,12 +103,26 @@ meshtastic_MeshPacket *MeshPacketQueue::getFront()
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Attempt to find and remove a packet from this queue. Returns a pointer to the removed packet, or NULL if not found */
|
/** Get a packet from this queue. Returns a pointer to the packet, or NULL if not found. */
|
||||||
meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool tx_normal, bool tx_late)
|
meshtastic_MeshPacket *MeshPacketQueue::getPacketFromQueue(NodeNum from, PacketId id)
|
||||||
{
|
{
|
||||||
for (auto it = queue.begin(); it != queue.end(); it++) {
|
for (auto it = queue.begin(); it != queue.end(); it++) {
|
||||||
auto p = (*it);
|
auto p = (*it);
|
||||||
if (getFrom(p) == from && p->id == id && ((tx_normal && !p->tx_after) || (tx_late && p->tx_after))) {
|
if (getFrom(p) == from && p->id == id) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attempt to find and remove a packet from this queue. Returns a pointer to the removed packet, or NULL if not found */
|
||||||
|
meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool tx_normal, bool tx_late, uint8_t hop_limit_lt)
|
||||||
|
{
|
||||||
|
for (auto it = queue.begin(); it != queue.end(); it++) {
|
||||||
|
auto p = (*it);
|
||||||
|
if (getFrom(p) == from && p->id == id && ((tx_normal && !p->tx_after) || (tx_late && p->tx_after)) &&
|
||||||
|
(!hop_limit_lt || p->hop_limit < hop_limit_lt)) {
|
||||||
queue.erase(it);
|
queue.erase(it);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -120,14 +134,7 @@ meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool t
|
|||||||
/* Attempt to find a packet from this queue. Return true if it was found. */
|
/* Attempt to find a packet from this queue. Return true if it was found. */
|
||||||
bool MeshPacketQueue::find(const NodeNum from, const PacketId id)
|
bool MeshPacketQueue::find(const NodeNum from, const PacketId id)
|
||||||
{
|
{
|
||||||
for (auto it = queue.begin(); it != queue.end(); it++) {
|
return getPacketFromQueue(from, id) != NULL;
|
||||||
const auto *p = *it;
|
|
||||||
if (getFrom(p) == from && p->id == id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -35,8 +35,12 @@ class MeshPacketQueue
|
|||||||
|
|
||||||
meshtastic_MeshPacket *getFront();
|
meshtastic_MeshPacket *getFront();
|
||||||
|
|
||||||
|
/** Get a packet from this queue. Returns a pointer to the packet, or NULL if not found. */
|
||||||
|
meshtastic_MeshPacket *getPacketFromQueue(NodeNum from, PacketId id);
|
||||||
|
|
||||||
/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */
|
/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */
|
||||||
meshtastic_MeshPacket *remove(NodeNum from, PacketId id, bool tx_normal = true, bool tx_late = true);
|
meshtastic_MeshPacket *remove(NodeNum from, PacketId id, bool tx_normal = true, bool tx_late = true,
|
||||||
|
uint8_t hop_limit_lt = 0);
|
||||||
|
|
||||||
/* Attempt to find a packet from this queue. Return true if it was found. */
|
/* Attempt to find a packet from this queue. Return true if it was found. */
|
||||||
bool find(const NodeNum from, const PacketId id);
|
bool find(const NodeNum from, const PacketId id);
|
||||||
|
|||||||
@@ -453,4 +453,4 @@ uint32_t MeshService::GetTimeSinceMeshPacket(const meshtastic_MeshPacket *mp)
|
|||||||
delta = 0;
|
delta = 0;
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,4 +190,4 @@ class MeshService
|
|||||||
friend class RoutingModule;
|
friend class RoutingModule;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MeshService *service;
|
extern MeshService *service;
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
#include "NextHopRouter.h"
|
#include "NextHopRouter.h"
|
||||||
|
#include "MeshTypes.h"
|
||||||
|
#include "meshUtils.h"
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
|
#include "modules/TraceRouteModule.h"
|
||||||
|
#endif
|
||||||
|
#include "NodeDB.h"
|
||||||
|
|
||||||
NextHopRouter::NextHopRouter() {}
|
NextHopRouter::NextHopRouter() {}
|
||||||
|
|
||||||
@@ -32,7 +38,35 @@ bool NextHopRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||||||
{
|
{
|
||||||
bool wasFallback = false;
|
bool wasFallback = false;
|
||||||
bool weWereNextHop = false;
|
bool weWereNextHop = false;
|
||||||
if (wasSeenRecently(p, true, &wasFallback, &weWereNextHop)) { // Note: this will also add a recent packet record
|
bool wasUpgraded = false;
|
||||||
|
bool seenRecently = wasSeenRecently(p, true, &wasFallback, &weWereNextHop,
|
||||||
|
&wasUpgraded); // Updates history; returns false when an upgrade is detected
|
||||||
|
|
||||||
|
// Handle hop_limit upgrade scenario for rebroadcasters
|
||||||
|
// isRebroadcaster() is duplicated in perhapsRelay(), but this avoids confusing log messages
|
||||||
|
if (wasUpgraded && isRebroadcaster() && iface && p->hop_limit > 0) {
|
||||||
|
// Upgrade detection bypasses the duplicate short-circuit so we replace the queued packet before exiting
|
||||||
|
uint8_t dropThreshold = p->hop_limit; // remove queued packets that have fewer hops remaining
|
||||||
|
if (iface->removePendingTXPacket(getFrom(p), p->id, dropThreshold)) {
|
||||||
|
LOG_DEBUG("Processing upgraded packet 0x%08x for relay with hop limit %d (dropping queued < %d)", p->id, p->hop_limit,
|
||||||
|
dropThreshold);
|
||||||
|
|
||||||
|
if (nodeDB)
|
||||||
|
nodeDB->updateFrom(*p);
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TRACEROUTE
|
||||||
|
if (traceRouteModule && p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
|
||||||
|
p->decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP)
|
||||||
|
traceRouteModule->processUpgradedPacket(*p);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
perhapsRelay(p);
|
||||||
|
|
||||||
|
// We already enqueued the improved copy, so make sure the incoming packet stops here.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seenRecently) {
|
||||||
printPacket("Ignore dupe incoming msg", p);
|
printPacket("Ignore dupe incoming msg", p);
|
||||||
|
|
||||||
if (p->transport_mechanism == meshtastic_MeshPacket_TransportMechanism_TRANSPORT_LORA) {
|
if (p->transport_mechanism == meshtastic_MeshPacket_TransportMechanism_TRANSPORT_LORA) {
|
||||||
@@ -108,7 +142,13 @@ bool NextHopRouter::perhapsRelay(const meshtastic_MeshPacket *p)
|
|||||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||||
LOG_INFO("Relaying received message coming from %x", p->relay_node);
|
LOG_INFO("Relaying received message coming from %x", p->relay_node);
|
||||||
|
|
||||||
tosend->hop_limit--; // bump down the hop count
|
// Use shared logic to determine if hop_limit should be decremented
|
||||||
|
if (shouldDecrementHopLimit(p)) {
|
||||||
|
tosend->hop_limit--; // bump down the hop count
|
||||||
|
} else {
|
||||||
|
LOG_INFO("Router/CLIENT_BASE-to-favorite-router/CLIENT_BASE relay: preserving hop_limit");
|
||||||
|
}
|
||||||
|
|
||||||
NextHopRouter::send(tosend);
|
NextHopRouter::send(tosend);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -291,4 +331,4 @@ void NextHopRouter::setNextTx(PendingPacket *pending)
|
|||||||
LOG_DEBUG("Setting next retransmission in %u msecs: ", d);
|
LOG_DEBUG("Setting next retransmission in %u msecs: ", d);
|
||||||
printPacket("", pending->packet);
|
printPacket("", pending->packet);
|
||||||
setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time
|
setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -204,7 +204,7 @@ NodeDB::NodeDB()
|
|||||||
|
|
||||||
int saveWhat = 0;
|
int saveWhat = 0;
|
||||||
// Get device unique id
|
// Get device unique id
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
uint32_t unique_id[4];
|
uint32_t unique_id[4];
|
||||||
// ESP32 factory burns a unique id in efuse for S2+ series and evidently C3+ series
|
// ESP32 factory burns a unique id in efuse for S2+ series and evidently C3+ series
|
||||||
// This is used for HMACs in the esp-rainmaker AIOT platform and seems to be a good choice for us
|
// This is used for HMACs in the esp-rainmaker AIOT platform and seems to be a good choice for us
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ PacketHistory::~PacketHistory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Update recentPackets and return true if we have already seen this packet */
|
/** Update recentPackets and return true if we have already seen this packet */
|
||||||
bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate, bool *wasFallback, bool *weWereNextHop)
|
bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate, bool *wasFallback, bool *weWereNextHop,
|
||||||
|
bool *wasUpgraded)
|
||||||
{
|
{
|
||||||
if (!initOk()) {
|
if (!initOk()) {
|
||||||
LOG_ERROR("Packet History - Was Seen Recently: NOT INITIALIZED!");
|
LOG_ERROR("Packet History - Was Seen Recently: NOT INITIALIZED!");
|
||||||
@@ -66,6 +67,7 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||||||
r.id = p->id;
|
r.id = p->id;
|
||||||
r.sender = getFrom(p); // If 0 then use our ID
|
r.sender = getFrom(p); // If 0 then use our ID
|
||||||
r.next_hop = p->next_hop;
|
r.next_hop = p->next_hop;
|
||||||
|
r.hop_limit = p->hop_limit;
|
||||||
r.relayed_by[0] = p->relay_node;
|
r.relayed_by[0] = p->relay_node;
|
||||||
|
|
||||||
r.rxTimeMsec = millis(); //
|
r.rxTimeMsec = millis(); //
|
||||||
@@ -81,6 +83,16 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||||||
PacketRecord *found = find(r.sender, r.id); // Find the packet record in the recentPackets array
|
PacketRecord *found = find(r.sender, r.id); // Find the packet record in the recentPackets array
|
||||||
bool seenRecently = (found != NULL); // If found -> the packet was seen recently
|
bool seenRecently = (found != NULL); // If found -> the packet was seen recently
|
||||||
|
|
||||||
|
// Check for hop_limit upgrade scenario
|
||||||
|
if (seenRecently && wasUpgraded && found->hop_limit < p->hop_limit) {
|
||||||
|
LOG_DEBUG("Packet History - Hop limit upgrade: packet 0x%08x from hop_limit=%d to hop_limit=%d", p->id, found->hop_limit,
|
||||||
|
p->hop_limit);
|
||||||
|
*wasUpgraded = true;
|
||||||
|
seenRecently = false; // Allow router processing but prevent duplicate app delivery
|
||||||
|
} else if (wasUpgraded) {
|
||||||
|
*wasUpgraded = false; // Initialize to false if not an upgrade
|
||||||
|
}
|
||||||
|
|
||||||
if (seenRecently) {
|
if (seenRecently) {
|
||||||
uint8_t ourRelayID = nodeDB->getLastByteOfNodeNum(nodeDB->getNodeNum()); // Get our relay ID from our node number
|
uint8_t ourRelayID = nodeDB->getLastByteOfNodeNum(nodeDB->getNodeNum()); // Get our relay ID from our node number
|
||||||
|
|
||||||
@@ -126,6 +138,11 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||||||
millis() - found->rxTimeMsec);
|
millis() - found->rxTimeMsec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Preserve the highest hop_limit we've ever seen for this packet so upgrades aren't lost when a later copy has
|
||||||
|
// fewer hops remaining.
|
||||||
|
if (found->hop_limit > r.hop_limit)
|
||||||
|
r.hop_limit = found->hop_limit;
|
||||||
|
|
||||||
// Add the existing relayed_by to the new record
|
// Add the existing relayed_by to the new record
|
||||||
for (uint8_t i = 0; i < (NUM_RELAYERS - 1); i++) {
|
for (uint8_t i = 0; i < (NUM_RELAYERS - 1); i++) {
|
||||||
if (found->relayed_by[i] != 0)
|
if (found->relayed_by[i] != 0)
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ class PacketHistory
|
|||||||
PacketId id;
|
PacketId id;
|
||||||
uint32_t rxTimeMsec; // Unix time in msecs - the time we received it, 0 means empty
|
uint32_t rxTimeMsec; // Unix time in msecs - the time we received it, 0 means empty
|
||||||
uint8_t next_hop; // The next hop asked for this packet
|
uint8_t next_hop; // The next hop asked for this packet
|
||||||
|
uint8_t hop_limit; // Highest hop limit observed for this packet
|
||||||
uint8_t relayed_by[NUM_RELAYERS]; // Array of nodes that relayed this packet
|
uint8_t relayed_by[NUM_RELAYERS]; // Array of nodes that relayed this packet
|
||||||
}; // 4B + 4B + 4B + 1B + 3B = 16B
|
}; // 4B + 4B + 4B + 1B + 1B + 3B = 17B (will be padded to 20B)
|
||||||
|
|
||||||
uint32_t recentPacketsCapacity =
|
uint32_t recentPacketsCapacity =
|
||||||
0; // Can be set in constructor, no need to recompile. Used to allocate memory for mx_recentPackets.
|
0; // Can be set in constructor, no need to recompile. Used to allocate memory for mx_recentPackets.
|
||||||
@@ -50,9 +51,10 @@ class PacketHistory
|
|||||||
* @param withUpdate if true and not found we add an entry to recentPackets
|
* @param withUpdate if true and not found we add an entry to recentPackets
|
||||||
* @param wasFallback if not nullptr, packet will be checked for fallback to flooding and value will be set to true if so
|
* @param wasFallback if not nullptr, packet will be checked for fallback to flooding and value will be set to true if so
|
||||||
* @param weWereNextHop if not nullptr, packet will be checked for us being the next hop and value will be set to true if so
|
* @param weWereNextHop if not nullptr, packet will be checked for us being the next hop and value will be set to true if so
|
||||||
|
* @param wasUpgraded if not nullptr, will be set to true if this packet has better hop_limit than previously seen
|
||||||
*/
|
*/
|
||||||
bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true, bool *wasFallback = nullptr,
|
bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true, bool *wasFallback = nullptr,
|
||||||
bool *weWereNextHop = nullptr);
|
bool *weWereNextHop = nullptr, bool *wasUpgraded = nullptr);
|
||||||
|
|
||||||
/* Check if a certain node was a relayer of a packet in the history given an ID and sender
|
/* Check if a certain node was a relayer of a packet in the history given an ID and sender
|
||||||
* If wasSole is not nullptr, it will be set to true if the relayer was the only relayer of that packet
|
* If wasSole is not nullptr, it will be set to true if the relayer was the only relayer of that packet
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
if (config_nonce == SPECIAL_NONCE_ONLY_NODES) {
|
if (config_nonce == SPECIAL_NONCE_ONLY_NODES) {
|
||||||
// If client only wants node info, jump directly to sending nodes
|
// If client only wants node info, jump directly to sending nodes
|
||||||
state = STATE_SEND_OTHER_NODEINFOS;
|
state = STATE_SEND_OTHER_NODEINFOS;
|
||||||
|
onNowHasData(0);
|
||||||
} else {
|
} else {
|
||||||
state = STATE_SEND_METADATA;
|
state = STATE_SEND_METADATA;
|
||||||
}
|
}
|
||||||
@@ -423,6 +424,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
state = STATE_SEND_FILEMANIFEST;
|
state = STATE_SEND_FILEMANIFEST;
|
||||||
} else {
|
} else {
|
||||||
state = STATE_SEND_OTHER_NODEINFOS;
|
state = STATE_SEND_OTHER_NODEINFOS;
|
||||||
|
onNowHasData(0);
|
||||||
}
|
}
|
||||||
config_state = 0;
|
config_state = 0;
|
||||||
}
|
}
|
||||||
@@ -588,6 +590,7 @@ bool PhoneAPI::available()
|
|||||||
nodeInfoForPhone.snr = isUs ? 0 : nodeInfoForPhone.snr;
|
nodeInfoForPhone.snr = isUs ? 0 : nodeInfoForPhone.snr;
|
||||||
nodeInfoForPhone.via_mqtt = isUs ? false : nodeInfoForPhone.via_mqtt;
|
nodeInfoForPhone.via_mqtt = isUs ? false : nodeInfoForPhone.via_mqtt;
|
||||||
nodeInfoForPhone.is_favorite = nodeInfoForPhone.is_favorite || isUs; // Our node is always a favorite
|
nodeInfoForPhone.is_favorite = nodeInfoForPhone.is_favorite || isUs; // Our node is always a favorite
|
||||||
|
onNowHasData(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true; // Always say we have something, because we might need to advance our state machine
|
return true; // Always say we have something, because we might need to advance our state machine
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ bool RF95Interface::reconfigure()
|
|||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||||
|
|
||||||
|
// Initialize AGC reset timing
|
||||||
|
nextAgcResetMs = millis() + 30000;
|
||||||
|
|
||||||
startReceive(); // restart receiving
|
startReceive(); // restart receiving
|
||||||
|
|
||||||
return RADIOLIB_ERR_NONE;
|
return RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -189,6 +189,12 @@ class RadioInterface
|
|||||||
/** If the packet is not already in the late rebroadcast window, move it there */
|
/** If the packet is not already in the late rebroadcast window, move it there */
|
||||||
virtual void clampToLateRebroadcastWindow(NodeNum from, PacketId id) { return; }
|
virtual void clampToLateRebroadcastWindow(NodeNum from, PacketId id) { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is a packet pending TX in the queue with a worse hop limit, remove it pending replacement with a better version
|
||||||
|
* @return Whether a pending packet was removed
|
||||||
|
*/
|
||||||
|
virtual bool removePendingTXPacket(NodeNum from, PacketId id, uint32_t hop_limit_lt) { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate airtime per
|
* Calculate airtime per
|
||||||
* https://www.rs-online.com/designspark/rel-assets/ds-assets/uploads/knowledge-items/application-notes-for-the-internet-of-things/LoRa%20Design%20Guide.pdf
|
* https://www.rs-online.com/designspark/rel-assets/ds-assets/uploads/knowledge-items/application-notes-for-the-internet-of-things/LoRa%20Design%20Guide.pdf
|
||||||
@@ -266,4 +272,4 @@ class RadioInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Debug printing for packets
|
/// Debug printing for packets
|
||||||
void printPacket(const char *prefix, const meshtastic_MeshPacket *p);
|
void printPacket(const char *prefix, const meshtastic_MeshPacket *p);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void LockingArduinoHal::spiTransfer(uint8_t *out, size_t len, uint8_t *in)
|
|||||||
|
|
||||||
RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
RADIOLIB_PIN_TYPE busy, PhysicalLayer *_iface)
|
RADIOLIB_PIN_TYPE busy, PhysicalLayer *_iface)
|
||||||
: NotifiedWorkerThread("RadioIf"), module(hal, cs, irq, rst, busy), iface(_iface)
|
: NotifiedWorkerThread("RadioIf"), module(hal, cs, irq, rst, busy), iface(_iface), nextAgcResetMs(0)
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
#if defined(ARCH_STM32WL) && defined(USE_SX1262)
|
#if defined(ARCH_STM32WL) && defined(USE_SX1262)
|
||||||
@@ -245,6 +245,9 @@ currently active.
|
|||||||
*/
|
*/
|
||||||
void RadioLibInterface::onNotify(uint32_t notification)
|
void RadioLibInterface::onNotify(uint32_t notification)
|
||||||
{
|
{
|
||||||
|
// Check for AGC reset before processing notifications
|
||||||
|
checkAndPerformAgcReset();
|
||||||
|
|
||||||
switch (notification) {
|
switch (notification) {
|
||||||
case ISR_TX:
|
case ISR_TX:
|
||||||
handleTransmitInterrupt();
|
handleTransmitInterrupt();
|
||||||
@@ -362,6 +365,26 @@ void RadioLibInterface::clampToLateRebroadcastWindow(NodeNum from, PacketId id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is a packet pending TX in the queue with a worse hop limit, remove it pending replacement with a better version
|
||||||
|
* @return Whether a pending packet was removed
|
||||||
|
*/
|
||||||
|
bool RadioLibInterface::removePendingTXPacket(NodeNum from, PacketId id, uint32_t hop_limit_lt)
|
||||||
|
{
|
||||||
|
meshtastic_MeshPacket *p = txQueue.remove(from, id, true, true, hop_limit_lt);
|
||||||
|
if (p) {
|
||||||
|
LOG_DEBUG("Dropping pending-TX packet 0x%08x with hop limit %d", p->id, p->hop_limit);
|
||||||
|
packetPool.release(p);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a packet that is eligible for replacement from the TX queue
|
||||||
|
*/
|
||||||
|
// void RadioLibInterface::removePending
|
||||||
|
|
||||||
void RadioLibInterface::handleTransmitInterrupt()
|
void RadioLibInterface::handleTransmitInterrupt()
|
||||||
{
|
{
|
||||||
// This can be null if we forced the device to enter standby mode. In that case
|
// This can be null if we forced the device to enter standby mode. In that case
|
||||||
@@ -532,4 +555,46 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
|||||||
|
|
||||||
return res == RADIOLIB_ERR_NONE;
|
return res == RADIOLIB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioLibInterface::checkAndPerformAgcReset()
|
||||||
|
{
|
||||||
|
// Use a sensible default of 30 seconds for AGC/AFC reset
|
||||||
|
// Based on MeshCore's approach and SX126x datasheet recommendations
|
||||||
|
static const uint32_t AGC_RESET_INTERVAL_MS = 30 * 1000U;
|
||||||
|
|
||||||
|
uint32_t now = millis();
|
||||||
|
|
||||||
|
// Add debug info on first call or when nextAgcResetMs is not set
|
||||||
|
static bool first_call = true;
|
||||||
|
if (first_call || nextAgcResetMs == 0) {
|
||||||
|
LOG_DEBUG("AGC reset: now=%u, nextAgcResetMs=%u, first_call=%d", now, nextAgcResetMs, first_call);
|
||||||
|
first_call = false;
|
||||||
|
if (nextAgcResetMs == 0) {
|
||||||
|
// Initialize if not set by reconfigure()
|
||||||
|
nextAgcResetMs = now + AGC_RESET_INTERVAL_MS;
|
||||||
|
LOG_DEBUG("AGC reset initialized to %u", nextAgcResetMs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (now < nextAgcResetMs) {
|
||||||
|
return; // Not time yet
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only reset if we're not actively sending, receiving, or processing packets
|
||||||
|
if (isSending() || isActivelyReceiving() || isReceiving) {
|
||||||
|
// Postpone reset by a short delay to avoid interfering with active operations
|
||||||
|
nextAgcResetMs = now + 1000; // Retry in 1 second
|
||||||
|
LOG_DEBUG("AGC reset postponed - radio busy");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO("Performing AGC/AFC reset via startReceive()");
|
||||||
|
|
||||||
|
// Use MeshCore's approach: issue startReceive() to reset AGC/AFC
|
||||||
|
// This is cleaner than direct register manipulation and works across all radio types
|
||||||
|
startReceive();
|
||||||
|
|
||||||
|
// Schedule next reset
|
||||||
|
nextAgcResetMs = now + AGC_RESET_INTERVAL_MS;
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#define RADIOLIB_PIN_TYPE uint32_t
|
#define RADIOLIB_PIN_TYPE uint32_t
|
||||||
|
|
||||||
|
#define THIRY_SECONDS_MS 30000
|
||||||
|
|
||||||
// In addition to the default Rx flags, we need the PREAMBLE_DETECTED flag to detect whether we are actively receiving
|
// In addition to the default Rx flags, we need the PREAMBLE_DETECTED flag to detect whether we are actively receiving
|
||||||
#define MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS (RADIOLIB_IRQ_RX_DEFAULT_FLAGS | (1 << RADIOLIB_IRQ_PREAMBLE_DETECTED))
|
#define MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS (RADIOLIB_IRQ_RX_DEFAULT_FLAGS | (1 << RADIOLIB_IRQ_PREAMBLE_DETECTED))
|
||||||
|
|
||||||
@@ -181,8 +183,18 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||||||
protected:
|
protected:
|
||||||
uint32_t activeReceiveStart = 0;
|
uint32_t activeReceiveStart = 0;
|
||||||
|
|
||||||
|
/** Track when we should next perform an AGC/AFC reset */
|
||||||
|
uint32_t nextAgcResetMs = 0;
|
||||||
|
|
||||||
bool receiveDetected(uint16_t irq, ulong syncWordHeaderValidFlag, ulong preambleDetectedFlag);
|
bool receiveDetected(uint16_t irq, ulong syncWordHeaderValidFlag, ulong preambleDetectedFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform AGC/AFC reset by issuing a startReceive() call if enough time has passed
|
||||||
|
* and we're not currently receiving or transmitting.
|
||||||
|
* Based on MeshCore's approach of using RadioLib startReceive() to reset AGC.
|
||||||
|
*/
|
||||||
|
void checkAndPerformAgcReset();
|
||||||
|
|
||||||
/** Do any hardware setup needed on entry into send configuration for the radio.
|
/** Do any hardware setup needed on entry into send configuration for the radio.
|
||||||
* Subclasses can customize, but must also call this base method */
|
* Subclasses can customize, but must also call this base method */
|
||||||
virtual void configHardwareForSend();
|
virtual void configHardwareForSend();
|
||||||
@@ -215,4 +227,11 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||||||
* If the packet is not already in the late rebroadcast window, move it there
|
* If the packet is not already in the late rebroadcast window, move it there
|
||||||
*/
|
*/
|
||||||
void clampToLateRebroadcastWindow(NodeNum from, PacketId id);
|
void clampToLateRebroadcastWindow(NodeNum from, PacketId id);
|
||||||
};
|
|
||||||
|
/**
|
||||||
|
* If there is a packet pending TX in the queue with a worse hop limit, remove it pending replacement with a better version
|
||||||
|
* @return Whether a pending packet was removed
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool removePendingTXPacket(NodeNum from, PacketId id, uint32_t hop_limit_lt) override;
|
||||||
|
};
|
||||||
|
|||||||
@@ -69,6 +69,58 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA
|
|||||||
cryptLock = new concurrency::Lock();
|
cryptLock = new concurrency::Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Router::shouldDecrementHopLimit(const meshtastic_MeshPacket *p)
|
||||||
|
{
|
||||||
|
// First hop MUST always decrement to prevent retry issues
|
||||||
|
bool isFirstHop = (p->hop_start != 0 && p->hop_start == p->hop_limit);
|
||||||
|
if (isFirstHop) {
|
||||||
|
return true; // Always decrement on first hop
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if both local device and previous relay are routers (including CLIENT_BASE)
|
||||||
|
bool localIsRouter =
|
||||||
|
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_CLIENT_BASE);
|
||||||
|
|
||||||
|
// If local device isn't a router, always decrement
|
||||||
|
if (!localIsRouter) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For subsequent hops, check if previous relay is a favorite router
|
||||||
|
// Optimized search for favorite routers with matching last byte
|
||||||
|
// Check ordering optimized for IoT devices (cheapest checks first)
|
||||||
|
for (int i = 0; i < nodeDB->getNumMeshNodes(); i++) {
|
||||||
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i);
|
||||||
|
if (!node)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check 1: is_favorite (cheapest - single bool)
|
||||||
|
if (!node->is_favorite)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check 2: has_user (cheap - single bool)
|
||||||
|
if (!node->has_user)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check 3: role check (moderate cost - multiple comparisons)
|
||||||
|
if (!IS_ONE_OF(node->user.role, meshtastic_Config_DeviceConfig_Role_ROUTER,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_ROUTER_LATE, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check 4: last byte extraction and comparison (most expensive)
|
||||||
|
if (nodeDB->getLastByteOfNodeNum(node->num) == p->relay_node) {
|
||||||
|
// Found a favorite router match
|
||||||
|
LOG_DEBUG("Identified favorite relay router 0x%x from last byte 0x%x", node->num, p->relay_node);
|
||||||
|
return false; // Don't decrement hop_limit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No favorite router match found, decrement hop_limit
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do idle processing
|
* do idle processing
|
||||||
* Mostly looking in our incoming rxPacket queue and calling handleReceived.
|
* Mostly looking in our incoming rxPacket queue and calling handleReceived.
|
||||||
|
|||||||
+13
-1
@@ -104,6 +104,18 @@ class Router : protected concurrency::OSThread, protected PacketHistory
|
|||||||
*/
|
*/
|
||||||
virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) { return false; }
|
virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if hop_limit should be decremented for a relay operation.
|
||||||
|
* Returns false (preserve hop_limit) only if all conditions are met:
|
||||||
|
* - It's NOT the first hop (first hop must always decrement)
|
||||||
|
* - Local device is a ROUTER, ROUTER_LATE, or CLIENT_BASE
|
||||||
|
* - Previous relay is a favorite ROUTER, ROUTER_LATE, or CLIENT_BASE
|
||||||
|
*
|
||||||
|
* @param p The packet being relayed
|
||||||
|
* @return true if hop_limit should be decremented, false to preserve it
|
||||||
|
*/
|
||||||
|
bool shouldDecrementHopLimit(const meshtastic_MeshPacket *p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
|
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
|
||||||
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
|
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
|
||||||
@@ -162,4 +174,4 @@ PacketId generatePacketId();
|
|||||||
#define BITFIELD_WANT_RESPONSE_SHIFT 1
|
#define BITFIELD_WANT_RESPONSE_SHIFT 1
|
||||||
#define BITFIELD_OK_TO_MQTT_SHIFT 0
|
#define BITFIELD_OK_TO_MQTT_SHIFT 0
|
||||||
#define BITFIELD_WANT_RESPONSE_MASK (1 << BITFIELD_WANT_RESPONSE_SHIFT)
|
#define BITFIELD_WANT_RESPONSE_MASK (1 << BITFIELD_WANT_RESPONSE_SHIFT)
|
||||||
#define BITFIELD_OK_TO_MQTT_MASK (1 << BITFIELD_OK_TO_MQTT_SHIFT)
|
#define BITFIELD_OK_TO_MQTT_MASK (1 << BITFIELD_OK_TO_MQTT_SHIFT)
|
||||||
|
|||||||
@@ -228,6 +228,9 @@ template <typename T> bool SX126xInterface<T>::reconfigure()
|
|||||||
LOG_ERROR("SX126X setOutputPower %s%d", radioLibErr, err);
|
LOG_ERROR("SX126X setOutputPower %s%d", radioLibErr, err);
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
// Initialize AGC/AFC reset timing (30 second interval)
|
||||||
|
nextAgcResetMs = millis() + THIRY_SECONDS_MS;
|
||||||
|
|
||||||
startReceive(); // restart receiving
|
startReceive(); // restart receiving
|
||||||
|
|
||||||
return RADIOLIB_ERR_NONE;
|
return RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ template <typename T> bool SX128xInterface<T>::reconfigure()
|
|||||||
LOG_ERROR("SX128X setOutputPower %s%d", radioLibErr, err);
|
LOG_ERROR("SX128X setOutputPower %s%d", radioLibErr, err);
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
// Initialize AGC/AFC reset timing (30 second interval)
|
||||||
|
nextAgcResetMs = millis() + THIRY_SECONDS_MS;
|
||||||
|
|
||||||
startReceive(); // restart receiving
|
startReceive(); // restart receiving
|
||||||
|
|
||||||
return RADIOLIB_ERR_NONE;
|
return RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -293,9 +293,7 @@ void setupModules()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
||||||
if (moduleConfig.has_external_notification && moduleConfig.external_notification.enabled) {
|
externalNotificationModule = new ExternalNotificationModule();
|
||||||
externalNotificationModule = new ExternalNotificationModule();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if !MESHTASTIC_EXCLUDE_RANGETEST && !MESHTASTIC_EXCLUDE_GPS
|
#if !MESHTASTIC_EXCLUDE_RANGETEST && !MESHTASTIC_EXCLUDE_GPS
|
||||||
if (moduleConfig.has_range_test && moduleConfig.range_test.enabled)
|
if (moduleConfig.has_range_test && moduleConfig.range_test.enabled)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp
|
|||||||
auto &p = mp.decoded;
|
auto &p = mp.decoded;
|
||||||
LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes);
|
LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We only store/display messages destined for us.
|
// We only store/display messages destined for us.
|
||||||
// Keep a copy of the most recent text message.
|
// Keep a copy of the most recent text message.
|
||||||
devicestate.rx_text_message = mp;
|
devicestate.rx_text_message = mp;
|
||||||
@@ -30,4 +31,4 @@ ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp
|
|||||||
bool TextMessageModule::wantPacket(const meshtastic_MeshPacket *p)
|
bool TextMessageModule::wantPacket(const meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
return MeshService::isTextPayload(p);
|
return MeshService::isTextPayload(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,20 @@ void TraceRouteModule::alterReceivedProtobuf(meshtastic_MeshPacket &p, meshtasti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceRouteModule::processUpgradedPacket(const meshtastic_MeshPacket &mp)
|
||||||
|
{
|
||||||
|
if (mp.which_payload_variant != meshtastic_MeshPacket_decoded_tag || mp.decoded.portnum != meshtastic_PortNum_TRACEROUTE_APP)
|
||||||
|
return;
|
||||||
|
|
||||||
|
meshtastic_RouteDiscovery decoded = meshtastic_RouteDiscovery_init_zero;
|
||||||
|
if (!pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, &meshtastic_RouteDiscovery_msg, &decoded))
|
||||||
|
return;
|
||||||
|
|
||||||
|
handleReceivedProtobuf(mp, &decoded);
|
||||||
|
// Intentionally modify the packet in-place so downstream relays see our updates.
|
||||||
|
alterReceivedProtobuf(const_cast<meshtastic_MeshPacket &>(mp), &decoded);
|
||||||
|
}
|
||||||
|
|
||||||
void TraceRouteModule::insertUnknownHops(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r, bool isTowardsDestination)
|
void TraceRouteModule::insertUnknownHops(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r, bool isTowardsDestination)
|
||||||
{
|
{
|
||||||
pb_size_t *route_count;
|
pb_size_t *route_count;
|
||||||
@@ -760,4 +774,4 @@ int32_t TraceRouteModule::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return INT32_MAX;
|
return INT32_MAX;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class TraceRouteModule : public ProtobufModule<meshtastic_RouteDiscovery>,
|
|||||||
virtual bool wantUIFrame() override { return shouldDraw(); }
|
virtual bool wantUIFrame() override { return shouldDraw(); }
|
||||||
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() override { return this; }
|
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() override { return this; }
|
||||||
|
|
||||||
|
void processUpgradedPacket(const meshtastic_MeshPacket &mp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) override;
|
bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) override;
|
||||||
|
|
||||||
@@ -70,4 +72,4 @@ class TraceRouteModule : public ProtobufModule<meshtastic_RouteDiscovery>,
|
|||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TraceRouteModule *traceRouteModule;
|
extern TraceRouteModule *traceRouteModule;
|
||||||
|
|||||||
@@ -174,11 +174,11 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
|
|||||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
display->drawString(x_offset + x, y_offset + y, "Bluetooth");
|
display->drawString(x_offset + x, y_offset + y, "Bluetooth");
|
||||||
|
#if !defined(M5STACK_UNITC6L)
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_MEDIUM - 4 : y_offset + FONT_HEIGHT_MEDIUM + 5;
|
y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_MEDIUM - 4 : y_offset + FONT_HEIGHT_MEDIUM + 5;
|
||||||
display->drawString(x_offset + x, y_offset + y, "Enter this code");
|
display->drawString(x_offset + x, y_offset + y, "Enter this code");
|
||||||
|
#endif
|
||||||
display->setFont(FONT_LARGE);
|
display->setFont(FONT_LARGE);
|
||||||
char pin[8];
|
char pin[8];
|
||||||
snprintf(pin, sizeof(pin), "%.3s %.3s", btPIN, btPIN + 3);
|
snprintf(pin, sizeof(pin), "%.3s %.3s", btPIN, btPIN + 3);
|
||||||
@@ -247,6 +247,9 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
|
|||||||
bluetoothPhoneAPI->numBytes = 0;
|
bluetoothPhoneAPI->numBytes = 0;
|
||||||
bluetoothPhoneAPI->queue_size = 0;
|
bluetoothPhoneAPI->queue_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the last ToRadio packet buffer to avoid rejecting first packet from new connection
|
||||||
|
memset(lastToRadio, 0, sizeof(lastToRadio));
|
||||||
#ifdef NIMBLE_TWO
|
#ifdef NIMBLE_TWO
|
||||||
// Restart Advertising
|
// Restart Advertising
|
||||||
ble->startAdvertising();
|
ble->startAdvertising();
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ static BLEDfuSecure bledfusecure; //
|
|||||||
static uint8_t fromRadioBytes[meshtastic_FromRadio_size];
|
static uint8_t fromRadioBytes[meshtastic_FromRadio_size];
|
||||||
static uint8_t toRadioBytes[meshtastic_ToRadio_size];
|
static uint8_t toRadioBytes[meshtastic_ToRadio_size];
|
||||||
|
|
||||||
|
// Last ToRadio value received from the phone
|
||||||
|
static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE];
|
||||||
|
|
||||||
static uint16_t connectionHandle;
|
static uint16_t connectionHandle;
|
||||||
|
|
||||||
class BluetoothPhoneAPI : public PhoneAPI
|
class BluetoothPhoneAPI : public PhoneAPI
|
||||||
@@ -74,6 +77,9 @@ void onDisconnect(uint16_t conn_handle, uint8_t reason)
|
|||||||
bluetoothPhoneAPI->close();
|
bluetoothPhoneAPI->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the last ToRadio packet buffer to avoid rejecting first packet from new connection
|
||||||
|
memset(lastToRadio, 0, sizeof(lastToRadio));
|
||||||
|
|
||||||
// Notify UI (or any other interested firmware components)
|
// Notify UI (or any other interested firmware components)
|
||||||
meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED);
|
meshtastic::BluetoothStatus newStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED);
|
||||||
bluetoothStatus->updateStatus(&newStatus);
|
bluetoothStatus->updateStatus(&newStatus);
|
||||||
@@ -145,8 +151,6 @@ void onFromRadioAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_e
|
|||||||
}
|
}
|
||||||
authorizeRead(conn_hdl);
|
authorizeRead(conn_hdl);
|
||||||
}
|
}
|
||||||
// Last ToRadio value received from the phone
|
|
||||||
static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE];
|
|
||||||
|
|
||||||
void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
|
void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-4
@@ -411,12 +411,16 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
// assert(uart_set_wakeup_threshold(UART_NUM_0, 3) == ESP_OK);
|
// assert(uart_set_wakeup_threshold(UART_NUM_0, 3) == ESP_OK);
|
||||||
// assert(esp_sleep_enable_uart_wakeup(0) == ESP_OK);
|
// assert(esp_sleep_enable_uart_wakeup(0) == ESP_OK);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUTTON_PIN
|
#ifdef ROTARY_PRESS
|
||||||
// The enableLoraInterrupt() method is using ext0_wakeup, so we are forced to use GPIO wakeup
|
// The enableLoraInterrupt() method is using ext0_wakeup, so we are forced to use GPIO wakeup
|
||||||
|
gpio_wakeup_enable((gpio_num_t)ROTARY_PRESS, GPIO_INTR_LOW_LEVEL);
|
||||||
|
#endif
|
||||||
|
#ifdef KB_INT
|
||||||
|
gpio_wakeup_enable((gpio_num_t)KB_INT, GPIO_INTR_LOW_LEVEL);
|
||||||
|
#endif
|
||||||
|
#ifdef BUTTON_PIN
|
||||||
gpio_num_t pin = (gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN);
|
gpio_num_t pin = (gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN);
|
||||||
|
|
||||||
gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL);
|
gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL);
|
||||||
esp_sleep_enable_gpio_wakeup();
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef INPUTDRIVER_ENCODER_BTN
|
#ifdef INPUTDRIVER_ENCODER_BTN
|
||||||
gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL);
|
gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL);
|
||||||
@@ -450,7 +454,12 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
// commented out because it's not that crucial;
|
// commented out because it's not that crucial;
|
||||||
// if it sporadically happens the node will go into light sleep during the next round
|
// if it sporadically happens the node will go into light sleep during the next round
|
||||||
// assert(res == ESP_OK);
|
// assert(res == ESP_OK);
|
||||||
|
#ifdef ROTARY_PRESS
|
||||||
|
gpio_wakeup_disable((gpio_num_t)ROTARY_PRESS);
|
||||||
|
#endif
|
||||||
|
#ifdef KB_INT
|
||||||
|
gpio_wakeup_disable((gpio_num_t)KB_INT);
|
||||||
|
#endif
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
// Disable wake-on-button interrupt. Re-attach normal button-interrupts
|
// Disable wake-on-button interrupt. Re-attach normal button-interrupts
|
||||||
gpio_wakeup_disable(pin);
|
gpio_wakeup_disable(pin);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = heltec_v4
|
board = heltec_v4
|
||||||
board_check = true
|
board_check = true
|
||||||
|
board_build.partitions = default_16MB.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32s3_base.build_flags}
|
${esp32s3_base.build_flags}
|
||||||
-D HELTEC_V4
|
-D HELTEC_V4
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
|
||||||
|
|
||||||
|
// InkHUD-specific components
|
||||||
|
// ---------------------------
|
||||||
|
#include "graphics/niche/InkHUD/InkHUD.h"
|
||||||
|
|
||||||
|
// Applets
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h"
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h"
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h"
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h"
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h"
|
||||||
|
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h"
|
||||||
|
|
||||||
|
// Shared NicheGraphics components
|
||||||
|
// --------------------------------
|
||||||
|
#include "graphics/niche/Drivers/EInk/E0213A367.h"
|
||||||
|
#include "graphics/niche/Inputs/TwoButton.h"
|
||||||
|
|
||||||
|
void setupNicheGraphics()
|
||||||
|
{
|
||||||
|
using namespace NicheGraphics;
|
||||||
|
|
||||||
|
// SPI
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
// For NRF52 platforms, SPI pins are defined in variant.h
|
||||||
|
SPI1.begin();
|
||||||
|
|
||||||
|
// E-Ink Driver
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
Drivers::EInk *driver = new Drivers::E0213A367;
|
||||||
|
driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES);
|
||||||
|
|
||||||
|
// InkHUD
|
||||||
|
// ----------------------------
|
||||||
|
|
||||||
|
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance();
|
||||||
|
|
||||||
|
// Set the E-Ink driver
|
||||||
|
inkhud->setDriver(driver);
|
||||||
|
|
||||||
|
// Set how many FAST updates per FULL update
|
||||||
|
// Set how unhealthy additional FAST updates beyond this number are
|
||||||
|
inkhud->setDisplayResilience(10, 1.5);
|
||||||
|
|
||||||
|
// Select fonts
|
||||||
|
InkHUD::Applet::fontLarge = FREESANS_12PT_WIN1252;
|
||||||
|
InkHUD::Applet::fontMedium = FREESANS_9PT_WIN1252;
|
||||||
|
InkHUD::Applet::fontSmall = FREESANS_6PT_WIN1252;
|
||||||
|
|
||||||
|
// Customize default settings
|
||||||
|
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle?
|
||||||
|
inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise
|
||||||
|
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users
|
||||||
|
inkhud->persistence->settings.optionalMenuItems.nextTile = true;
|
||||||
|
|
||||||
|
// Pick applets
|
||||||
|
// Note: order of applets determines priority of "auto-show" feature
|
||||||
|
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown
|
||||||
|
inkhud->addApplet("DMs", new InkHUD::DMApplet); // -
|
||||||
|
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // -
|
||||||
|
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // -
|
||||||
|
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated
|
||||||
|
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // -
|
||||||
|
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0
|
||||||
|
|
||||||
|
// Start running InkHUD
|
||||||
|
inkhud->begin();
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
|
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component
|
||||||
|
|
||||||
|
// #0: Main User Button
|
||||||
|
buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin());
|
||||||
|
buttons->setHandlerShortPress(0, [inkhud]() { inkhud->shortpress(); });
|
||||||
|
buttons->setHandlerLongPress(0, [inkhud]() { inkhud->longpress(); });
|
||||||
|
|
||||||
|
// Begin handling button events
|
||||||
|
buttons->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
; First prototype nrf52840/sx1262 device
|
; First prototype nrf52840/sx1262 device
|
||||||
[env:heltec-mesh-solar]
|
[heltec_mesh_solar_base]
|
||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = heltec_mesh_solar
|
board = heltec_mesh_solar
|
||||||
board_level = pr
|
board_level = pr
|
||||||
@@ -17,3 +17,100 @@ lib_deps =
|
|||||||
https://github.com/NMIoT/meshsolar/archive/dfc5330dad443982e6cdd37a61d33fc7252f468b.zip
|
https://github.com/NMIoT/meshsolar/archive/dfc5330dad443982e6cdd37a61d33fc7252f468b.zip
|
||||||
lewisxhe/PCF8563_Library@^1.0.1
|
lewisxhe/PCF8563_Library@^1.0.1
|
||||||
ArduinoJson@6.21.4
|
ArduinoJson@6.21.4
|
||||||
|
[env:heltec-mesh-solar]
|
||||||
|
extends = heltec_mesh_solar_base
|
||||||
|
build_flags = ${heltec_mesh_solar_base.build_flags}
|
||||||
|
-DSPI_INTERFACES_COUNT=1
|
||||||
|
|
||||||
|
[env:heltec-mesh-solar-eink]
|
||||||
|
extends = heltec_mesh_solar_base
|
||||||
|
build_flags = ${heltec_mesh_solar_base.build_flags}
|
||||||
|
-DHELTEC_MESH_SOLAR_EINK
|
||||||
|
-DSPI_INTERFACES_COUNT=2
|
||||||
|
-DUSE_EINK
|
||||||
|
-DPIN_SCREEN_VDD_CTL=3
|
||||||
|
-DPIN_EINK_CS=41
|
||||||
|
-DPIN_EINK_BUSY=11
|
||||||
|
-DPIN_EINK_DC=13
|
||||||
|
-DPIN_EINK_RES=40
|
||||||
|
-DPIN_EINK_SCLK=12
|
||||||
|
-DPIN_EINK_MOSI=2
|
||||||
|
-DPIN_SPI1_MISO=-1
|
||||||
|
-DPIN_SPI1_MOSI=PIN_EINK_MOSI
|
||||||
|
-DPIN_SPI1_SCK=PIN_EINK_SCLK
|
||||||
|
-DEINK_DISPLAY_MODEL=GxEPD2_213_E0213A367
|
||||||
|
-DEINK_WIDTH=250
|
||||||
|
-DEINK_HEIGHT=122
|
||||||
|
-DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk
|
||||||
|
-DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted
|
||||||
|
-DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates
|
||||||
|
-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates
|
||||||
|
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
|
||||||
|
-DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
|
||||||
|
lib_deps =
|
||||||
|
${heltec_mesh_solar_base.lib_deps}
|
||||||
|
https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip
|
||||||
|
|
||||||
|
[env:heltec-mesh-solar-inkhud]
|
||||||
|
extends = heltec_mesh_solar_base, inkhud
|
||||||
|
build_src_filter = ${heltec_mesh_solar_base.build_src_filter} ${inkhud.build_src_filter}
|
||||||
|
build_flags = ${heltec_mesh_solar_base.build_flags}
|
||||||
|
${inkhud.build_flags}
|
||||||
|
-DHELTEC_MESH_SOLAR_INKHUD
|
||||||
|
-DSPI_INTERFACES_COUNT=2
|
||||||
|
-DPIN_SCREEN_VDD_CTL=3
|
||||||
|
-DPIN_EINK_CS=41
|
||||||
|
-DPIN_EINK_BUSY=11
|
||||||
|
-DPIN_EINK_DC=13
|
||||||
|
-DPIN_EINK_RES=40
|
||||||
|
-DPIN_EINK_SCLK=12
|
||||||
|
-DPIN_EINK_MOSI=2
|
||||||
|
-DPIN_SPI1_MISO=-1
|
||||||
|
-DPIN_SPI1_MOSI=PIN_EINK_MOSI
|
||||||
|
-DPIN_SPI1_SCK=PIN_EINK_SCLK
|
||||||
|
lib_deps =
|
||||||
|
${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX
|
||||||
|
${heltec_mesh_solar_base.lib_deps}
|
||||||
|
|
||||||
|
|
||||||
|
[env:heltec-mesh-solar-oled]
|
||||||
|
extends = heltec_mesh_solar_base
|
||||||
|
build_flags = ${heltec_mesh_solar_base.build_flags}
|
||||||
|
-DHELTEC_MESH_SOLAR_OLED
|
||||||
|
-DSPI_INTERFACES_COUNT=1
|
||||||
|
-DPIN_SCREEN_VDD_CTL=3
|
||||||
|
-DHAS_SCREEN=1
|
||||||
|
-DRESET_OLED=40
|
||||||
|
-DPIN_WIRE_SDA=2
|
||||||
|
-DPIN_WIRE_SCL=12
|
||||||
|
|
||||||
|
[env:heltec-mesh-solar-tft]
|
||||||
|
extends = heltec_mesh_solar_base
|
||||||
|
build_flags = ${heltec_mesh_solar_base.build_flags}
|
||||||
|
-DHELTEC_MESH_SOLAR_TFT
|
||||||
|
-DSPI_INTERFACES_COUNT=2
|
||||||
|
-DUSE_ST7789
|
||||||
|
-DST7789_NSS=41
|
||||||
|
-DST7789_RS=13
|
||||||
|
-DST7789_SDA=2
|
||||||
|
-DST7789_SCK=12
|
||||||
|
-DST7789_RESET=40
|
||||||
|
-DST7789_MISO=-1
|
||||||
|
-DST7789_BUSY=-1
|
||||||
|
-DVTFT_CTRL=3
|
||||||
|
-DVTFT_LEDA=11
|
||||||
|
-DTFT_BACKLIGHT_ON=HIGH
|
||||||
|
-DST7789_SPI_HOST=SPI2_HOST
|
||||||
|
-DSPI_FREQUENCY=10000000
|
||||||
|
-DSPI_READ_FREQUENCY=10000000
|
||||||
|
-DTFT_HEIGHT=170
|
||||||
|
-DTFT_WIDTH=320
|
||||||
|
-DTFT_OFFSET_X=0
|
||||||
|
-DTFT_OFFSET_Y=0
|
||||||
|
-DBRIGHTNESS_DEFAULT=100
|
||||||
|
-DPIN_SPI1_MISO=ST7789_MISO
|
||||||
|
-DPIN_SPI1_MOSI=ST7789_SDA
|
||||||
|
-DPIN_SPI1_SCK=ST7789_SCK
|
||||||
|
lib_deps =
|
||||||
|
${heltec_mesh_solar_base.lib_deps}
|
||||||
|
https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip
|
||||||
|
|||||||
@@ -32,5 +32,9 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
|
|
||||||
void initVariant()
|
void initVariant()
|
||||||
{
|
{
|
||||||
pinMode(BQ4050_EMERGENCY_SHUTDOWN_PIN, INPUT);
|
pinMode(BQ4050_EMERGENCY_SHUTDOWN_PIN, INPUT);
|
||||||
|
#if defined(PIN_SCREEN_VDD_CTL)
|
||||||
|
pinMode(PIN_SCREEN_VDD_CTL, OUTPUT);
|
||||||
|
digitalWrite(PIN_SCREEN_VDD_CTL, LOW); // Start with power on
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,16 +39,15 @@ extern "C" {
|
|||||||
#define NUM_ANALOG_INPUTS (1)
|
#define NUM_ANALOG_INPUTS (1)
|
||||||
#define NUM_ANALOG_OUTPUTS (0)
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
|
#define PIN_LED1 (0 + 4) // green (confirmed on 1.0 board)
|
||||||
#define PIN_LED1 (0 + 12) // green (confirmed on 1.0 board)
|
|
||||||
#define LED_BLUE PIN_LED1 // fake for bluefruit library
|
#define LED_BLUE PIN_LED1 // fake for bluefruit library
|
||||||
#define LED_GREEN PIN_LED1
|
#define LED_GREEN PIN_LED1
|
||||||
#define LED_BUILTIN LED_GREEN
|
#define LED_BUILTIN LED_GREEN
|
||||||
#define LED_STATE_ON 0 // State when LED is lit
|
#define LED_STATE_ON 0 // State when LED is lit
|
||||||
|
|
||||||
#define HAS_NEOPIXEL // Enable the use of neopixels
|
#define HAS_NEOPIXEL // Enable the use of neopixels
|
||||||
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
|
#define NEOPIXEL_COUNT 1 // How many neopixels are connected
|
||||||
#define NEOPIXEL_DATA (32+15) // gpio pin used to send data to the neopixels
|
#define NEOPIXEL_DATA (32 + 15) // gpio pin used to send data to the neopixels
|
||||||
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
|
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -63,7 +62,6 @@ No longer populated on PCB
|
|||||||
*/
|
*/
|
||||||
#define PIN_SERIAL2_RX (0 + 9)
|
#define PIN_SERIAL2_RX (0 + 9)
|
||||||
#define PIN_SERIAL2_TX (0 + 10)
|
#define PIN_SERIAL2_TX (0 + 10)
|
||||||
// #define PIN_SERIAL2_EN (0 + 17)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* I2C
|
* I2C
|
||||||
@@ -71,16 +69,16 @@ No longer populated on PCB
|
|||||||
|
|
||||||
#define WIRE_INTERFACES_COUNT 2
|
#define WIRE_INTERFACES_COUNT 2
|
||||||
|
|
||||||
|
#ifndef HELTEC_MESH_SOLAR_OLED
|
||||||
// I2C bus 0
|
// I2C bus 0
|
||||||
// Routed to footprint for PCF8563TS RTC
|
#define PIN_WIRE_SDA (0 + 6)
|
||||||
// Not populated on T114 V1, maybe in future?
|
#define PIN_WIRE_SCL (0 + 26)
|
||||||
#define PIN_WIRE_SDA (0 + 6) // P0.26
|
#endif
|
||||||
#define PIN_WIRE_SCL (0 + 26) // P0.26
|
|
||||||
|
|
||||||
// I2C bus 1
|
// I2C bus 1
|
||||||
// Available on header pins, for general use
|
// Available on header pins, for general use
|
||||||
#define PIN_WIRE1_SDA (0 + 30) // P0.30
|
#define PIN_WIRE1_SDA (0 + 30)
|
||||||
#define PIN_WIRE1_SCL (0 + 5) // P0.13
|
#define PIN_WIRE1_SCL (0 + 5)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lora radio
|
* Lora radio
|
||||||
@@ -89,14 +87,14 @@ No longer populated on PCB
|
|||||||
#define USE_SX1262
|
#define USE_SX1262
|
||||||
// #define USE_SX1268
|
// #define USE_SX1268
|
||||||
#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead
|
#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead
|
||||||
#define LORA_CS (0 + 24)
|
#define LORA_CS (0 + 24)
|
||||||
#define SX126X_DIO1 (0 + 20)
|
#define SX126X_DIO1 (0 + 20)
|
||||||
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
||||||
// #define SX1262_DIO3 (0 + 21)
|
// #define SX1262_DIO3 (0 + 21)
|
||||||
// This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the
|
// This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the
|
||||||
// main
|
// main
|
||||||
// CPU?
|
// CPU?
|
||||||
#define SX126X_BUSY (0 + 17)
|
#define SX126X_BUSY (0 + 17)
|
||||||
#define SX126X_RESET (0 + 25)
|
#define SX126X_RESET (0 + 25)
|
||||||
// Not really an E22 but TTGO seems to be trying to clone that
|
// Not really an E22 but TTGO seems to be trying to clone that
|
||||||
#define SX126X_DIO2_AS_RF_SWITCH
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
@@ -129,21 +127,20 @@ No longer populated on PCB
|
|||||||
/*
|
/*
|
||||||
* SPI Interfaces
|
* SPI Interfaces
|
||||||
*/
|
*/
|
||||||
#define SPI_INTERFACES_COUNT 1
|
|
||||||
|
|
||||||
// For LORA, spi 0
|
// For LORA, spi 0
|
||||||
#define PIN_SPI_MISO (0 + 23)
|
#define PIN_SPI_MISO (0 + 23)
|
||||||
#define PIN_SPI_MOSI (0 + 22)
|
#define PIN_SPI_MOSI (0 + 22)
|
||||||
#define PIN_SPI_SCK (0 + 19)
|
#define PIN_SPI_SCK (0 + 19)
|
||||||
|
|
||||||
// #define PIN_PWR_EN (0 + 6)
|
// #define PIN_PWR_EN (0 + 6)
|
||||||
|
|
||||||
// To debug via the segger JLINK console rather than the CDC-ACM serial device
|
// To debug via the segger JLINK console rather than the CDC-ACM serial device
|
||||||
// #define USE_SEGGER
|
// #define USE_SEGGER
|
||||||
|
|
||||||
#define BQ4050_SDA_PIN (32+1) // I2C data line pin
|
#define BQ4050_SDA_PIN (32 + 1) // I2C data line pin
|
||||||
#define BQ4050_SCL_PIN (32+0) // I2C clock line pin
|
#define BQ4050_SCL_PIN (32 + 0) // I2C clock line pin
|
||||||
#define BQ4050_EMERGENCY_SHUTDOWN_PIN (32+3) // Emergency shutdown pin
|
#define BQ4050_EMERGENCY_SHUTDOWN_PIN (32 + 3) // Emergency shutdown pin
|
||||||
|
|
||||||
#define HAS_RTC 0
|
#define HAS_RTC 0
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 7
|
minor = 7
|
||||||
build = 10
|
build = 11
|
||||||
|
|||||||
Reference in New Issue
Block a user