mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-29 20:49:50 +00:00
Merge branch '2.6' into backup-restore
This commit is contained in:
commit
c986c4a742
6
.github/workflows/main_matrix.yml
vendored
6
.github/workflows/main_matrix.yml
vendored
@ -352,6 +352,12 @@ jobs:
|
|||||||
run: >-
|
run: >-
|
||||||
bin/bump_version.py
|
bin/bump_version.py
|
||||||
|
|
||||||
|
- name: Ensure debian deps are installed
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -y --fix-missing
|
||||||
|
sudo apt-get install -y devscripts
|
||||||
|
|
||||||
- name: Update debian changelog
|
- name: Update debian changelog
|
||||||
run: >-
|
run: >-
|
||||||
debian/ci_changelog.sh
|
debian/ci_changelog.sh
|
||||||
|
2
.github/workflows/stale_bot.yml
vendored
2
.github/workflows/stale_bot.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Stale PR+Issues
|
- name: Stale PR+Issues
|
||||||
uses: actions/stale@v9.0.0
|
uses: actions/stale@v9.1.0
|
||||||
with:
|
with:
|
||||||
exempt-issue-labels: pinned,3.0
|
exempt-issue-labels: pinned,3.0
|
||||||
exempt-pr-labels: pinned,3.0
|
exempt-pr-labels: pinned,3.0
|
||||||
|
@ -9,14 +9,14 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- prettier@3.5.1
|
- prettier@3.5.1
|
||||||
- trufflehog@3.88.10
|
- trufflehog@3.88.12
|
||||||
- yamllint@1.35.1
|
- yamllint@1.35.1
|
||||||
- bandit@1.8.3
|
- bandit@1.8.3
|
||||||
- checkov@3.2.372
|
- checkov@3.2.372
|
||||||
- terrascan@1.19.9
|
- terrascan@1.19.9
|
||||||
- trivy@0.59.1
|
- trivy@0.59.1
|
||||||
- taplo@0.9.3
|
- taplo@0.9.3
|
||||||
- ruff@0.9.6
|
- ruff@0.9.7
|
||||||
- isort@6.0.0
|
- isort@6.0.0
|
||||||
- markdownlint@0.44.0
|
- markdownlint@0.44.0
|
||||||
- oxipng@9.1.4
|
- oxipng@9.1.4
|
||||||
@ -28,7 +28,7 @@ lint:
|
|||||||
- shellcheck@0.10.0
|
- shellcheck@0.10.0
|
||||||
- black@25.1.0
|
- black@25.1.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.23.3
|
- gitleaks@8.24.0
|
||||||
- clang-format@16.0.3
|
- clang-format@16.0.3
|
||||||
ignore:
|
ignore:
|
||||||
- linters: [ALL]
|
- linters: [ALL]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
; Common settings for rp2040 Processor based targets
|
; Common settings for rp2040 Processor based targets
|
||||||
[rp2350_base]
|
[rp2350_base]
|
||||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#19e30129fb1428b823be585c787dcb4ac0d9014c ; For arduino-pico >=4.2.1
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#6024e9a7e82a72e38dd90f42029ba3748835eb2e ; 4.3.0 with fix MDNS
|
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3
|
||||||
|
|
||||||
board_build.core = earlephilhower
|
board_build.core = earlephilhower
|
||||||
board_build.filesystem_size = 0.5m
|
board_build.filesystem_size = 0.5m
|
||||||
@ -10,7 +10,6 @@ build_flags =
|
|||||||
${arduino_base.build_flags} -Wno-unused-variable -Wcast-align
|
${arduino_base.build_flags} -Wno-unused-variable -Wcast-align
|
||||||
-Isrc/platform/rp2xx0
|
-Isrc/platform/rp2xx0
|
||||||
-D__PLAT_RP2350__
|
-D__PLAT_RP2350__
|
||||||
# -D _POSIX_THREADS
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/> -<mesh/raspihttp> -<platform/rp2xx0/pico_sleep> -<platform/rp2xx0/hardware_rosc>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/> -<mesh/raspihttp> -<platform/rp2xx0/pico_sleep> -<platform/rp2xx0/hardware_rosc>
|
||||||
|
|
||||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -3,6 +3,7 @@ Section: misc
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Austin Lane <vidplace7@gmail.com>
|
Maintainer: Austin Lane <vidplace7@gmail.com>
|
||||||
Build-Depends: debhelper-compat (= 13),
|
Build-Depends: debhelper-compat (= 13),
|
||||||
|
lsb-release,
|
||||||
tar,
|
tar,
|
||||||
gzip,
|
gzip,
|
||||||
platformio,
|
platformio,
|
||||||
|
9
debian/rules
vendored
9
debian/rules
vendored
@ -11,6 +11,15 @@ PIO_ENV:=\
|
|||||||
PLATFORMIO_LIBDEPS_DIR=pio/libdeps \
|
PLATFORMIO_LIBDEPS_DIR=pio/libdeps \
|
||||||
PLATFORMIO_PACKAGES_DIR=pio/packages
|
PLATFORMIO_PACKAGES_DIR=pio/packages
|
||||||
|
|
||||||
|
# Raspbian armhf builds should be compatible with armv6-hardfloat
|
||||||
|
# https://www.valvers.com/open-software/raspberry-pi/bare-metal-programming-in-c-part-1/#rpi1-compiler-flags
|
||||||
|
ifneq (,$(findstring Raspbian,$(shell lsb_release -is)))
|
||||||
|
ifeq ($(DEB_BUILD_ARCH),armhf)
|
||||||
|
PIO_ENV+=\
|
||||||
|
PLATFORMIO_BUILD_FLAGS="-mfloat-abi=hard -mfpu=vfp -march=armv6zk"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
# Extract tarballs within source deb
|
# Extract tarballs within source deb
|
||||||
tar -xf pio.tar
|
tar -xf pio.tar
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f3a57add1ae4be78af0b74fa97f4bf03cc34890d
|
Subproject commit 47ff85bb9c2ab63fd0232f9a0eb6e27896944ef6
|
@ -244,6 +244,10 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
logFoundDevice("BMP-388", (uint8_t)addr.address);
|
logFoundDevice("BMP-388", (uint8_t)addr.address);
|
||||||
type = BMP_3XX;
|
type = BMP_3XX;
|
||||||
break;
|
break;
|
||||||
|
case 0x60: // BMP-390 should be 0x60
|
||||||
|
logFoundDevice("BMP-390", (uint8_t)addr.address);
|
||||||
|
type = BMP_3XX;
|
||||||
|
break;
|
||||||
case 0x58: // BMP-280 should be 0x58
|
case 0x58: // BMP-280 should be 0x58
|
||||||
default:
|
default:
|
||||||
logFoundDevice("BMP-280", (uint8_t)addr.address);
|
logFoundDevice("BMP-280", (uint8_t)addr.address);
|
||||||
@ -521,4 +525,4 @@ void ScanI2CTwoWire::logFoundDevice(const char *device, uint8_t address)
|
|||||||
{
|
{
|
||||||
LOG_INFO("%s found at address 0x%x", device, address);
|
LOG_INFO("%s found at address 0x%x", device, address);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -6,28 +6,28 @@
|
|||||||
|
|
||||||
void d_writeCommand(uint8_t c)
|
void d_writeCommand(uint8_t c)
|
||||||
{
|
{
|
||||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
if (PIN_EINK_DC >= 0)
|
if (PIN_EINK_DC >= 0)
|
||||||
digitalWrite(PIN_EINK_DC, LOW);
|
digitalWrite(PIN_EINK_DC, LOW);
|
||||||
if (PIN_EINK_CS >= 0)
|
if (PIN_EINK_CS >= 0)
|
||||||
digitalWrite(PIN_EINK_CS, LOW);
|
digitalWrite(PIN_EINK_CS, LOW);
|
||||||
SPI.transfer(c);
|
SPI1.transfer(c);
|
||||||
if (PIN_EINK_CS >= 0)
|
if (PIN_EINK_CS >= 0)
|
||||||
digitalWrite(PIN_EINK_CS, HIGH);
|
digitalWrite(PIN_EINK_CS, HIGH);
|
||||||
if (PIN_EINK_DC >= 0)
|
if (PIN_EINK_DC >= 0)
|
||||||
digitalWrite(PIN_EINK_DC, HIGH);
|
digitalWrite(PIN_EINK_DC, HIGH);
|
||||||
SPI.endTransaction();
|
SPI1.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void d_writeData(uint8_t d)
|
void d_writeData(uint8_t d)
|
||||||
{
|
{
|
||||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
if (PIN_EINK_CS >= 0)
|
if (PIN_EINK_CS >= 0)
|
||||||
digitalWrite(PIN_EINK_CS, LOW);
|
digitalWrite(PIN_EINK_CS, LOW);
|
||||||
SPI.transfer(d);
|
SPI1.transfer(d);
|
||||||
if (PIN_EINK_CS >= 0)
|
if (PIN_EINK_CS >= 0)
|
||||||
digitalWrite(PIN_EINK_CS, HIGH);
|
digitalWrite(PIN_EINK_CS, HIGH);
|
||||||
SPI.endTransaction();
|
SPI1.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long d_waitWhileBusy(uint16_t busy_time)
|
unsigned long d_waitWhileBusy(uint16_t busy_time)
|
||||||
@ -53,7 +53,7 @@ unsigned long d_waitWhileBusy(uint16_t busy_time)
|
|||||||
|
|
||||||
void scanEInkDevice(void)
|
void scanEInkDevice(void)
|
||||||
{
|
{
|
||||||
SPI.begin();
|
SPI1.begin();
|
||||||
d_writeCommand(0x22);
|
d_writeCommand(0x22);
|
||||||
d_writeData(0x83);
|
d_writeData(0x83);
|
||||||
d_writeCommand(0x20);
|
d_writeCommand(0x20);
|
||||||
@ -62,6 +62,6 @@ void scanEInkDevice(void)
|
|||||||
LOG_DEBUG("EInk display found");
|
LOG_DEBUG("EInk display found");
|
||||||
else
|
else
|
||||||
LOG_DEBUG("EInk display not found");
|
LOG_DEBUG("EInk display not found");
|
||||||
SPI.end();
|
SPI1.end();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
100
src/gps/GPS.cpp
100
src/gps/GPS.cpp
@ -48,8 +48,6 @@ HardwareSerial *GPS::_serial_gps = nullptr;
|
|||||||
|
|
||||||
GPS *gps = nullptr;
|
GPS *gps = nullptr;
|
||||||
|
|
||||||
static const char *ACK_SUCCESS_MESSAGE = "Get ack success!";
|
|
||||||
|
|
||||||
static GPSUpdateScheduling scheduling;
|
static GPSUpdateScheduling scheduling;
|
||||||
|
|
||||||
/// Multiple GPS instances might use the same serial port (in sequence), but we can
|
/// Multiple GPS instances might use the same serial port (in sequence), but we can
|
||||||
@ -437,6 +435,10 @@ static const int serialSpeeds[3] = {9600, 115200, 38400};
|
|||||||
static const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE};
|
static const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GPS_PROBETRIES
|
||||||
|
#define GPS_PROBETRIES 2
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setup the GPS based on the model detected.
|
* @brief Setup the GPS based on the model detected.
|
||||||
* We detect the GPS by cycling through a set of baud rates, first common then rare.
|
* We detect the GPS by cycling through a set of baud rates, first common then rare.
|
||||||
@ -460,11 +462,7 @@ bool GPS::setup()
|
|||||||
digitalWrite(PIN_GPS_EN, HIGH);
|
digitalWrite(PIN_GPS_EN, HIGH);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRACKER_T1000_E
|
if (probeTries < GPS_PROBETRIES) {
|
||||||
if (probeTries < 5) {
|
|
||||||
#else
|
|
||||||
if (probeTries < 2) {
|
|
||||||
#endif
|
|
||||||
LOG_DEBUG("Probe for GPS at %d", serialSpeeds[speedSelect]);
|
LOG_DEBUG("Probe for GPS at %d", serialSpeeds[speedSelect]);
|
||||||
gnssModel = probe(serialSpeeds[speedSelect]);
|
gnssModel = probe(serialSpeeds[speedSelect]);
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
@ -475,11 +473,7 @@ bool GPS::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Rare Serial Speeds
|
// Rare Serial Speeds
|
||||||
#ifdef TRACKER_T1000_E
|
if (probeTries == GPS_PROBETRIES) {
|
||||||
if (probeTries == 5) {
|
|
||||||
#else
|
|
||||||
if (probeTries == 2) {
|
|
||||||
#endif
|
|
||||||
LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]);
|
LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]);
|
||||||
gnssModel = probe(rareSerialSpeeds[speedSelect]);
|
gnssModel = probe(rareSerialSpeeds[speedSelect]);
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
@ -1043,14 +1037,6 @@ int32_t GPS::runOnce()
|
|||||||
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||||
return disable();
|
return disable();
|
||||||
}
|
}
|
||||||
// ONCE we will factory reset the GPS for bug #327
|
|
||||||
if (!devicestate.did_gps_reset) {
|
|
||||||
LOG_WARN("GPS FactoryReset requested");
|
|
||||||
if (gps->factoryReset()) { // If we don't succeed try again next time
|
|
||||||
devicestate.did_gps_reset = true;
|
|
||||||
nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GPSInitFinished = true;
|
GPSInitFinished = true;
|
||||||
publishUpdate();
|
publishUpdate();
|
||||||
}
|
}
|
||||||
@ -1063,24 +1049,6 @@ int32_t GPS::runOnce()
|
|||||||
if (whileActive()) {
|
if (whileActive()) {
|
||||||
// if we have received valid NMEA claim we are connected
|
// if we have received valid NMEA claim we are connected
|
||||||
setConnected();
|
setConnected();
|
||||||
} else {
|
|
||||||
if ((config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) &&
|
|
||||||
IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX6, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9,
|
|
||||||
GNSS_MODEL_UBLOX10)) {
|
|
||||||
// reset the GPS on next bootup
|
|
||||||
if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) {
|
|
||||||
LOG_DEBUG("GPS is not found, try factory reset on next boot");
|
|
||||||
devicestate.did_gps_reset = false;
|
|
||||||
nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
|
|
||||||
return disable(); // Stop the GPS thread as it can do nothing useful until next reboot.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// At least one GPS has a bad habit of losing its mind from time to time
|
|
||||||
if (rebootsSeen > 2) {
|
|
||||||
rebootsSeen = 0;
|
|
||||||
LOG_DEBUG("Would normally factoryReset()");
|
|
||||||
// gps->factoryReset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're due for an update, wake the GPS
|
// If we're due for an update, wake the GPS
|
||||||
@ -1415,62 +1383,6 @@ static int32_t toDegInt(RawDegrees d)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPS::factoryReset()
|
|
||||||
{
|
|
||||||
#ifdef PIN_GPS_REINIT
|
|
||||||
// The L76K GNSS on the T-Echo requires the RESET pin to be pulled LOW
|
|
||||||
pinMode(PIN_GPS_REINIT, OUTPUT);
|
|
||||||
digitalWrite(PIN_GPS_REINIT, 0);
|
|
||||||
delay(150); // The L76K datasheet calls for at least 100MS delay
|
|
||||||
digitalWrite(PIN_GPS_REINIT, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) {
|
|
||||||
byte _message_reset1[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1C, 0xA2};
|
|
||||||
_serial_gps->write(_message_reset1, sizeof(_message_reset1));
|
|
||||||
if (getACK(0x05, 0x01, 10000)) {
|
|
||||||
LOG_DEBUG(ACK_SUCCESS_MESSAGE);
|
|
||||||
}
|
|
||||||
delay(100);
|
|
||||||
byte _message_reset2[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1B, 0xA1};
|
|
||||||
_serial_gps->write(_message_reset2, sizeof(_message_reset2));
|
|
||||||
if (getACK(0x05, 0x01, 10000)) {
|
|
||||||
LOG_DEBUG(ACK_SUCCESS_MESSAGE);
|
|
||||||
}
|
|
||||||
delay(100);
|
|
||||||
byte _message_reset3[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x03, 0x1D, 0xB3};
|
|
||||||
_serial_gps->write(_message_reset3, sizeof(_message_reset3));
|
|
||||||
if (getACK(0x05, 0x01, 10000)) {
|
|
||||||
LOG_DEBUG(ACK_SUCCESS_MESSAGE);
|
|
||||||
}
|
|
||||||
} else if (gnssModel == GNSS_MODEL_MTK) {
|
|
||||||
// send the CAS10 to perform a factory restart of the device (and other device that support PCAS statements)
|
|
||||||
LOG_INFO("GNSS Factory Reset via PCAS10,3");
|
|
||||||
_serial_gps->write("$PCAS10,3*1F\r\n");
|
|
||||||
delay(100);
|
|
||||||
} else if (gnssModel == GNSS_MODEL_ATGM336H) {
|
|
||||||
LOG_INFO("Factory Reset via CAS-CFG-RST");
|
|
||||||
uint8_t msglen = makeCASPacket(0x06, 0x02, sizeof(_message_CAS_CFG_RST_FACTORY), _message_CAS_CFG_RST_FACTORY);
|
|
||||||
_serial_gps->write(UBXscratch, msglen);
|
|
||||||
delay(100);
|
|
||||||
} else {
|
|
||||||
// fire this for good measure, if we have an L76B - won't harm other devices.
|
|
||||||
_serial_gps->write("$PMTK104*37\r\n");
|
|
||||||
// No PMTK_ACK for this command.
|
|
||||||
delay(100);
|
|
||||||
// send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's
|
|
||||||
// UBLOX. Factory Reset
|
|
||||||
byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFB, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E};
|
|
||||||
_serial_gps->write(_message_reset, sizeof(_message_reset));
|
|
||||||
}
|
|
||||||
delay(1000);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
||||||
* Override this method to check for new locations
|
* Override this method to check for new locations
|
||||||
|
@ -101,8 +101,6 @@ class GPS : private concurrency::OSThread
|
|||||||
// Empty the input buffer as quickly as possible
|
// Empty the input buffer as quickly as possible
|
||||||
void clearBuffer();
|
void clearBuffer();
|
||||||
|
|
||||||
virtual bool factoryReset();
|
|
||||||
|
|
||||||
// Creates an instance of the GPS class.
|
// Creates an instance of the GPS class.
|
||||||
// Returns the new instance or null if the GPS is not present.
|
// Returns the new instance or null if the GPS is not present.
|
||||||
static GPS *createGps();
|
static GPS *createGps();
|
||||||
|
@ -976,6 +976,7 @@ void setup()
|
|||||||
if (!sxIf->init()) {
|
if (!sxIf->init()) {
|
||||||
LOG_WARN("No SX1262 radio");
|
LOG_WARN("No SX1262 radio");
|
||||||
delete sxIf;
|
delete sxIf;
|
||||||
|
rIf = NULL;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("SX1262 init success");
|
LOG_INFO("SX1262 init success");
|
||||||
rIf = sxIf;
|
rIf = sxIf;
|
||||||
@ -992,6 +993,7 @@ void setup()
|
|||||||
if (!sxIf->init()) {
|
if (!sxIf->init()) {
|
||||||
LOG_WARN("No SX1262 radio with TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE);
|
LOG_WARN("No SX1262 radio with TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE);
|
||||||
delete sxIf;
|
delete sxIf;
|
||||||
|
rIf = NULL;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("SX1262 init success, TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE);
|
LOG_INFO("SX1262 init success, TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE);
|
||||||
rIf = sxIf;
|
rIf = sxIf;
|
||||||
|
@ -644,6 +644,11 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
|||||||
meshtastic_QueueStatus qs = router->getQueueStatus();
|
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||||
service->sendQueueStatusToPhone(qs, 0, p.id);
|
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && isBroadcast(p.to) && p.hop_limit > 0) {
|
||||||
|
sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Multi-hop traceroute to broadcast address is not allowed");
|
||||||
|
meshtastic_QueueStatus qs = router->getQueueStatus();
|
||||||
|
service->sendQueueStatusToPhone(qs, 0, p.id);
|
||||||
|
return false;
|
||||||
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
} else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
|
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) {
|
||||||
LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
|
LOG_WARN("Rate limit portnum %d", p.decoded.portnum);
|
||||||
|
@ -51,6 +51,8 @@ template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
|
|||||||
#else
|
#else
|
||||||
auto client = U::available();
|
auto client = U::available();
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(ARCH_RP2040)
|
||||||
|
auto client = U::accept();
|
||||||
#else
|
#else
|
||||||
auto client = U::available();
|
auto client = U::available();
|
||||||
#endif
|
#endif
|
||||||
@ -78,4 +80,4 @@ template <class T, class U> int32_t APIServerPort<T, U>::runOnce()
|
|||||||
waitTime = 100;
|
waitTime = 100;
|
||||||
#endif
|
#endif
|
||||||
return 100; // only check occasionally for incoming connections
|
return 100; // only check occasionally for incoming connections
|
||||||
}
|
}
|
@ -15,6 +15,12 @@ PB_BIND(meshtastic_NodeFilter, meshtastic_NodeFilter, AUTO)
|
|||||||
PB_BIND(meshtastic_NodeHighlight, meshtastic_NodeHighlight, AUTO)
|
PB_BIND(meshtastic_NodeHighlight, meshtastic_NodeHighlight, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_GeoPoint, meshtastic_GeoPoint, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_Map, meshtastic_Map, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,25 @@ typedef struct _meshtastic_NodeHighlight {
|
|||||||
char node_name[16];
|
char node_name[16];
|
||||||
} meshtastic_NodeHighlight;
|
} meshtastic_NodeHighlight;
|
||||||
|
|
||||||
|
typedef struct _meshtastic_GeoPoint {
|
||||||
|
/* Zoom level */
|
||||||
|
int8_t zoom;
|
||||||
|
/* Coordinate: latitude */
|
||||||
|
int32_t latitude;
|
||||||
|
/* Coordinate: longitude */
|
||||||
|
int32_t longitude;
|
||||||
|
} meshtastic_GeoPoint;
|
||||||
|
|
||||||
|
typedef struct _meshtastic_Map {
|
||||||
|
/* Home coordinates */
|
||||||
|
bool has_home;
|
||||||
|
meshtastic_GeoPoint home;
|
||||||
|
/* Map tile style */
|
||||||
|
char style[20];
|
||||||
|
/* Map scroll follows GPS */
|
||||||
|
bool follow_gps;
|
||||||
|
} meshtastic_Map;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(16) meshtastic_DeviceUIConfig_calibration_data_t;
|
typedef PB_BYTES_ARRAY_T(16) meshtastic_DeviceUIConfig_calibration_data_t;
|
||||||
typedef struct _meshtastic_DeviceUIConfig {
|
typedef struct _meshtastic_DeviceUIConfig {
|
||||||
/* A version integer used to invalidate saved files when we make incompatible changes. */
|
/* A version integer used to invalidate saved files when we make incompatible changes. */
|
||||||
@ -118,6 +137,9 @@ typedef struct _meshtastic_DeviceUIConfig {
|
|||||||
meshtastic_NodeHighlight node_highlight;
|
meshtastic_NodeHighlight node_highlight;
|
||||||
/* 8 integers for screen calibration data */
|
/* 8 integers for screen calibration data */
|
||||||
meshtastic_DeviceUIConfig_calibration_data_t calibration_data;
|
meshtastic_DeviceUIConfig_calibration_data_t calibration_data;
|
||||||
|
/* Map related data */
|
||||||
|
bool has_map_data;
|
||||||
|
meshtastic_Map map_data;
|
||||||
} meshtastic_DeviceUIConfig;
|
} meshtastic_DeviceUIConfig;
|
||||||
|
|
||||||
|
|
||||||
@ -140,13 +162,19 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}}
|
#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}, false, meshtastic_Map_init_default}
|
||||||
#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, "", 0}
|
#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""}
|
#define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""}
|
||||||
#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}}
|
#define meshtastic_GeoPoint_init_default {0, 0, 0}
|
||||||
|
#define meshtastic_Map_init_default {false, meshtastic_GeoPoint_init_default, "", 0}
|
||||||
|
#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}, false, meshtastic_Map_init_zero}
|
||||||
#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, "", 0}
|
#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""}
|
#define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""}
|
||||||
|
#define meshtastic_GeoPoint_init_zero {0, 0, 0}
|
||||||
|
#define meshtastic_Map_init_zero {false, meshtastic_GeoPoint_init_zero, "", 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_NodeFilter_unknown_switch_tag 1
|
#define meshtastic_NodeFilter_unknown_switch_tag 1
|
||||||
@ -161,6 +189,12 @@ extern "C" {
|
|||||||
#define meshtastic_NodeHighlight_telemetry_switch_tag 3
|
#define meshtastic_NodeHighlight_telemetry_switch_tag 3
|
||||||
#define meshtastic_NodeHighlight_iaq_switch_tag 4
|
#define meshtastic_NodeHighlight_iaq_switch_tag 4
|
||||||
#define meshtastic_NodeHighlight_node_name_tag 5
|
#define meshtastic_NodeHighlight_node_name_tag 5
|
||||||
|
#define meshtastic_GeoPoint_zoom_tag 1
|
||||||
|
#define meshtastic_GeoPoint_latitude_tag 2
|
||||||
|
#define meshtastic_GeoPoint_longitude_tag 3
|
||||||
|
#define meshtastic_Map_home_tag 1
|
||||||
|
#define meshtastic_Map_style_tag 2
|
||||||
|
#define meshtastic_Map_follow_gps_tag 3
|
||||||
#define meshtastic_DeviceUIConfig_version_tag 1
|
#define meshtastic_DeviceUIConfig_version_tag 1
|
||||||
#define meshtastic_DeviceUIConfig_screen_brightness_tag 2
|
#define meshtastic_DeviceUIConfig_screen_brightness_tag 2
|
||||||
#define meshtastic_DeviceUIConfig_screen_timeout_tag 3
|
#define meshtastic_DeviceUIConfig_screen_timeout_tag 3
|
||||||
@ -175,6 +209,7 @@ extern "C" {
|
|||||||
#define meshtastic_DeviceUIConfig_node_filter_tag 12
|
#define meshtastic_DeviceUIConfig_node_filter_tag 12
|
||||||
#define meshtastic_DeviceUIConfig_node_highlight_tag 13
|
#define meshtastic_DeviceUIConfig_node_highlight_tag 13
|
||||||
#define meshtastic_DeviceUIConfig_calibration_data_tag 14
|
#define meshtastic_DeviceUIConfig_calibration_data_tag 14
|
||||||
|
#define meshtastic_DeviceUIConfig_map_data_tag 15
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_DeviceUIConfig_FIELDLIST(X, a) \
|
#define meshtastic_DeviceUIConfig_FIELDLIST(X, a) \
|
||||||
@ -191,11 +226,13 @@ X(a, STATIC, SINGULAR, UINT32, ring_tone_id, 10) \
|
|||||||
X(a, STATIC, SINGULAR, UENUM, language, 11) \
|
X(a, STATIC, SINGULAR, UENUM, language, 11) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, node_filter, 12) \
|
X(a, STATIC, OPTIONAL, MESSAGE, node_filter, 12) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, node_highlight, 13) \
|
X(a, STATIC, OPTIONAL, MESSAGE, node_highlight, 13) \
|
||||||
X(a, STATIC, SINGULAR, BYTES, calibration_data, 14)
|
X(a, STATIC, SINGULAR, BYTES, calibration_data, 14) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, map_data, 15)
|
||||||
#define meshtastic_DeviceUIConfig_CALLBACK NULL
|
#define meshtastic_DeviceUIConfig_CALLBACK NULL
|
||||||
#define meshtastic_DeviceUIConfig_DEFAULT NULL
|
#define meshtastic_DeviceUIConfig_DEFAULT NULL
|
||||||
#define meshtastic_DeviceUIConfig_node_filter_MSGTYPE meshtastic_NodeFilter
|
#define meshtastic_DeviceUIConfig_node_filter_MSGTYPE meshtastic_NodeFilter
|
||||||
#define meshtastic_DeviceUIConfig_node_highlight_MSGTYPE meshtastic_NodeHighlight
|
#define meshtastic_DeviceUIConfig_node_highlight_MSGTYPE meshtastic_NodeHighlight
|
||||||
|
#define meshtastic_DeviceUIConfig_map_data_MSGTYPE meshtastic_Map
|
||||||
|
|
||||||
#define meshtastic_NodeFilter_FIELDLIST(X, a) \
|
#define meshtastic_NodeFilter_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, unknown_switch, 1) \
|
X(a, STATIC, SINGULAR, BOOL, unknown_switch, 1) \
|
||||||
@ -217,18 +254,39 @@ X(a, STATIC, SINGULAR, STRING, node_name, 5)
|
|||||||
#define meshtastic_NodeHighlight_CALLBACK NULL
|
#define meshtastic_NodeHighlight_CALLBACK NULL
|
||||||
#define meshtastic_NodeHighlight_DEFAULT NULL
|
#define meshtastic_NodeHighlight_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_GeoPoint_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, zoom, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, latitude, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, longitude, 3)
|
||||||
|
#define meshtastic_GeoPoint_CALLBACK NULL
|
||||||
|
#define meshtastic_GeoPoint_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_Map_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, home, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, style, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, follow_gps, 3)
|
||||||
|
#define meshtastic_Map_CALLBACK NULL
|
||||||
|
#define meshtastic_Map_DEFAULT NULL
|
||||||
|
#define meshtastic_Map_home_MSGTYPE meshtastic_GeoPoint
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_DeviceUIConfig_msg;
|
extern const pb_msgdesc_t meshtastic_DeviceUIConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_NodeFilter_msg;
|
extern const pb_msgdesc_t meshtastic_NodeFilter_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_NodeHighlight_msg;
|
extern const pb_msgdesc_t meshtastic_NodeHighlight_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_GeoPoint_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_Map_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_DeviceUIConfig_fields &meshtastic_DeviceUIConfig_msg
|
#define meshtastic_DeviceUIConfig_fields &meshtastic_DeviceUIConfig_msg
|
||||||
#define meshtastic_NodeFilter_fields &meshtastic_NodeFilter_msg
|
#define meshtastic_NodeFilter_fields &meshtastic_NodeFilter_msg
|
||||||
#define meshtastic_NodeHighlight_fields &meshtastic_NodeHighlight_msg
|
#define meshtastic_NodeHighlight_fields &meshtastic_NodeHighlight_msg
|
||||||
|
#define meshtastic_GeoPoint_fields &meshtastic_GeoPoint_msg
|
||||||
|
#define meshtastic_Map_fields &meshtastic_Map_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size
|
#define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size
|
||||||
#define meshtastic_DeviceUIConfig_size 128
|
#define meshtastic_DeviceUIConfig_size 188
|
||||||
|
#define meshtastic_GeoPoint_size 33
|
||||||
|
#define meshtastic_Map_size 58
|
||||||
#define meshtastic_NodeFilter_size 47
|
#define meshtastic_NodeFilter_size 47
|
||||||
#define meshtastic_NodeHighlight_size 25
|
#define meshtastic_NodeHighlight_size 25
|
||||||
|
|
||||||
|
@ -123,23 +123,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
* Getters
|
* Getters
|
||||||
*/
|
*/
|
||||||
case meshtastic_AdminMessage_get_owner_request_tag:
|
case meshtastic_AdminMessage_get_owner_request_tag:
|
||||||
LOG_INFO("Client got owner");
|
LOG_DEBUG("Client got owner");
|
||||||
handleGetOwner(mp);
|
handleGetOwner(mp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_get_config_request_tag:
|
case meshtastic_AdminMessage_get_config_request_tag:
|
||||||
LOG_INFO("Client got config");
|
LOG_DEBUG("Client got config");
|
||||||
handleGetConfig(mp, r->get_config_request);
|
handleGetConfig(mp, r->get_config_request);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_get_module_config_request_tag:
|
case meshtastic_AdminMessage_get_module_config_request_tag:
|
||||||
LOG_INFO("Client got module config");
|
LOG_DEBUG("Client got module config");
|
||||||
handleGetModuleConfig(mp, r->get_module_config_request);
|
handleGetModuleConfig(mp, r->get_module_config_request);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_get_channel_request_tag: {
|
case meshtastic_AdminMessage_get_channel_request_tag: {
|
||||||
uint32_t i = r->get_channel_request - 1;
|
uint32_t i = r->get_channel_request - 1;
|
||||||
LOG_INFO("Client got channel %u", i);
|
LOG_DEBUG("Client got channel %u", i);
|
||||||
if (i >= MAX_NUM_CHANNELS)
|
if (i >= MAX_NUM_CHANNELS)
|
||||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||||
else
|
else
|
||||||
@ -151,35 +151,35 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
* Setters
|
* Setters
|
||||||
*/
|
*/
|
||||||
case meshtastic_AdminMessage_set_owner_tag:
|
case meshtastic_AdminMessage_set_owner_tag:
|
||||||
LOG_INFO("Client set owner");
|
LOG_DEBUG("Client set owner");
|
||||||
handleSetOwner(r->set_owner);
|
handleSetOwner(r->set_owner);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_set_config_tag:
|
case meshtastic_AdminMessage_set_config_tag:
|
||||||
LOG_INFO("Client set config");
|
LOG_DEBUG("Client set config");
|
||||||
handleSetConfig(r->set_config);
|
handleSetConfig(r->set_config);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_set_module_config_tag:
|
case meshtastic_AdminMessage_set_module_config_tag:
|
||||||
LOG_INFO("Client set module config");
|
LOG_DEBUG("Client set module config");
|
||||||
if (!handleSetModuleConfig(r->set_module_config)) {
|
if (!handleSetModuleConfig(r->set_module_config)) {
|
||||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case meshtastic_AdminMessage_set_channel_tag:
|
case meshtastic_AdminMessage_set_channel_tag:
|
||||||
LOG_INFO("Client set channel %d", r->set_channel.index);
|
LOG_DEBUG("Client set channel %d", r->set_channel.index);
|
||||||
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
||||||
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
||||||
else
|
else
|
||||||
handleSetChannel(r->set_channel);
|
handleSetChannel(r->set_channel);
|
||||||
break;
|
break;
|
||||||
case meshtastic_AdminMessage_set_ham_mode_tag:
|
case meshtastic_AdminMessage_set_ham_mode_tag:
|
||||||
LOG_INFO("Client set ham mode");
|
LOG_DEBUG("Client set ham mode");
|
||||||
handleSetHamMode(r->set_ham_mode);
|
handleSetHamMode(r->set_ham_mode);
|
||||||
break;
|
break;
|
||||||
case meshtastic_AdminMessage_get_ui_config_request_tag: {
|
case meshtastic_AdminMessage_get_ui_config_request_tag: {
|
||||||
LOG_INFO("Client is getting device-ui config");
|
LOG_DEBUG("Client is getting device-ui config");
|
||||||
handleGetDeviceUIConfig(mp);
|
handleGetDeviceUIConfig(mp);
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
@ -410,7 +410,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
LOG_DEBUG("Did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
|
LOG_DEBUG("Did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant);
|
||||||
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
||||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
||||||
LOG_INFO("Ignore irrelevant admin %d", r->which_payload_variant);
|
LOG_DEBUG("Ignore irrelevant admin %d", r->which_payload_variant);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1195,4 +1195,4 @@ void disableBluetooth()
|
|||||||
nrf52Bluetooth->shutdown();
|
nrf52Bluetooth->shutdown();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ int32_t PowerTelemetryModule::runOnce()
|
|||||||
doDeepSleep(nightyNightMs, true, false);
|
doDeepSleep(nightyNightMs, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t result = UINT32_MAX;
|
|
||||||
/*
|
/*
|
||||||
Uncomment the preferences below if you want to use the module
|
Uncomment the preferences below if you want to use the module
|
||||||
without having to configure it from the PythonAPI or WebUI.
|
without having to configure it from the PythonAPI or WebUI.
|
||||||
@ -46,25 +45,33 @@ int32_t PowerTelemetryModule::runOnce()
|
|||||||
return disable();
|
return disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t sendToMeshIntervalMs = Default::getConfiguredOrDefaultMsScaled(
|
||||||
|
moduleConfig.telemetry.power_update_interval, default_telemetry_broadcast_interval_secs, numOnlineNodes);
|
||||||
|
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
// This is the first time the OSThread library has called this function, so do some setup
|
// This is the first time the OSThread library has called this function, so do some setup
|
||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
|
uint32_t result = UINT32_MAX;
|
||||||
|
|
||||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
||||||
if (moduleConfig.telemetry.power_measurement_enabled) {
|
if (moduleConfig.telemetry.power_measurement_enabled) {
|
||||||
LOG_INFO("Power Telemetry: init");
|
LOG_INFO("Power Telemetry: init");
|
||||||
// it's possible to have this module enabled, only for displaying values on the screen.
|
// If sensor is already initialized by EnvironmentTelemetryModule, then we don't need to initialize it again,
|
||||||
// therefore, we should only enable the sensor loop if measurement is also enabled
|
// but we need to set the result to != UINT32_MAX to avoid it being disabled
|
||||||
if (ina219Sensor.hasSensor() && !ina219Sensor.isInitialized())
|
if (ina219Sensor.hasSensor())
|
||||||
result = ina219Sensor.runOnce();
|
result = ina219Sensor.isInitialized() ? 0 : ina219Sensor.runOnce();
|
||||||
if (ina226Sensor.hasSensor() && !ina226Sensor.isInitialized())
|
if (ina226Sensor.hasSensor())
|
||||||
result = ina226Sensor.runOnce();
|
result = ina226Sensor.isInitialized() ? 0 : ina226Sensor.runOnce();
|
||||||
if (ina260Sensor.hasSensor() && !ina260Sensor.isInitialized())
|
if (ina260Sensor.hasSensor())
|
||||||
result = ina260Sensor.runOnce();
|
result = ina260Sensor.isInitialized() ? 0 : ina260Sensor.runOnce();
|
||||||
if (ina3221Sensor.hasSensor() && !ina3221Sensor.isInitialized())
|
if (ina3221Sensor.hasSensor())
|
||||||
result = ina3221Sensor.runOnce();
|
result = ina3221Sensor.isInitialized() ? 0 : ina3221Sensor.runOnce();
|
||||||
if (max17048Sensor.hasSensor() && !max17048Sensor.isInitialized())
|
if (max17048Sensor.hasSensor())
|
||||||
result = max17048Sensor.runOnce();
|
result = max17048Sensor.isInitialized() ? 0 : max17048Sensor.runOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// it's possible to have this module enabled, only for displaying values on the screen.
|
||||||
|
// therefore, we should only enable the sensor loop if measurement is also enabled
|
||||||
return result == UINT32_MAX ? disable() : setStartDelay();
|
return result == UINT32_MAX ? disable() : setStartDelay();
|
||||||
#else
|
#else
|
||||||
return disable();
|
return disable();
|
||||||
@ -74,10 +81,7 @@ int32_t PowerTelemetryModule::runOnce()
|
|||||||
if (!moduleConfig.telemetry.power_measurement_enabled)
|
if (!moduleConfig.telemetry.power_measurement_enabled)
|
||||||
return disable();
|
return disable();
|
||||||
|
|
||||||
if (((lastSentToMesh == 0) ||
|
if (((lastSentToMesh == 0) || !Throttle::isWithinTimespanMs(lastSentToMesh, sendToMeshIntervalMs)) &&
|
||||||
!Throttle::isWithinTimespanMs(lastSentToMesh, Default::getConfiguredOrDefaultMsScaled(
|
|
||||||
moduleConfig.telemetry.power_update_interval,
|
|
||||||
default_telemetry_broadcast_interval_secs, numOnlineNodes))) &&
|
|
||||||
airTime->isTxAllowedAirUtil()) {
|
airTime->isTxAllowedAirUtil()) {
|
||||||
sendTelemetry();
|
sendTelemetry();
|
||||||
lastSentToMesh = millis();
|
lastSentToMesh = millis();
|
||||||
@ -89,8 +93,9 @@ int32_t PowerTelemetryModule::runOnce()
|
|||||||
lastSentToPhone = millis();
|
lastSentToPhone = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return min(sendToPhoneIntervalMs, result);
|
return min(sendToPhoneIntervalMs, sendToMeshIntervalMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerTelemetryModule::wantUIFrame()
|
bool PowerTelemetryModule::wantUIFrame()
|
||||||
{
|
{
|
||||||
return moduleConfig.telemetry.power_screen_enabled;
|
return moduleConfig.telemetry.power_screen_enabled;
|
||||||
|
@ -151,6 +151,12 @@ meshtastic_MeshPacket *TraceRouteModule::allocReply()
|
|||||||
{
|
{
|
||||||
assert(currentRequest);
|
assert(currentRequest);
|
||||||
|
|
||||||
|
// Ignore multi-hop broadcast requests
|
||||||
|
if (isBroadcast(currentRequest->to) && currentRequest->hop_limit < currentRequest->hop_start) {
|
||||||
|
ignoreRequest = true;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the payload of the current request
|
// Copy the payload of the current request
|
||||||
auto req = *currentRequest;
|
auto req = *currentRequest;
|
||||||
const auto &p = req.decoded;
|
const auto &p = req.decoded;
|
||||||
|
@ -26,7 +26,7 @@ class BluetoothPhoneAPI : public PhoneAPI
|
|||||||
{
|
{
|
||||||
PhoneAPI::onNowHasData(fromRadioNum);
|
PhoneAPI::onNowHasData(fromRadioNum);
|
||||||
|
|
||||||
LOG_INFO("BLE notify fromNum");
|
LOG_DEBUG("BLE notify fromNum");
|
||||||
|
|
||||||
uint8_t val[4];
|
uint8_t val[4];
|
||||||
put_le32(val, fromRadioNum);
|
put_le32(val, fromRadioNum);
|
||||||
@ -51,7 +51,7 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks
|
|||||||
{
|
{
|
||||||
virtual void onWrite(NimBLECharacteristic *pCharacteristic)
|
virtual void onWrite(NimBLECharacteristic *pCharacteristic)
|
||||||
{
|
{
|
||||||
LOG_INFO("To Radio onwrite");
|
LOG_DEBUG("To Radio onwrite");
|
||||||
auto val = pCharacteristic->getValue();
|
auto val = pCharacteristic->getValue();
|
||||||
|
|
||||||
if (memcmp(lastToRadio, val.data(), val.length()) != 0) {
|
if (memcmp(lastToRadio, val.data(), val.length()) != 0) {
|
||||||
@ -306,4 +306,4 @@ void clearNVS()
|
|||||||
ESP.restart();
|
ESP.restart();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,11 +107,15 @@ static const uint8_t AREF = PIN_AREF;
|
|||||||
/*
|
/*
|
||||||
* SPI Interfaces
|
* SPI Interfaces
|
||||||
*/
|
*/
|
||||||
#define SPI_INTERFACES_COUNT 1
|
#define SPI_INTERFACES_COUNT 2
|
||||||
|
|
||||||
#define PIN_SPI_MISO (29)
|
#define PIN_SPI_MISO (45)
|
||||||
#define PIN_SPI_MOSI (30)
|
#define PIN_SPI_MOSI (44)
|
||||||
#define PIN_SPI_SCK (3)
|
#define PIN_SPI_SCK (43)
|
||||||
|
|
||||||
|
#define PIN_SPI1_MISO (29) // (0 + 29)
|
||||||
|
#define PIN_SPI1_MOSI (30) // (0 + 30)
|
||||||
|
#define PIN_SPI1_SCK (3) // (0 + 3)
|
||||||
|
|
||||||
static const uint8_t SS = 42;
|
static const uint8_t SS = 42;
|
||||||
static const uint8_t MOSI = PIN_SPI_MOSI;
|
static const uint8_t MOSI = PIN_SPI_MOSI;
|
||||||
@ -126,8 +130,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define PIN_EINK_BUSY (0 + 4)
|
#define PIN_EINK_BUSY (0 + 4)
|
||||||
#define PIN_EINK_DC (0 + 17)
|
#define PIN_EINK_DC (0 + 17)
|
||||||
#define PIN_EINK_RES (-1)
|
#define PIN_EINK_RES (-1)
|
||||||
#define PIN_EINK_SCLK PIN_SPI_SCK
|
#define PIN_EINK_SCLK (0 + 3)
|
||||||
#define PIN_EINK_MOSI PIN_SPI_MOSI // also called SDI
|
#define PIN_EINK_MOSI (0 + 30) // also called SDI
|
||||||
|
|
||||||
// #define USE_EINK
|
// #define USE_EINK
|
||||||
|
|
||||||
@ -255,7 +259,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
|
|||||||
|
|
||||||
#define PIN_ETHERNET_RESET 21
|
#define PIN_ETHERNET_RESET 21
|
||||||
#define PIN_ETHERNET_SS PIN_EINK_CS
|
#define PIN_ETHERNET_SS PIN_EINK_CS
|
||||||
#define ETH_SPI_PORT SPI
|
#define ETH_SPI_PORT SPI1
|
||||||
#define AQ_SET_PIN 10
|
#define AQ_SET_PIN 10
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -9,7 +9,7 @@ build_flags = ${rp2350_base.build_flags}
|
|||||||
-Ivariants/rpipico2
|
-Ivariants/rpipico2
|
||||||
-DDEBUG_RP2040_PORT=Serial
|
-DDEBUG_RP2040_PORT=Serial
|
||||||
-DHW_SPI1_DEVICE
|
-DHW_SPI1_DEVICE
|
||||||
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus"
|
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33"
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${rp2350_base.lib_deps}
|
${rp2350_base.lib_deps}
|
||||||
debug_build_flags = ${rp2350_base.build_flags}, -g
|
debug_build_flags = ${rp2350_base.build_flags}, -g
|
||||||
|
30
variants/rpipico2w/platformio.ini
Normal file
30
variants/rpipico2w/platformio.ini
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[env:pico2w]
|
||||||
|
extends = rp2350_base
|
||||||
|
board = rpipico2w
|
||||||
|
upload_protocol = jlink
|
||||||
|
# debug settings for external openocd with RP2040 support (custom build)
|
||||||
|
debug_tool = custom
|
||||||
|
debug_init_cmds =
|
||||||
|
target extended-remote localhost:3333
|
||||||
|
$INIT_BREAK
|
||||||
|
monitor reset halt
|
||||||
|
$LOAD_CMDS
|
||||||
|
monitor init
|
||||||
|
monitor reset halt
|
||||||
|
|
||||||
|
# add our variants files to the include and src paths
|
||||||
|
build_flags = ${rp2350_base.build_flags}
|
||||||
|
-DRPI_PICO2
|
||||||
|
-Ivariants/rpipico2w
|
||||||
|
# -DDEBUG_RP2040_PORT=Serial
|
||||||
|
-DHW_SPI1_DEVICE
|
||||||
|
-DARDUINO_RASPBERRY_PI_PICO_2W
|
||||||
|
-DARDUINO_ARCH_RP2040
|
||||||
|
-DHAS_WIFI=1
|
||||||
|
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33"
|
||||||
|
-fexceptions # for exception handling in MQTT
|
||||||
|
build_src_filter = ${rp2350_base.build_src_filter} +<mesh/wifi/>
|
||||||
|
lib_deps =
|
||||||
|
${rp2350_base.lib_deps}
|
||||||
|
${networking_base.lib_deps}
|
||||||
|
debug_build_flags = ${rp2350_base.build_flags}, -g
|
52
variants/rpipico2w/variant.h
Normal file
52
variants/rpipico2w/variant.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// #define RADIOLIB_CUSTOM_ARDUINO 1
|
||||||
|
// #define RADIOLIB_TONE_UNSUPPORTED 1
|
||||||
|
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
|
||||||
|
|
||||||
|
#define ARDUINO_ARCH_AVR
|
||||||
|
|
||||||
|
#ifndef HAS_WIFI
|
||||||
|
#define HAS_WIFI 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// default I2C pins:
|
||||||
|
// SDA = 4
|
||||||
|
// SCL = 5
|
||||||
|
|
||||||
|
// Recommended pins for SerialModule:
|
||||||
|
// txd = 8
|
||||||
|
// rxd = 9
|
||||||
|
|
||||||
|
#define EXT_NOTIFY_OUT 22
|
||||||
|
#define BUTTON_PIN 17
|
||||||
|
|
||||||
|
#define BATTERY_PIN 26
|
||||||
|
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
|
||||||
|
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
|
||||||
|
|
||||||
|
#define USE_SX1262
|
||||||
|
|
||||||
|
#undef LORA_SCK
|
||||||
|
#undef LORA_MISO
|
||||||
|
#undef LORA_MOSI
|
||||||
|
#undef LORA_CS
|
||||||
|
|
||||||
|
#define LORA_SCK 10
|
||||||
|
#define LORA_MISO 12
|
||||||
|
#define LORA_MOSI 11
|
||||||
|
#define LORA_CS 3
|
||||||
|
|
||||||
|
#define LORA_DIO0 RADIOLIB_NC
|
||||||
|
#define LORA_RESET 15
|
||||||
|
#define LORA_DIO1 20
|
||||||
|
#define LORA_DIO2 2
|
||||||
|
#define LORA_DIO3 RADIOLIB_NC
|
||||||
|
|
||||||
|
#ifdef USE_SX1262
|
||||||
|
#define SX126X_CS LORA_CS
|
||||||
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
|
#define SX126X_BUSY LORA_DIO2
|
||||||
|
#define SX126X_RESET LORA_RESET
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||||
|
#endif
|
@ -111,6 +111,7 @@ extern "C" {
|
|||||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||||
|
|
||||||
#define GPS_BAUDRATE 115200
|
#define GPS_BAUDRATE 115200
|
||||||
|
#define GPS_PROBETRIES 5
|
||||||
|
|
||||||
#define PIN_GPS_EN (32 + 11) // P1.11
|
#define PIN_GPS_EN (32 + 11) // P1.11
|
||||||
#define GPS_EN_ACTIVE HIGH
|
#define GPS_EN_ACTIVE HIGH
|
||||||
|
Loading…
Reference in New Issue
Block a user