Merge branch 'master' into tft-gui-work

This commit is contained in:
Manuel 2024-11-08 21:06:00 +01:00 committed by GitHub
commit 44ebb6ddff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 177 additions and 83 deletions

View File

@ -7,6 +7,8 @@ on:
required: true required: true
type: string type: string
permissions: read-all
jobs: jobs:
build-esp32: build-esp32:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -24,6 +26,7 @@ jobs:
./arch/esp32/esp32s2.ini ./arch/esp32/esp32s2.ini
./arch/esp32/esp32s3.ini ./arch/esp32/esp32s3.ini
./arch/esp32/esp32c3.ini ./arch/esp32/esp32c3.ini
./arch/esp32/esp32c6.ini
build-script-path: bin/build-esp32.sh build-script-path: bin/build-esp32.sh
ota-firmware-source: firmware.bin ota-firmware-source: firmware.bin
ota-firmware-target: release/bleota.bin ota-firmware-target: release/bleota.bin

View File

@ -26,10 +26,12 @@ jobs:
./arch/esp32/esp32s2.ini ./arch/esp32/esp32s2.ini
./arch/esp32/esp32s3.ini ./arch/esp32/esp32s3.ini
./arch/esp32/esp32c3.ini ./arch/esp32/esp32c3.ini
./arch/esp32/esp32c6.ini
build-script-path: bin/build-esp32.sh build-script-path: bin/build-esp32.sh
ota-firmware-source: firmware-c3.bin ota-firmware-source: firmware-c3.bin
ota-firmware-target: release/bleota-c3.bin ota-firmware-target: release/bleota-c3.bin
artifact-paths: | artifact-paths: |
release/*.bin release/*.bin
release/*.elf release/*.elf
include-web-ui: true
arch: esp32c3 arch: esp32c3

View File

@ -33,4 +33,5 @@ jobs:
artifact-paths: | artifact-paths: |
release/*.bin release/*.bin
release/*.elf release/*.elf
include-web-ui: true
arch: esp32c6 arch: esp32c6

View File

@ -7,6 +7,8 @@ on:
required: true required: true
type: string type: string
permissions: read-all
jobs: jobs:
build-esp32-s3: build-esp32-s3:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -24,6 +26,7 @@ jobs:
./arch/esp32/esp32s2.ini ./arch/esp32/esp32s2.ini
./arch/esp32/esp32s3.ini ./arch/esp32/esp32s3.ini
./arch/esp32/esp32c3.ini ./arch/esp32/esp32c3.ini
./arch/esp32/esp32c6.ini
build-script-path: bin/build-esp32.sh build-script-path: bin/build-esp32.sh
ota-firmware-source: firmware-s3.bin ota-firmware-source: firmware-s3.bin
ota-firmware-target: release/bleota-s3.bin ota-firmware-target: release/bleota-s3.bin

View File

@ -32,6 +32,7 @@ build_flags =
-Isrc/platform/portduino -Isrc/platform/portduino
-DRADIOLIB_EEPROM_UNSUPPORTED -DRADIOLIB_EEPROM_UNSUPPORTED
-DPORTDUINO_LINUX_HARDWARE -DPORTDUINO_LINUX_HARDWARE
-lstdc++fs
-lbluetooth -lbluetooth
-lgpiod -lgpiod
-lyaml-cpp -lyaml-cpp

View File

@ -2,6 +2,14 @@
set PYTHON=python set PYTHON=python
:: Determine the correct esptool command to use
where esptool >nul 2>&1
if %ERRORLEVEL% EQU 0 (
set "ESPTOOL_CMD=esptool"
) else (
set "ESPTOOL_CMD=%PYTHON% -m esptool"
)
goto GETOPTS goto GETOPTS
:HELP :HELP
echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME]
@ -24,32 +32,32 @@ IF NOT "__%1__"=="____" goto GETOPTS
IF "__%FILENAME%__" == "____" ( IF "__%FILENAME%__" == "____" (
echo "Missing FILENAME" echo "Missing FILENAME"
goto HELP goto HELP
) )
IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% ( IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% (
echo Trying to flash update %FILENAME%, but first erasing and writing system information" echo Trying to flash update %FILENAME%, but first erasing and writing system information"
%PYTHON% -m esptool --baud 115200 erase_flash %ESPTOOL_CMD% --baud 115200 erase_flash
%PYTHON% -m esptool --baud 115200 write_flash 0x00 %FILENAME% %ESPTOOL_CMD% --baud 115200 write_flash 0x00 %FILENAME%
@REM Account for S3 and C3 board's different OTA partition @REM Account for S3 and C3 board's different OTA partition
IF x%FILENAME:s3=%==x%FILENAME% IF x%FILENAME:v3=%==x%FILENAME% IF x%FILENAME:t-deck=%==x%FILENAME% IF x%FILENAME:wireless-paper=%==x%FILENAME% IF x%FILENAME:wireless-tracker=%==x%FILENAME% IF x%FILENAME:station-g2=%==x%FILENAME% IF x%FILENAME:unphone=%==x%FILENAME% ( IF x%FILENAME:s3=%==x%FILENAME% IF x%FILENAME:v3=%==x%FILENAME% IF x%FILENAME:t-deck=%==x%FILENAME% IF x%FILENAME:wireless-paper=%==x%FILENAME% IF x%FILENAME:wireless-tracker=%==x%FILENAME% IF x%FILENAME:station-g2=%==x%FILENAME% IF x%FILENAME:unphone=%==x%FILENAME% (
IF x%FILENAME:esp32c3=%==x%FILENAME% ( IF x%FILENAME:esp32c3=%==x%FILENAME% (
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota.bin %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota.bin
) else ( ) else (
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota-c3.bin %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-c3.bin
) )
) else ( ) else (
%PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota-s3.bin %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-s3.bin
) )
for %%f in (littlefs-*.bin) do ( for %%f in (littlefs-*.bin) do (
%PYTHON% -m esptool --baud 115200 write_flash 0x300000 %%f %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f
) )
) else ( ) else (
echo "Invalid file: %FILENAME%" echo "Invalid file: %FILENAME%"
goto HELP goto HELP
) else ( ) else (
echo "Invalid file: %FILENAME%" echo "Invalid file: %FILENAME%"
goto HELP goto HELP
) )
:EOF :EOF

View File

@ -2,6 +2,18 @@
PYTHON=${PYTHON:-$(which python3 python | head -n 1)} PYTHON=${PYTHON:-$(which python3 python | head -n 1)}
# Determine the correct esptool command to use
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
ESPTOOL_CMD="$PYTHON -m esptool"
elif command -v esptool >/dev/null 2>&1; then
ESPTOOL_CMD="esptool"
elif command -v esptool.py >/dev/null 2>&1; then
ESPTOOL_CMD="esptool.py"
else
echo "Error: esptool not found"
exit 1
fi
set -e set -e
# Usage info # Usage info
@ -49,19 +61,19 @@ shift "$((OPTIND - 1))"
if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
echo "Trying to flash ${FILENAME}, but first erasing and writing system information" echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
"$PYTHON" -m esptool erase_flash $ESPTOOL_CMD erase_flash
"$PYTHON" -m esptool write_flash 0x00 ${FILENAME} $ESPTOOL_CMD write_flash 0x00 ${FILENAME}
# Account for S3 board's different OTA partition # Account for S3 board's different OTA partition
if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then
if [ -n "${FILENAME##*"esp32c3"*}" ]; then if [ -n "${FILENAME##*"esp32c3"*}" ]; then
"$PYTHON" -m esptool write_flash 0x260000 bleota.bin $ESPTOOL_CMD write_flash 0x260000 bleota.bin
else else
"$PYTHON" -m esptool write_flash 0x260000 bleota-c3.bin $ESPTOOL_CMD write_flash 0x260000 bleota-c3.bin
fi fi
else else
"$PYTHON" -m esptool write_flash 0x260000 bleota-s3.bin $ESPTOOL_CMD write_flash 0x260000 bleota-s3.bin
fi fi
"$PYTHON" -m esptool write_flash 0x300000 littlefs-*.bin $ESPTOOL_CMD write_flash 0x300000 littlefs-*.bin
else else
show_help show_help

View File

@ -2,6 +2,14 @@
set PYTHON=python set PYTHON=python
:: Determine the correct esptool command to use
where esptool >nul 2>&1
if %ERRORLEVEL% EQU 0 (
set "ESPTOOL_CMD=esptool"
) else (
set "ESPTOOL_CMD=%PYTHON% -m esptool"
)
goto GETOPTS goto GETOPTS
:HELP :HELP
echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME]
@ -24,17 +32,17 @@ IF NOT "__%1__"=="____" goto GETOPTS
IF "__%FILENAME%__" == "____" ( IF "__%FILENAME%__" == "____" (
echo "Missing FILENAME" echo "Missing FILENAME"
goto HELP goto HELP
) )
IF EXIST %FILENAME% IF NOT x%FILENAME:update=%==x%FILENAME% ( IF EXIST %FILENAME% IF NOT x%FILENAME:update=%==x%FILENAME% (
echo Trying to flash update %FILENAME% echo Trying to flash update %FILENAME%
%PYTHON% -m esptool --baud 115200 write_flash 0x10000 %FILENAME% %ESPTOOL_CMD% --baud 115200 write_flash 0x10000 %FILENAME%
) else ( ) else (
echo "Invalid file: %FILENAME%" echo "Invalid file: %FILENAME%"
goto HELP goto HELP
) else ( ) else (
echo "Invalid file: %FILENAME%" echo "Invalid file: %FILENAME%"
goto HELP goto HELP
) )
:EOF :EOF

View File

@ -2,6 +2,18 @@
PYTHON=${PYTHON:-$(which python3 python|head -n 1)} PYTHON=${PYTHON:-$(which python3 python|head -n 1)}
# Determine the correct esptool command to use
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
ESPTOOL_CMD="$PYTHON -m esptool"
elif command -v esptool >/dev/null 2>&1; then
ESPTOOL_CMD="esptool"
elif command -v esptool.py >/dev/null 2>&1; then
ESPTOOL_CMD="esptool.py"
else
echo "Error: esptool not found"
exit 1
fi
# Usage info # Usage info
show_help() { show_help() {
cat << EOF cat << EOF
@ -9,7 +21,7 @@ Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME]
Flash image file to device, leave existing system intact." Flash image file to device, leave existing system intact."
-h Display this help and exit -h Display this help and exit
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous).
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON") -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
-f FILENAME The *update.bin file to flash. Custom to your device type. -f FILENAME The *update.bin file to flash. Custom to your device type.
@ -30,7 +42,7 @@ while getopts ":hp:P:f:" opt; do
f) FILENAME=${OPTARG} f) FILENAME=${OPTARG}
;; ;;
*) *)
echo "Invalid flag." echo "Invalid flag."
show_help >&2 show_help >&2
exit 1 exit 1
;; ;;
@ -45,7 +57,7 @@ shift "$((OPTIND-1))"
if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then
printf "Trying to flash update ${FILENAME}" printf "Trying to flash update ${FILENAME}"
$PYTHON -m esptool --baud 115200 write_flash 0x10000 ${FILENAME} $ESPTOOL_CMD --baud 115200 write_flash 0x10000 ${FILENAME}
else else
show_help show_help
echo "Invalid file: ${FILENAME}" echo "Invalid file: ${FILENAME}"

@ -1 +1 @@
Subproject commit 06cf134e2b3d035c3ca6cbbb90b4c017d4715398 Subproject commit 834915aa046532da0bd8478c250eb33847e9518f

View File

@ -329,7 +329,7 @@ void fsInit()
{ {
#ifdef FSCom #ifdef FSCom
if (!FSBegin()) { if (!FSBegin()) {
LOG_ERROR("Filesystem mount Failed."); LOG_ERROR("Filesystem mount failed");
// assert(0); This auto-formats the partition, so no need to fail here. // assert(0); This auto-formats the partition, so no need to fail here.
} }
#if defined(ARCH_ESP32) #if defined(ARCH_ESP32)

View File

@ -13,17 +13,17 @@ void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
{ {
if (reportType == TX_LOG) { if (reportType == TX_LOG) {
LOG_DEBUG("Packet transmitted : %ums", airtime_ms); LOG_DEBUG("Packet TX: %ums", airtime_ms);
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms; this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
air_period_tx[0] = air_period_tx[0] + airtime_ms; air_period_tx[0] = air_period_tx[0] + airtime_ms;
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms; this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
} else if (reportType == RX_LOG) { } else if (reportType == RX_LOG) {
LOG_DEBUG("Packet received : %ums", airtime_ms); LOG_DEBUG("Packet RX: %ums", airtime_ms);
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms; this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
air_period_rx[0] = air_period_rx[0] + airtime_ms; air_period_rx[0] = air_period_rx[0] + airtime_ms;
} else if (reportType == RX_ALL_LOG) { } else if (reportType == RX_ALL_LOG) {
LOG_DEBUG("Packet received (noise?) : %ums", airtime_ms); LOG_DEBUG("Packet RX (noise?) : %ums", airtime_ms);
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms; this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
} }
@ -126,7 +126,7 @@ bool AirTime::isTxAllowedChannelUtil(bool polite)
if (channelUtilizationPercent() < percentage) { if (channelUtilizationPercent() < percentage) {
return true; return true;
} else { } else {
LOG_WARN("Channel utilization is >%d percent. Skip opportunity to send.", percentage); LOG_WARN("Ch. util >%d%%. Skip send", percentage);
return false; return false;
} }
} }
@ -137,8 +137,7 @@ bool AirTime::isTxAllowedAirUtil()
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) { if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
return true; return true;
} else { } else {
LOG_WARN("Tx air utilization is >%f percent. Skip opportunity to send.", LOG_WARN("TX air util. >%f%%. Skip send", myRegion->dutyCycle * polite_duty_cycle_percent / 100);
myRegion->dutyCycle * polite_duty_cycle_percent / 100);
return false; return false;
} }
} }

View File

@ -153,8 +153,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ACCELEROMETER // ACCELEROMETER
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#define MPU6050_ADDR 0x68 #define MPU6050_ADDR 0x68
#define STK8BXX_ADR 0x18 #define STK8BXX_ADDR 0x18
#define LIS3DH_ADR 0x18 #define LIS3DH_ADDR 0x18
#define LIS3DH_ADDR_ALT 0x19
#define BMA423_ADDR 0x19 #define BMA423_ADDR 0x19
#define LSM6DS3_ADDR 0x6A #define LSM6DS3_ADDR 0x6A
#define BMX160_ADDR 0x69 #define BMX160_ADDR 0x69

View File

@ -409,7 +409,17 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
#else #else
SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found") SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found")
#endif #endif
SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found"); case BMA423_ADDR: // this can also be LIS3DH_ADDR_ALT
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 2);
if (registerValue == 0x3300 || registerValue == 0x3333) { // RAK4631 WisBlock has LIS3DH register at 0x3333
type = LIS3DH;
LOG_INFO("LIS3DH accelerometer found");
} else {
type = BMA423;
LOG_INFO("BMA423 accelerometer found");
}
break;
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address); SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address);
SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found"); SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found");
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found"); SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found");

View File

@ -794,7 +794,7 @@ void GPS::writePinEN(bool on)
// Write and log // Write and log
enablePin->set(on); enablePin->set(on);
#ifdef GPS_DEBUG #ifdef GPS_DEBUG
LOG_DEBUG("Pin EN %s", val == HIGH ? "HI" : "LOW"); LOG_DEBUG("Pin EN %s", on == HIGH ? "HI" : "LOW");
#endif #endif
} }

View File

@ -170,7 +170,7 @@ bool EInkDynamicDisplay::determineMode()
checkFastRequested(); checkFastRequested();
if (refresh == UNSPECIFIED) if (refresh == UNSPECIFIED)
LOG_WARN("There was a flaw in the determineMode() logic."); LOG_WARN("There was a flaw in the determineMode() logic");
// -- Decision has been reached -- // -- Decision has been reached --
applyRefreshMode(); applyRefreshMode();

View File

@ -1789,7 +1789,7 @@ int32_t Screen::runOnce()
// serialSinceMsec adjusts for additional serial wait time during nRF52 bootup // serialSinceMsec adjusts for additional serial wait time during nRF52 bootup
static bool showingBootScreen = true; static bool showingBootScreen = true;
if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) { if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) {
LOG_INFO("Done with boot screen..."); LOG_INFO("Done with boot screen");
stopBootScreen(); stopBootScreen();
showingBootScreen = false; showingBootScreen = false;
} }

View File

@ -116,7 +116,7 @@ void MPR121Keyboard::begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr)
void MPR121Keyboard::reset() void MPR121Keyboard::reset()
{ {
LOG_DEBUG("MPR121 Reset..."); LOG_DEBUG("MPR121 Reset");
// Trigger a MPR121 Soft Reset // Trigger a MPR121 Soft Reset
if (m_wire) { if (m_wire) {
m_wire->beginTransmission(m_addr); m_wire->beginTransmission(m_addr);

View File

@ -451,7 +451,7 @@ void setup()
// accessories // accessories
auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire()); auto i2cScanner = std::unique_ptr<ScanI2CTwoWire>(new ScanI2CTwoWire());
#if HAS_WIRE #if HAS_WIRE
LOG_INFO("Scan for i2c devices..."); LOG_INFO("Scan for i2c devices");
#endif #endif
#if defined(I2C_SDA1) && defined(ARCH_RP2040) #if defined(I2C_SDA1) && defined(ARCH_RP2040)
@ -476,7 +476,7 @@ void setup()
i2cScanner->scanPort(ScanI2C::I2CPort::WIRE); i2cScanner->scanPort(ScanI2C::I2CPort::WIRE);
#elif defined(ARCH_PORTDUINO) #elif defined(ARCH_PORTDUINO)
if (settingsStrings[i2cdev] != "") { if (settingsStrings[i2cdev] != "") {
LOG_INFO("Scan for i2c devices..."); LOG_INFO("Scan for i2c devices");
i2cScanner->scanPort(ScanI2C::I2CPort::WIRE); i2cScanner->scanPort(ScanI2C::I2CPort::WIRE);
} }
#elif HAS_WIRE #elif HAS_WIRE

View File

@ -1,5 +1,6 @@
#include "Default.h" #include "Default.h"
#include "../userPrefs.h" #include "../userPrefs.h"
#include "meshUtils.h"
uint32_t Default::getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t defaultInterval) uint32_t Default::getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t defaultInterval)
{ {
@ -40,6 +41,10 @@ uint32_t Default::getConfiguredOrDefaultMsScaled(uint32_t configured, uint32_t d
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER)
return getConfiguredOrDefaultMs(configured, defaultValue); return getConfiguredOrDefaultMs(configured, defaultValue);
// Additionally if we're a tracker or sensor, we want priority to send position and telemetry
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_SENSOR, meshtastic_Config_DeviceConfig_Role_TRACKER))
return getConfiguredOrDefaultMs(configured, defaultValue);
return getConfiguredOrDefaultMs(configured, defaultValue) * congestionScalingCoefficient(numOnlineNodes); return getConfiguredOrDefaultMs(configured, defaultValue) * congestionScalingCoefficient(numOnlineNodes);
} }

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <NodeDB.h> #include <NodeDB.h>
#include <cstdint> #include <cstdint>
#include <meshUtils.h>
#define ONE_DAY 24 * 60 * 60 #define ONE_DAY 24 * 60 * 60
#define ONE_MINUTE_MS 60 * 1000 #define ONE_MINUTE_MS 60 * 1000
#define THIRTY_SECONDS_MS 30 * 1000 #define THIRTY_SECONDS_MS 30 * 1000
@ -41,12 +42,30 @@ class Default
private: private:
static float congestionScalingCoefficient(int numOnlineNodes) static float congestionScalingCoefficient(int numOnlineNodes)
{ {
if (numOnlineNodes <= 40) { // Increase frequency of broadcasts for small networks regardless of preset
return 1.0; // No scaling for 40 or fewer nodes if (numOnlineNodes <= 10) {
return 0.6;
} else if (numOnlineNodes <= 20) {
return 0.7;
} else if (numOnlineNodes <= 30) {
return 0.8;
} else if (numOnlineNodes <= 40) {
return 1.0;
} else { } else {
// Sscaling based on number of nodes over 40 float throttlingFactor = 0.075;
if (config.lora.use_preset && config.lora.modem_preset == meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW)
throttlingFactor = 0.04;
else if (config.lora.use_preset && config.lora.modem_preset == meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST)
throttlingFactor = 0.02;
else if (config.lora.use_preset && config.lora.modem_preset == meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW)
throttlingFactor = 0.01;
else if (config.lora.use_preset &&
IS_ONE_OF(config.lora.modem_preset, meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST,
meshtastic_Config_LoRaConfig_ModemPreset_SHORT_TURBO))
return 1.0; // Don't bother throttling for highest bandwidth presets
// Scaling up traffic based on number of nodes over 40
int nodesOverForty = (numOnlineNodes - 40); int nodesOverForty = (numOnlineNodes - 40);
return 1.0 + (nodesOverForty * 0.075); // Each number of online node scales by 0.075 return 1.0 + (nodesOverForty * throttlingFactor); // Each number of online node scales by 0.075 (default)
} }
} }
}; };

View File

@ -655,7 +655,7 @@ void NodeDB::removeNodeByNum(NodeNum nodeNum)
numMeshNodes -= removed; numMeshNodes -= removed;
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1, std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1,
meshtastic_NodeInfoLite()); meshtastic_NodeInfoLite());
LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Save changes...", removed); LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Save changes", removed);
saveDeviceStateToDisk(); saveDeviceStateToDisk();
} }
@ -991,7 +991,7 @@ bool NodeDB::saveToDisk(int saveWhat)
bool success = saveToDiskNoRetry(saveWhat); bool success = saveToDiskNoRetry(saveWhat);
if (!success) { if (!success) {
LOG_ERROR("Failed to save to disk, retrying..."); LOG_ERROR("Failed to save to disk, retrying");
#ifdef ARCH_NRF52 // @geeksville is not ready yet to say we should do this on other platforms. See bug #4184 discussion #ifdef ARCH_NRF52 // @geeksville is not ready yet to say we should do this on other platforms. See bug #4184 discussion
FSCom.format(); FSCom.format();
@ -1167,7 +1167,7 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde
// We just changed something about the user, store our DB // We just changed something about the user, store our DB
Throttle::execute( Throttle::execute(
&lastNodeDbSave, ONE_MINUTE_MS, []() { nodeDB->saveToDisk(SEGMENT_DEVICESTATE); }, &lastNodeDbSave, ONE_MINUTE_MS, []() { nodeDB->saveToDisk(SEGMENT_DEVICESTATE); },
[]() { LOG_DEBUG("Deferring NodeDB saveToDisk for now"); }); // since we saved less than a minute ago []() { LOG_DEBUG("Defer NodeDB saveToDisk for now"); }); // since we saved less than a minute ago
} }
return changed; return changed;
@ -1297,7 +1297,7 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
// Currently portuino is mostly used for simulation. Make sure the user notices something really bad happened // Currently portuino is mostly used for simulation. Make sure the user notices something really bad happened
#ifdef ARCH_PORTDUINO #ifdef ARCH_PORTDUINO
LOG_ERROR("A critical failure occurred, portduino is exiting..."); LOG_ERROR("A critical failure occurred, portduino is exiting");
exit(2); exit(2);
#endif #endif
} }

View File

@ -230,7 +230,7 @@ bool RF95Interface::reconfigure()
err = lora->setPreambleLength(preambleLength); err = lora->setPreambleLength(preambleLength);
if (err != RADIOLIB_ERR_NONE) if (err != RADIOLIB_ERR_NONE)
LOG_ERROR(" RF95 setPreambleLength %s%d", radioLibErr, err); LOG_ERROR("RF95 setPreambleLength %s%d", radioLibErr, err);
assert(err == RADIOLIB_ERR_NONE); assert(err == RADIOLIB_ERR_NONE);
err = lora->setFrequency(getFreq()); err = lora->setFrequency(getFreq());

View File

@ -489,7 +489,8 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to);
// We may want to retool things so we can send a PKC packet when the client specifies a key and nodenum, even if the node // We may want to retool things so we can send a PKC packet when the client specifies a key and nodenum, even if the node
// is not in the local nodedb // is not in the local nodedb
if ( // First, only PKC encrypt packets we are originating
if (isFromUs(p) &&
// Don't use PKC with Ham mode // Don't use PKC with Ham mode
!owner.is_licensed && !owner.is_licensed &&
// Don't use PKC if it's not explicitly requested and a non-primary channel is requested // Don't use PKC if it's not explicitly requested and a non-primary channel is requested
@ -671,4 +672,4 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
// cache/learn of the existence of nodes (i.e. FloodRouter) that they should not // cache/learn of the existence of nodes (i.e. FloodRouter) that they should not
handleReceived(p); handleReceived(p);
packetPool.release(p); packetPool.release(p);
} }

View File

@ -71,7 +71,7 @@ template <typename T> bool SX128xInterface<T>::init()
LOG_INFO("SX128x init result %d", res); LOG_INFO("SX128x init result %d", res);
if ((config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) { if ((config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) {
LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting."); LOG_WARN("Radio only supports 2.4GHz LoRa. Adjusting Region and rebooting");
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_LORA_24; config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_LORA_24;
nodeDB->saveToDisk(SEGMENT_CONFIG); nodeDB->saveToDisk(SEGMENT_CONFIG);
delay(2000); delay(2000);
@ -80,7 +80,7 @@ template <typename T> bool SX128xInterface<T>::init()
#elif defined(ARCH_NRF52) #elif defined(ARCH_NRF52)
NVIC_SystemReset(); NVIC_SystemReset();
#else #else
LOG_ERROR("FIXME implement reboot for this platform. Skip for now."); LOG_ERROR("FIXME implement reboot for this platform. Skip for now");
#endif #endif
} }

View File

@ -3,6 +3,7 @@
#include "PhoneAPI.h" #include "PhoneAPI.h"
#include "Stream.h" #include "Stream.h"
#include "concurrency/OSThread.h" #include "concurrency/OSThread.h"
#include <cstdarg>
// A To/FromRadio packet + our 32 bit header // A To/FromRadio packet + our 32 bit header
#define MAX_STREAM_BUF_SIZE (MAX_TO_FROM_RADIO_SIZE + sizeof(uint32_t)) #define MAX_STREAM_BUF_SIZE (MAX_TO_FROM_RADIO_SIZE + sizeof(uint32_t))

View File

@ -141,13 +141,13 @@ bool initEthernet()
if (status == 0) { if (status == 0) {
if (Ethernet.hardwareStatus() == EthernetNoHardware) { if (Ethernet.hardwareStatus() == EthernetNoHardware) {
LOG_ERROR("Ethernet shield was not found."); LOG_ERROR("Ethernet shield was not found");
return false; return false;
} else if (Ethernet.linkStatus() == LinkOFF) { } else if (Ethernet.linkStatus() == LinkOFF) {
LOG_ERROR("Ethernet cable is not connected."); LOG_ERROR("Ethernet cable is not connected");
return false; return false;
} else { } else {
LOG_ERROR("Unknown Ethernet error."); LOG_ERROR("Unknown Ethernet error");
return false; return false;
} }
} else { } else {

View File

@ -81,7 +81,7 @@ typedef struct _meshtastic_NodeInfoLite {
uint8_t channel; uint8_t channel;
/* True if we witnessed the node over MQTT instead of LoRA transport */ /* True if we witnessed the node over MQTT instead of LoRA transport */
bool via_mqtt; bool via_mqtt;
/* Number of hops away from us this node is (0 if adjacent) */ /* Number of hops away from us this node is (0 if direct neighbor) */
bool has_hops_away; bool has_hops_away;
uint8_t hops_away; uint8_t hops_away;
/* True if node is in our favorites list /* True if node is in our favorites list

View File

@ -188,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
#define meshtastic_LocalConfig_size 735 #define meshtastic_LocalConfig_size 735
#define meshtastic_LocalModuleConfig_size 697 #define meshtastic_LocalModuleConfig_size 699
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -720,7 +720,7 @@ typedef struct _meshtastic_MeshPacket {
Set during reception to indicate the SNR of this packet. Set during reception to indicate the SNR of this packet.
Used to collect statistics on current link quality. */ Used to collect statistics on current link quality. */
float rx_snr; float rx_snr;
/* If unset treated as zero (no forwarding, send to adjacent nodes only) /* If unset treated as zero (no forwarding, send to direct neighbor nodes only)
if 1, allow hopping through one node, etc... if 1, allow hopping through one node, etc...
For our usecase real world topologies probably have a max of about 3. For our usecase real world topologies probably have a max of about 3.
This field is normally placed into a few of bits in the header. */ This field is normally placed into a few of bits in the header. */
@ -791,7 +791,7 @@ typedef struct _meshtastic_NodeInfo {
uint8_t channel; uint8_t channel;
/* True if we witnessed the node over MQTT instead of LoRA transport */ /* True if we witnessed the node over MQTT instead of LoRA transport */
bool via_mqtt; bool via_mqtt;
/* Number of hops away from us this node is (0 if adjacent) */ /* Number of hops away from us this node is (0 if direct neighbor) */
bool has_hops_away; bool has_hops_away;
uint8_t hops_away; uint8_t hops_away;
/* True if node is in our favorites list /* True if node is in our favorites list

View File

@ -153,8 +153,11 @@ typedef struct _meshtastic_ModuleConfig_NeighborInfoConfig {
/* Whether the Module is enabled */ /* Whether the Module is enabled */
bool enabled; bool enabled;
/* Interval in seconds of how often we should try to send our /* Interval in seconds of how often we should try to send our
Neighbor Info to the mesh */ Neighbor Info (minimum is 14400, i.e., 4 hours) */
uint32_t update_interval; uint32_t update_interval;
/* Whether in addition to sending it to MQTT and the PhoneAPI, our NeighborInfo should be transmitted over LoRa.
Note that this is not available on a channel with default key and name. */
bool transmit_over_lora;
} meshtastic_ModuleConfig_NeighborInfoConfig; } meshtastic_ModuleConfig_NeighborInfoConfig;
/* Detection Sensor Module Config */ /* Detection Sensor Module Config */
@ -501,7 +504,7 @@ extern "C" {
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_default} #define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_default}
#define meshtastic_ModuleConfig_MapReportSettings_init_default {0, 0} #define meshtastic_ModuleConfig_MapReportSettings_init_default {0, 0}
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}}
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0} #define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0, 0}
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_default {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0} #define meshtastic_ModuleConfig_DetectionSensorConfig_init_default {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0}
#define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} #define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
#define meshtastic_ModuleConfig_PaxcounterConfig_init_default {0, 0, 0, 0} #define meshtastic_ModuleConfig_PaxcounterConfig_init_default {0, 0, 0, 0}
@ -517,7 +520,7 @@ extern "C" {
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero} #define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero}
#define meshtastic_ModuleConfig_MapReportSettings_init_zero {0, 0} #define meshtastic_ModuleConfig_MapReportSettings_init_zero {0, 0}
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}}
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0} #define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0, 0}
#define meshtastic_ModuleConfig_DetectionSensorConfig_init_zero {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0} #define meshtastic_ModuleConfig_DetectionSensorConfig_init_zero {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0}
#define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} #define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
#define meshtastic_ModuleConfig_PaxcounterConfig_init_zero {0, 0, 0, 0} #define meshtastic_ModuleConfig_PaxcounterConfig_init_zero {0, 0, 0, 0}
@ -546,6 +549,7 @@ extern "C" {
#define meshtastic_ModuleConfig_MQTTConfig_map_report_settings_tag 11 #define meshtastic_ModuleConfig_MQTTConfig_map_report_settings_tag 11
#define meshtastic_ModuleConfig_NeighborInfoConfig_enabled_tag 1 #define meshtastic_ModuleConfig_NeighborInfoConfig_enabled_tag 1
#define meshtastic_ModuleConfig_NeighborInfoConfig_update_interval_tag 2 #define meshtastic_ModuleConfig_NeighborInfoConfig_update_interval_tag 2
#define meshtastic_ModuleConfig_NeighborInfoConfig_transmit_over_lora_tag 3
#define meshtastic_ModuleConfig_DetectionSensorConfig_enabled_tag 1 #define meshtastic_ModuleConfig_DetectionSensorConfig_enabled_tag 1
#define meshtastic_ModuleConfig_DetectionSensorConfig_minimum_broadcast_secs_tag 2 #define meshtastic_ModuleConfig_DetectionSensorConfig_minimum_broadcast_secs_tag 2
#define meshtastic_ModuleConfig_DetectionSensorConfig_state_broadcast_secs_tag 3 #define meshtastic_ModuleConfig_DetectionSensorConfig_state_broadcast_secs_tag 3
@ -709,7 +713,8 @@ X(a, STATIC, REPEATED, MESSAGE, available_pins, 3)
#define meshtastic_ModuleConfig_NeighborInfoConfig_FIELDLIST(X, a) \ #define meshtastic_ModuleConfig_NeighborInfoConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
X(a, STATIC, SINGULAR, UINT32, update_interval, 2) X(a, STATIC, SINGULAR, UINT32, update_interval, 2) \
X(a, STATIC, SINGULAR, BOOL, transmit_over_lora, 3)
#define meshtastic_ModuleConfig_NeighborInfoConfig_CALLBACK NULL #define meshtastic_ModuleConfig_NeighborInfoConfig_CALLBACK NULL
#define meshtastic_ModuleConfig_NeighborInfoConfig_DEFAULT NULL #define meshtastic_ModuleConfig_NeighborInfoConfig_DEFAULT NULL
@ -884,7 +889,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42 #define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42
#define meshtastic_ModuleConfig_MQTTConfig_size 254 #define meshtastic_ModuleConfig_MQTTConfig_size 254
#define meshtastic_ModuleConfig_MapReportSettings_size 12 #define meshtastic_ModuleConfig_MapReportSettings_size 12
#define meshtastic_ModuleConfig_NeighborInfoConfig_size 8 #define meshtastic_ModuleConfig_NeighborInfoConfig_size 10
#define meshtastic_ModuleConfig_PaxcounterConfig_size 30 #define meshtastic_ModuleConfig_PaxcounterConfig_size 30
#define meshtastic_ModuleConfig_RangeTestConfig_size 10 #define meshtastic_ModuleConfig_RangeTestConfig_size 10
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96 #define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96

View File

@ -441,8 +441,8 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
return; return;
} else { } else {
LOG_ERROR("This should not have happened..."); LOG_ERROR("This should not have happened");
res->println("ERROR: This should not have happened..."); res->println("ERROR: This should not have happened");
} }
} }

View File

@ -95,7 +95,7 @@ static void taskCreateCert(void *parameter)
LOG_DEBUG("Retrieved Certificate: %d Bytes", cert->getCertLength()); LOG_DEBUG("Retrieved Certificate: %d Bytes", cert->getCertLength());
} else { } else {
LOG_INFO("Creating the certificate. This may take a while. Please wait..."); LOG_INFO("Creating the certificate. This may take a while. Please wait");
yield(); yield();
cert = new SSLCert(); cert = new SSLCert();
yield(); yield();
@ -189,7 +189,7 @@ int32_t WebServerThread::runOnce()
void initWebServer() void initWebServer()
{ {
LOG_DEBUG("Init Web Server..."); LOG_DEBUG("Init Web Server");
// We can now use the new certificate to setup our server as usual. // We can now use the new certificate to setup our server as usual.
secureServer = new HTTPSServer(cert); secureServer = new HTTPSServer(cert);
@ -198,10 +198,10 @@ void initWebServer()
registerHandlers(insecureServer, secureServer); registerHandlers(insecureServer, secureServer);
if (secureServer) { if (secureServer) {
LOG_INFO("Start Secure Web Server..."); LOG_INFO("Start Secure Web Server");
secureServer->start(); secureServer->start();
} }
LOG_INFO("Start Insecure Web Server..."); LOG_INFO("Start Insecure Web Server");
insecureServer->start(); insecureServer->start();
if (insecureServer->isRunning()) { if (insecureServer->isRunning()) {
LOG_INFO("Web Servers Ready! :-) "); LOG_INFO("Web Servers Ready! :-) ");

View File

@ -381,7 +381,7 @@ void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp,
// Skip if it's disabled or no pins are exposed // Skip if it's disabled or no pins are exposed
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled || if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) { r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) {
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skip..."); LOG_DEBUG("Remote hardware module disabled or no available_pins. Skip");
return; return;
} }
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) { for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {

View File

@ -76,7 +76,7 @@ int32_t DetectionSensorModule::runOnce()
if (moduleConfig.detection_sensor.monitor_pin > 0) { if (moduleConfig.detection_sensor.monitor_pin > 0) {
pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT); pinMode(moduleConfig.detection_sensor.monitor_pin, moduleConfig.detection_sensor.use_pullup ? INPUT_PULLUP : INPUT);
} else { } else {
LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disable module..."); LOG_WARN("Detection Sensor Module: Set to enabled but no monitor pin is set. Disable module");
return disable(); return disable();
} }
LOG_INFO("Detection Sensor Module: init"); LOG_INFO("Detection Sensor Module: init");

View File

@ -70,11 +70,11 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
} }
// If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway. // If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway.
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) { if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) {
LOG_DEBUG("Skip send NodeInfo since we sent it <5 mins ago."); LOG_DEBUG("Skip send NodeInfo since we sent it <5min ago");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) { } else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
LOG_DEBUG("Skip send requested NodeInfo since we sent it <60s ago."); LOG_DEBUG("Skip send NodeInfo since we sent it <60s ago");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else { } else {

View File

@ -16,10 +16,7 @@
#include "meshtastic/atak.pb.h" #include "meshtastic/atak.pb.h"
#include "sleep.h" #include "sleep.h"
#include "target_specific.h" #include "target_specific.h"
extern "C" {
#include <Throttle.h> #include <Throttle.h>
}
PositionModule *positionModule; PositionModule *positionModule;
@ -249,8 +246,11 @@ meshtastic_MeshPacket *PositionModule::allocReply()
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices // nodes shouldn't trust it anyways) Note: we allow a device with a local GPS or NTP to include the time, so that devices
// without can get time. // without can get time.
if (getRTCQuality() < RTCQualityNTP) { if (getRTCQuality() < RTCQualityNTP) {
LOG_INFO("Strip time %u from position send", p.time); LOG_INFO("Strip time %u from position", p.time);
p.time = 0; p.time = 0;
} else if (rtc_found.address != ScanI2C::ADDRESS_NONE.address) {
LOG_INFO("Use RTC time %u for position", p.time);
p.time = getValidTime(RTCQualityDevice);
} else { } else {
p.time = getValidTime(RTCQualityNTP); p.time = getValidTime(RTCQualityNTP);
LOG_INFO("Provide time to mesh %u", p.time); LOG_INFO("Provide time to mesh %u", p.time);

View File

@ -376,12 +376,14 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m
LOG_INFO("AHTX0+BMP280 module detected: using temp from BMP280 and humy from AHTX0"); LOG_INFO("AHTX0+BMP280 module detected: using temp from BMP280 and humy from AHTX0");
aht10Sensor.getMetrics(&m_ahtx); aht10Sensor.getMetrics(&m_ahtx);
m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity; m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity;
m->variant.environment_metrics.has_relative_humidity = m_ahtx.variant.environment_metrics.has_relative_humidity;
} else { } else {
// prefer bmp3xx temp if both sensors are present, fetch only humidity // prefer bmp3xx temp if both sensors are present, fetch only humidity
meshtastic_Telemetry m_ahtx = meshtastic_Telemetry_init_zero; meshtastic_Telemetry m_ahtx = meshtastic_Telemetry_init_zero;
LOG_INFO("AHTX0+BMP3XX module detected: using temp from BMP3XX and humy from AHTX0"); LOG_INFO("AHTX0+BMP3XX module detected: using temp from BMP3XX and humy from AHTX0");
aht10Sensor.getMetrics(&m_ahtx); aht10Sensor.getMetrics(&m_ahtx);
m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity; m->variant.environment_metrics.relative_humidity = m_ahtx.variant.environment_metrics.relative_humidity;
m->variant.environment_metrics.has_relative_humidity = m_ahtx.variant.environment_metrics.has_relative_humidity;
} }
} }
if (max17048Sensor.hasSensor()) { if (max17048Sensor.hasSensor()) {

View File

@ -31,7 +31,7 @@ class TelemetrySensor
int32_t initI2CSensor() int32_t initI2CSensor()
{ {
if (!status) { if (!status) {
LOG_WARN("Could not connect to detected %s sensor. Remove from nodeTelemetrySensorsMap.", sensorName); LOG_WARN("Can't connect to detected %s sensor. Remove from nodeTelemetrySensorsMap", sensorName);
nodeTelemetrySensorsMap[sensorType].first = 0; nodeTelemetrySensorsMap[sensorType].first = 0;
} else { } else {
LOG_INFO("Opened %s sensor on i2c bus", sensorName); LOG_INFO("Opened %s sensor on i2c bus", sensorName);

View File

@ -32,7 +32,7 @@ void powerCommandsCheck()
reboot(); reboot();
#else #else
rebootAtMsec = -1; rebootAtMsec = -1;
LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied."); LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied");
#endif #endif
} }

View File

@ -2,7 +2,8 @@
extends = portduino_base extends = portduino_base
; The pkg-config commands below optionally add link flags. ; The pkg-config commands below optionally add link flags.
; the || : is just a "or run the null command" to avoid returning an error code ; the || : is just a "or run the null command" to avoid returning an error code
build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -I /usr/include build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino
-I /usr/include
!pkg-config --libs libulfius --silence-errors || : !pkg-config --libs libulfius --silence-errors || :
!pkg-config --libs openssl --silence-errors || : !pkg-config --libs openssl --silence-errors || :
board = cross_platform board = cross_platform

View File

@ -1,4 +1,4 @@
[VERSION] [VERSION]
major = 2 major = 2
minor = 5 minor = 5
build = 11 build = 12