mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-10 15:12:06 +00:00
Merge branch 'master' into tft-gui-work
This commit is contained in:
commit
84bbfa1e52
3
.github/workflows/main_matrix.yml
vendored
3
.github/workflows/main_matrix.yml
vendored
@ -245,7 +245,8 @@ jobs:
|
|||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
outputs:
|
outputs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
needs: [
|
needs:
|
||||||
|
[
|
||||||
gather-artifacts,
|
gather-artifacts,
|
||||||
package-raspbian,
|
package-raspbian,
|
||||||
package-raspbian-armv7l,
|
package-raspbian-armv7l,
|
||||||
|
1
.github/workflows/stale_bot.yml
vendored
1
.github/workflows/stale_bot.yml
vendored
@ -17,6 +17,5 @@ jobs:
|
|||||||
- name: Stale PR+Issues
|
- name: Stale PR+Issues
|
||||||
uses: actions/stale@v9.0.0
|
uses: actions/stale@v9.0.0
|
||||||
with:
|
with:
|
||||||
debug-only: true
|
|
||||||
exempt-issue-labels: pinned,3.0
|
exempt-issue-labels: pinned,3.0
|
||||||
exempt-pr-labels: pinned,3.0
|
exempt-pr-labels: pinned,3.0
|
||||||
|
43
.github/workflows/trunk_format_pr.yml
vendored
Normal file
43
.github/workflows/trunk_format_pr.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: Run Trunk Fmt on PR Comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trunk-fmt:
|
||||||
|
if: github.event.issue.pull_request != null && contains(github.event.comment.body, 'trunk fmt')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{github.event.pull_request.head.ref}}
|
||||||
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
|
- name: Install trunk
|
||||||
|
run: curl https://get.trunk.io -fsSL | bash
|
||||||
|
|
||||||
|
- name: Run Trunk Fmt
|
||||||
|
run: trunk fmt
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
git commit -m "Add firmware version ${{ steps.version.outputs.version }}"
|
||||||
|
git push
|
||||||
|
|
||||||
|
- name: Comment on PR
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
github.issues.createComment({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: '`trunk fmt` has been run on this PR.'
|
||||||
|
})
|
@ -8,10 +8,10 @@ plugins:
|
|||||||
uri: https://github.com/trunk-io/plugins
|
uri: https://github.com/trunk-io/plugins
|
||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- trufflehog@3.82.13
|
- trufflehog@3.83.2
|
||||||
- yamllint@1.35.1
|
- yamllint@1.35.1
|
||||||
- bandit@1.7.10
|
- bandit@1.7.10
|
||||||
- checkov@3.2.269
|
- checkov@3.2.276
|
||||||
- terrascan@1.19.9
|
- terrascan@1.19.9
|
||||||
- trivy@0.56.2
|
- trivy@0.56.2
|
||||||
#- trufflehog@3.63.2-rc0
|
#- trufflehog@3.63.2-rc0
|
||||||
|
4
CODE_OF_CONDUCT.md
Normal file
4
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
The Meshtastic Firmware project is subject to the code of conduct for the parent project, which can be found here:
|
||||||
|
https://meshtastic.org/docs/legal/conduct/
|
@ -31,7 +31,7 @@ build_flags =
|
|||||||
-DCONFIG_BT_NIMBLE_ENABLED
|
-DCONFIG_BT_NIMBLE_ENABLED
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
||||||
-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=5120
|
-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=8192
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||||
-DSERIAL_BUFFER_SIZE=4096
|
-DSERIAL_BUFFER_SIZE=4096
|
||||||
-DLIBPAX_ARDUINO
|
-DLIBPAX_ARDUINO
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#6b3796d697481c8f6e3f4aa5c111bd9979f29e64
|
platform = https://github.com/meshtastic/platform-native.git#bcd02436cfca91f7d28ad0f7dab977c6aaa781af
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 807236815d61cc0ebd89472c2a2aa76758bc92ac
|
Subproject commit 015202aead5f6807d63537c58f4cb6525f19e56f
|
@ -66,7 +66,7 @@ GpioBinaryTransformer::GpioBinaryTransformer(GpioVirtPin *inPin1, GpioVirtPin *i
|
|||||||
assert(!inPin2->dependentPin); // We only allow one dependent pin
|
assert(!inPin2->dependentPin); // We only allow one dependent pin
|
||||||
inPin2->dependentPin = this;
|
inPin2->dependentPin = this;
|
||||||
|
|
||||||
// Don't update at construction time, because various GpioPins might be global constructor based not yet initied because
|
// Don't update at construction time, because various GpioPins might be global constructor based not yet initiated because
|
||||||
// order of operations for global constructors is not defined.
|
// order of operations for global constructors is not defined.
|
||||||
// update();
|
// update();
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,16 @@ static void adcEnable()
|
|||||||
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
|
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
|
||||||
#ifdef ADC_USE_PULLUP
|
#ifdef ADC_USE_PULLUP
|
||||||
pinMode(ADC_CTRL, INPUT_PULLUP);
|
pinMode(ADC_CTRL, INPUT_PULLUP);
|
||||||
|
#else
|
||||||
|
#ifdef HELTEC_V3
|
||||||
|
pinMode(ADC_CTRL, INPUT);
|
||||||
|
uint8_t adc_ctl_enable_value = !(digitalRead(ADC_CTRL));
|
||||||
|
pinMode(ADC_CTRL, OUTPUT);
|
||||||
|
digitalWrite(ADC_CTRL, adc_ctl_enable_value);
|
||||||
#else
|
#else
|
||||||
pinMode(ADC_CTRL, OUTPUT);
|
pinMode(ADC_CTRL, OUTPUT);
|
||||||
digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED);
|
digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
delay(10);
|
delay(10);
|
||||||
#endif
|
#endif
|
||||||
@ -167,10 +174,14 @@ static void adcDisable()
|
|||||||
#ifdef ADC_CTRL // disable adc voltage divider when we need to read
|
#ifdef ADC_CTRL // disable adc voltage divider when we need to read
|
||||||
#ifdef ADC_USE_PULLUP
|
#ifdef ADC_USE_PULLUP
|
||||||
pinMode(ADC_CTRL, INPUT_PULLDOWN);
|
pinMode(ADC_CTRL, INPUT_PULLDOWN);
|
||||||
|
#else
|
||||||
|
#ifdef HELTEC_V3
|
||||||
|
pinMode(ADC_CTRL, ANALOG);
|
||||||
#else
|
#else
|
||||||
digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED);
|
digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -629,7 +640,7 @@ void Power::readPowerStatus()
|
|||||||
batteryChargePercent = batteryLevel->getBatteryPercent();
|
batteryChargePercent = batteryLevel->getBatteryPercent();
|
||||||
} else {
|
} else {
|
||||||
// If the AXP192 returns a percentage less than 0, the feature is either not supported or there is an error
|
// If the AXP192 returns a percentage less than 0, the feature is either not supported or there is an error
|
||||||
// In that case, we compute an estimate of the charge percent based on open circuite voltage table defined
|
// In that case, we compute an estimate of the charge percent based on open circuit voltage table defined
|
||||||
// in power.h
|
// in power.h
|
||||||
batteryChargePercent = clamp((int)(((batteryVoltageMv - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS)) * 1e2) /
|
batteryChargePercent = clamp((int)(((batteryVoltageMv - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS)) * 1e2) /
|
||||||
((OCV[0] * NUM_CELLS) - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS))),
|
((OCV[0] * NUM_CELLS) - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS))),
|
||||||
|
@ -185,7 +185,7 @@ static void powerEnter()
|
|||||||
{
|
{
|
||||||
// LOG_DEBUG("Enter state: POWER");
|
// LOG_DEBUG("Enter state: POWER");
|
||||||
if (!isPowered()) {
|
if (!isPowered()) {
|
||||||
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
// If we got here, we are in the wrong state - we should be in powered, let that state handle things
|
||||||
LOG_INFO("Loss of power in Powered");
|
LOG_INFO("Loss of power in Powered");
|
||||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||||
} else {
|
} else {
|
||||||
@ -230,7 +230,7 @@ static void onEnter()
|
|||||||
static void onIdle()
|
static void onIdle()
|
||||||
{
|
{
|
||||||
if (isPowered()) {
|
if (isPowered()) {
|
||||||
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
// If we got here, we are in the wrong state - we should be in powered, let that state handle things
|
||||||
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ void PowerFSM_setup()
|
|||||||
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)
|
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// See: https://github.com/meshtastic/firmware/issues/1071
|
// See: https://github.com/meshtastic/firmware/issues/1071
|
||||||
// Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiatiated through the
|
// Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiated through the
|
||||||
// modules
|
// modules
|
||||||
if ((isRouter || config.power.is_power_saving) && !isTrackerOrSensor) {
|
if ((isRouter || config.power.is_power_saving) && !isTrackerOrSensor) {
|
||||||
powerFSM.add_timed_transition(&stateNB, &stateLS,
|
powerFSM.add_timed_transition(&stateNB, &stateLS,
|
||||||
|
@ -207,6 +207,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifndef GPS_BAUDRATE
|
#ifndef GPS_BAUDRATE
|
||||||
#define GPS_BAUDRATE 9600
|
#define GPS_BAUDRATE 9600
|
||||||
|
#define GPS_BAUDRATE_FIXED 0
|
||||||
|
#else
|
||||||
|
#define GPS_BAUDRATE_FIXED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Step #2: follow with defines common to the architecture;
|
/* Step #2: follow with defines common to the architecture;
|
||||||
|
@ -413,32 +413,46 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
||||||
|
* For each baud rate, we run GPS::Probe to send commands and match the responses
|
||||||
|
* to known GPS responses.
|
||||||
|
* @retval Whether setup reached the end of its potential to configure the GPS.
|
||||||
|
*/
|
||||||
bool GPS::setup()
|
bool GPS::setup()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!didSerialInit) {
|
if (!didSerialInit) {
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
|
if (probeTries < 2) {
|
||||||
// if GPS_BAUDRATE is specified in variant (i.e. not 9600), skip to the specified rate.
|
|
||||||
if (speedSelect == 0 && GPS_BAUDRATE != serialSpeeds[speedSelect]) {
|
|
||||||
speedSelect = std::find(serialSpeeds, std::end(serialSpeeds), GPS_BAUDRATE) - serialSpeeds;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]);
|
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]);
|
||||||
gnssModel = probe(serialSpeeds[speedSelect]);
|
gnssModel = probe(serialSpeeds[speedSelect]);
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) {
|
if (++speedSelect == sizeof(serialSpeeds) / sizeof(int)) {
|
||||||
speedSelect = 0;
|
speedSelect = 0;
|
||||||
if (--probeTries == 0) {
|
++probeTries;
|
||||||
LOG_WARN("Giving up on GPS probe and setting to 9600.");
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Rare Serial Speeds
|
||||||
|
if (probeTries == 2) {
|
||||||
|
LOG_DEBUG("Probing for GPS at %d", rareSerialSpeeds[speedSelect]);
|
||||||
|
gnssModel = probe(rareSerialSpeeds[speedSelect]);
|
||||||
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
|
if (++speedSelect == sizeof(rareSerialSpeeds) / sizeof(int)) {
|
||||||
|
LOG_WARN("Giving up on GPS probe and setting to %d", GPS_BAUDRATE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gnssModel != GNSS_MODEL_UNKNOWN) {
|
||||||
|
setConnected();
|
||||||
} else {
|
} else {
|
||||||
gnssModel = GNSS_MODEL_UNKNOWN;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gnssModel == GNSS_MODEL_MTK) {
|
if (gnssModel == GNSS_MODEL_MTK) {
|
||||||
@ -675,7 +689,8 @@ bool GPS::setup()
|
|||||||
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_BBR, "disable SBAS M10 GPS BBR", 300);
|
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_DISABLE_SBAS_BBR, "disable SBAS M10 GPS BBR", 300);
|
||||||
delay(750); // will cause a receiver restart so wait a bit
|
delay(750); // will cause a receiver restart so wait a bit
|
||||||
|
|
||||||
// Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic sleep.
|
// Done with initialization, Now enable wanted NMEA messages in BBR layer so they will survive a periodic
|
||||||
|
// sleep.
|
||||||
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ENABLE_NMEA_BBR, "enable messages for M10 GPS BBR", 300);
|
SEND_UBX_PACKET(0x06, 0x8A, _message_VALSET_ENABLE_NMEA_BBR, "enable messages for M10 GPS BBR", 300);
|
||||||
delay(750);
|
delay(750);
|
||||||
// Next enable wanted NMEA messages in RAM layer
|
// Next enable wanted NMEA messages in RAM layer
|
||||||
@ -937,10 +952,10 @@ void GPS::down()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (softsleepSupported) {
|
if (softsleepSupported) {
|
||||||
// How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than GPS_SOFTSLEEP?
|
// How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than
|
||||||
// Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M and M10050
|
// GPS_SOFTSLEEP? Heuristic equation. A compromise manually fitted to power observations from U-blox NEO-6M
|
||||||
// https://www.desmos.com/calculator/6gvjghoumr
|
// and M10050 https://www.desmos.com/calculator/6gvjghoumr This is not particularly accurate, but probably an
|
||||||
// This is not particularly accurate, but probably an impromevement over a single, fixed threshold
|
// improvement over a single, fixed threshold
|
||||||
uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22));
|
uint32_t hardsleepThreshold = (2750 * pow(predictedSearchDuration / 1000, 1.22));
|
||||||
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep", hardsleepThreshold / 1000);
|
LOG_DEBUG("gps_update_interval >= %us needed to justify hardsleep", hardsleepThreshold / 1000);
|
||||||
|
|
||||||
@ -996,6 +1011,7 @@ int32_t GPS::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GPSInitFinished = true;
|
GPSInitFinished = true;
|
||||||
|
publishUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repeaters have no need for GPS
|
// Repeaters have no need for GPS
|
||||||
@ -1293,10 +1309,12 @@ GPS *GPS::createGps()
|
|||||||
|
|
||||||
if (!GPS_EN_ACTIVE) { // Need to invert the pin before hardware
|
if (!GPS_EN_ACTIVE) { // Need to invert the pin before hardware
|
||||||
new GpioNotTransformer(
|
new GpioNotTransformer(
|
||||||
virtPin, p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio
|
virtPin,
|
||||||
|
p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio
|
||||||
} else {
|
} else {
|
||||||
new GpioUnaryTransformer(
|
new GpioUnaryTransformer(
|
||||||
virtPin, p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio
|
virtPin,
|
||||||
|
p); // We just leave this created object on the heap so it can stay watching virtPin and driving en_gpio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,8 +1422,8 @@ bool GPS::factoryReset()
|
|||||||
_serial_gps->write("$PMTK104*37\r\n");
|
_serial_gps->write("$PMTK104*37\r\n");
|
||||||
// No PMTK_ACK for this command.
|
// No PMTK_ACK for this command.
|
||||||
delay(100);
|
delay(100);
|
||||||
// send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's UBLOX.
|
// send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's
|
||||||
// Factory Reset
|
// UBLOX. Factory Reset
|
||||||
byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFB, 0x00, 0x00, 0x00,
|
byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFB, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E};
|
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E};
|
||||||
_serial_gps->write(_message_reset, sizeof(_message_reset));
|
_serial_gps->write(_message_reset, sizeof(_message_reset));
|
||||||
@ -1444,8 +1462,8 @@ bool GPS::lookForTime()
|
|||||||
auto d = reader.date;
|
auto d = reader.date;
|
||||||
if (ti.isValid() && d.isValid()) { // Note: we don't check for updated, because we'll only be called if needed
|
if (ti.isValid() && d.isValid()) { // Note: we don't check for updated, because we'll only be called if needed
|
||||||
/* Convert to unix time
|
/* Convert to unix time
|
||||||
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970
|
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1,
|
||||||
(midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
|
1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).
|
||||||
*/
|
*/
|
||||||
struct tm t;
|
struct tm t;
|
||||||
t.tm_sec = ti.second() + round(ti.age() / 1000);
|
t.tm_sec = ti.second() + round(ti.age() / 1000);
|
||||||
@ -1678,7 +1696,9 @@ bool GPS::whileActive()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef GPS_DEBUG
|
#ifdef GPS_DEBUG
|
||||||
|
if (debugmsg != "") {
|
||||||
LOG_DEBUG(debugmsg.c_str());
|
LOG_DEBUG(debugmsg.c_str());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,21 @@ class GPS : private concurrency::OSThread
|
|||||||
uint8_t fixType = 0; // fix type from GPGSA
|
uint8_t fixType = 0; // fix type from GPGSA
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
const int serialSpeeds[6] = {9600, 115200, 38400, 4800, 57600, 9600};
|
#if GPS_BAUDRATE_FIXED
|
||||||
|
// if GPS_BAUDRATE is specified in variant, only try that.
|
||||||
|
const int serialSpeeds[1] = {GPS_BAUDRATE};
|
||||||
|
const int rareSerialSpeeds[1] = {GPS_BAUDRATE};
|
||||||
|
#else
|
||||||
|
const int serialSpeeds[3] = {9600, 115200, 38400};
|
||||||
|
const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE};
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0;
|
uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0;
|
||||||
uint32_t rx_gpio = 0;
|
uint32_t rx_gpio = 0;
|
||||||
uint32_t tx_gpio = 0;
|
uint32_t tx_gpio = 0;
|
||||||
|
|
||||||
int speedSelect = 0;
|
int speedSelect = 0;
|
||||||
int probeTries = 2;
|
int probeTries = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hasValidLocation - indicates that the position variables contain a complete
|
* hasValidLocation - indicates that the position variables contain a complete
|
||||||
|
@ -49,7 +49,7 @@ uint32_t GPSUpdateScheduling::msUntilNextSearch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// How long have we already been searching?
|
// How long have we already been searching?
|
||||||
// Used to abort a search in progress, if it runs unnaceptably long
|
// Used to abort a search in progress, if it runs unacceptably long
|
||||||
uint32_t GPSUpdateScheduling::elapsedSearchMs()
|
uint32_t GPSUpdateScheduling::elapsedSearchMs()
|
||||||
{
|
{
|
||||||
// If searching
|
// If searching
|
||||||
@ -98,7 +98,7 @@ void GPSUpdateScheduling::updateLockTimePrediction()
|
|||||||
|
|
||||||
// Ignore the first lock-time: likely to be long, will skew data
|
// Ignore the first lock-time: likely to be long, will skew data
|
||||||
|
|
||||||
// Second locktime: likely stable. Use to intialize the smoothing filter
|
// Second locktime: likely stable. Use to initialize the smoothing filter
|
||||||
if (searchCount == 1)
|
if (searchCount == 1)
|
||||||
predictedMsToGetLock = lockTime;
|
predictedMsToGetLock = lockTime;
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ void GPSUpdateScheduling::updateLockTimePrediction()
|
|||||||
else if (searchCount > 1)
|
else if (searchCount > 1)
|
||||||
predictedMsToGetLock = (lockTime * weighting) + (predictedMsToGetLock * (1 - weighting));
|
predictedMsToGetLock = (lockTime * weighting) + (predictedMsToGetLock * (1 - weighting));
|
||||||
|
|
||||||
searchCount++; // Only tracked so we can diregard initial lock-times
|
searchCount++; // Only tracked so we can disregard initial lock-times
|
||||||
|
|
||||||
LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000);
|
LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ the PM config. Lets try without it.
|
|||||||
PMREQ sort of works with SBAS, but the awake time is too short to re-acquire any SBAS sats.
|
PMREQ sort of works with SBAS, but the awake time is too short to re-acquire any SBAS sats.
|
||||||
The defination of "Got Fix" doesn't seem to include SBAS. Much more too this...
|
The defination of "Got Fix" doesn't seem to include SBAS. Much more too this...
|
||||||
Even if it was, it can take minutes (up to 12.5),
|
Even if it was, it can take minutes (up to 12.5),
|
||||||
even under good sat visability conditions to re-acquire the SBAS data.
|
even under good sat visibility conditions to re-acquire the SBAS data.
|
||||||
|
|
||||||
Another effect fo the quick transition to sleep is that no other sats will be acquired so the
|
Another effect fo the quick transition to sleep is that no other sats will be acquired so the
|
||||||
sat count will tend to remain at what the initial fix was.
|
sat count will tend to remain at what the initial fix was.
|
||||||
|
@ -59,7 +59,7 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
// If: "no messages added" alert screen currently shown
|
// If: "no messages added" alert screen currently shown
|
||||||
if (alertingNoMessage) {
|
if (alertingNoMessage) {
|
||||||
// Dismiss the alert screen several seconds after it appears
|
// Dismiss the alert screen several seconds after it appears
|
||||||
if (now > alertingSinceMs + durationAlertMs) {
|
if (!Throttle::isWithinTimespanMs(alertingSinceMs, durationAlertMs)) {
|
||||||
alertingNoMessage = false;
|
alertingNoMessage = false;
|
||||||
screen->endAlert();
|
screen->endAlert();
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
|
|
||||||
// Existing press
|
// Existing press
|
||||||
else {
|
else {
|
||||||
// Duration enough for long press
|
// Longer than shortpress window
|
||||||
// Long press not yet fired (prevent repeat firing while held)
|
// Long press not yet fired (prevent repeat firing while held)
|
||||||
if (!longPressFired && Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) {
|
if (!longPressFired && !Throttle::isWithinTimespanMs(downSinceMs, durationLongMs)) {
|
||||||
longPressFired = true;
|
longPressFired = true;
|
||||||
longPress();
|
longPress();
|
||||||
}
|
}
|
||||||
@ -91,7 +91,9 @@ int32_t ScanAndSelectInput::runOnce()
|
|||||||
// Button newly released
|
// Button newly released
|
||||||
// Long press event didn't already fire
|
// Long press event didn't already fire
|
||||||
if (held && !longPressFired) {
|
if (held && !longPressFired) {
|
||||||
// Duration enough for short press
|
// Duration within shortpress window
|
||||||
|
// - longer than durationShortPress (debounce)
|
||||||
|
// - shorter than durationLongPress
|
||||||
if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) {
|
if (!Throttle::isWithinTimespanMs(downSinceMs, durationShortMs)) {
|
||||||
shortPress();
|
shortPress();
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ bool Channels::decryptForHash(ChannelIndex chIndex, ChannelHash channelHash)
|
|||||||
*
|
*
|
||||||
* This method is called before encoding outbound packets
|
* This method is called before encoding outbound packets
|
||||||
*
|
*
|
||||||
* @eturn the (0 to 255) hash for that channel - if no suitable channel could be found, return -1
|
* @return the (0 to 255) hash for that channel - if no suitable channel could be found, return -1
|
||||||
*/
|
*/
|
||||||
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
|
int16_t Channels::setActiveByIndex(ChannelIndex channelIndex)
|
||||||
{
|
{
|
||||||
|
@ -161,11 +161,6 @@ template <typename T> bool LR11x0Interface<T>::reconfigure()
|
|||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
|
||||||
|
|
||||||
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
|
|
||||||
// TODO: Confirm gain registers are okay now
|
|
||||||
// err = lora.setRxGain(true);
|
|
||||||
// assert(err == RADIOLIB_ERR_NONE);
|
|
||||||
|
|
||||||
err = lora.setSyncWord(syncWord);
|
err = lora.setSyncWord(syncWord);
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ MeshModule::~MeshModule()
|
|||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex,
|
meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex,
|
||||||
uint8_t hopStart, uint8_t hopLimit)
|
uint8_t hopLimit)
|
||||||
{
|
{
|
||||||
meshtastic_Routing c = meshtastic_Routing_init_default;
|
meshtastic_Routing c = meshtastic_Routing_init_default;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, Nod
|
|||||||
|
|
||||||
p->priority = meshtastic_MeshPacket_Priority_ACK;
|
p->priority = meshtastic_MeshPacket_Priority_ACK;
|
||||||
|
|
||||||
p->hop_limit = routingModule->getHopLimitForResponse(hopStart, hopLimit); // Flood ACK back to original sender
|
p->hop_limit = hopLimit; // Flood ACK back to original sender
|
||||||
p->to = to;
|
p->to = to;
|
||||||
p->decoded.request_id = idFrom;
|
p->decoded.request_id = idFrom;
|
||||||
p->channel = chIndex;
|
p->channel = chIndex;
|
||||||
@ -181,8 +181,8 @@ void MeshModule::callModules(meshtastic_MeshPacket &mp, RxSource src)
|
|||||||
// SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded)
|
// SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded)
|
||||||
// but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs
|
// but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs
|
||||||
// bad.
|
// bad.
|
||||||
routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel, mp.hop_start,
|
routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel,
|
||||||
mp.hop_limit);
|
routingModule->getHopLimitForResponse(mp.hop_start, mp.hop_limit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class MeshModule
|
|||||||
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() { return NULL; }
|
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() { return NULL; }
|
||||||
|
|
||||||
meshtastic_MeshPacket *allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex,
|
meshtastic_MeshPacket *allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex,
|
||||||
uint8_t hopStart = 0, uint8_t hopLimit = 0);
|
uint8_t hopLimit = 0);
|
||||||
|
|
||||||
/// Send an error response for the specified packet.
|
/// Send an error response for the specified packet.
|
||||||
meshtastic_MeshPacket *allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p);
|
meshtastic_MeshPacket *allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p);
|
||||||
|
@ -138,11 +138,12 @@ NodeDB::NodeDB()
|
|||||||
memcpy(myNodeInfo.device_id.bytes, &device_id_start, sizeof(device_id_start));
|
memcpy(myNodeInfo.device_id.bytes, &device_id_start, sizeof(device_id_start));
|
||||||
memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end));
|
memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end));
|
||||||
myNodeInfo.device_id.size = 16;
|
myNodeInfo.device_id.size = 16;
|
||||||
hasUniqueId = true;
|
// Uncomment below to print the device id
|
||||||
|
// hasUniqueId = true;
|
||||||
#else
|
#else
|
||||||
// FIXME - implement for other platforms
|
// FIXME - implement for other platforms
|
||||||
#endif
|
#endif
|
||||||
// Uncomment below to print the device id
|
|
||||||
// if (hasUniqueId) {
|
// if (hasUniqueId) {
|
||||||
// std::string deviceIdHex;
|
// std::string deviceIdHex;
|
||||||
// for (size_t i = 0; i < myNodeInfo.device_id.size; ++i) {
|
// for (size_t i = 0; i < myNodeInfo.device_id.size; ++i) {
|
||||||
|
@ -38,6 +38,13 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
|
|||||||
seenRecently = false;
|
seenRecently = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the original transmitter is doing retransmissions (hopStart equals hopLimit) for a reliable transmission, e.g., when the
|
||||||
|
ACK got lost, we will handle the packet again to make sure it gets an ACK/response to its packet. */
|
||||||
|
if (seenRecently && p->hop_start > 0 && p->hop_start == p->hop_limit) {
|
||||||
|
LOG_DEBUG("Repeated reliable tx");
|
||||||
|
seenRecently = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (seenRecently) {
|
if (seenRecently) {
|
||||||
LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x", p->from, p->to, p->id);
|
LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x", p->from, p->to, p->id);
|
||||||
}
|
}
|
||||||
|
@ -607,10 +607,13 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
|||||||
{
|
{
|
||||||
printPacket("PACKET FROM PHONE", &p);
|
printPacket("PACKET FROM PHONE", &p);
|
||||||
|
|
||||||
|
// For use with the simulator, we should not ignore duplicate packets
|
||||||
|
#if !(defined(ARCH_PORTDUINO) && !HAS_RADIO)
|
||||||
if (p.id > 0 && wasSeenRecently(p.id)) {
|
if (p.id > 0 && wasSeenRecently(p.id)) {
|
||||||
LOG_DEBUG("Ignoring packet from phone, already seen recently");
|
LOG_DEBUG("Ignoring packet from phone, already seen recently");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) {
|
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) {
|
||||||
|
@ -140,7 +140,7 @@ const RegionInfo regions[] = {
|
|||||||
Philippines
|
Philippines
|
||||||
433 - 434.7 MHz <10 mW erp, NTC approved device required
|
433 - 434.7 MHz <10 mW erp, NTC approved device required
|
||||||
868 - 869.4 MHz <25 mW erp, NTC approved device required
|
868 - 869.4 MHz <25 mW erp, NTC approved device required
|
||||||
915 - 918 MHz <250 mW EIRP, no external antennna allowed
|
915 - 918 MHz <250 mW EIRP, no external antenna allowed
|
||||||
https://github.com/meshtastic/firmware/issues/4948#issuecomment-2394926135
|
https://github.com/meshtastic/firmware/issues/4948#issuecomment-2394926135
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#include "PortduinoGlue.h"
|
||||||
|
#include "meshUtils.h"
|
||||||
|
#endif
|
||||||
void LockingArduinoHal::spiBeginTransaction()
|
void LockingArduinoHal::spiBeginTransaction()
|
||||||
{
|
{
|
||||||
spiLock->lock();
|
spiLock->lock();
|
||||||
@ -278,13 +282,16 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||||||
// Send any outgoing packets we have ready
|
// Send any outgoing packets we have ready
|
||||||
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
||||||
assert(txp);
|
assert(txp);
|
||||||
|
bool isLoraTx = txp->to != NODENUM_BROADCAST_NO_LORA;
|
||||||
startSend(txp);
|
startSend(txp);
|
||||||
|
|
||||||
|
if (isLoraTx) {
|
||||||
// Packet has been sent, count it toward our TX airtime utilization.
|
// Packet has been sent, count it toward our TX airtime utilization.
|
||||||
uint32_t xmitMsec = getPacketTime(txp);
|
uint32_t xmitMsec = getPacketTime(txp);
|
||||||
airTime->logAirtime(TX_LOG, xmitMsec);
|
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// LOG_DEBUG("done with txqueue");
|
// LOG_DEBUG("done with txqueue");
|
||||||
}
|
}
|
||||||
@ -341,7 +348,7 @@ void RadioLibInterface::handleTransmitInterrupt()
|
|||||||
// ignore the transmit interrupt
|
// ignore the transmit interrupt
|
||||||
if (sendingPacket)
|
if (sendingPacket)
|
||||||
completeSending();
|
completeSending();
|
||||||
powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // But our transmitter is deffinitely off now
|
powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // But our transmitter is definitely off now
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioLibInterface::completeSending()
|
void RadioLibInterface::completeSending()
|
||||||
@ -390,6 +397,11 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int state = iface->readData((uint8_t *)&radioBuffer, length);
|
int state = iface->readData((uint8_t *)&radioBuffer, length);
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
if (settingsMap[logoutputlevel] == level_trace) {
|
||||||
|
printBytes("Raw incoming packet: ", (uint8_t *)&radioBuffer, length);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (state != RADIOLIB_ERR_NONE) {
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
LOG_ERROR("ignoring received packet due to error=%d", state);
|
LOG_ERROR("ignoring received packet due to error=%d", state);
|
||||||
rxBad++;
|
rxBad++;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "concurrency/NotifiedWorkerThread.h"
|
#include "concurrency/NotifiedWorkerThread.h"
|
||||||
|
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
// ESP32 has special rules about ISR code
|
// ESP32 has special rules about ISR code
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "ReliableRouter.h"
|
#include "ReliableRouter.h"
|
||||||
#include "Default.h"
|
#include "Default.h"
|
||||||
#include "MeshModule.h"
|
|
||||||
#include "MeshTypes.h"
|
#include "MeshTypes.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "modules/NodeInfoModule.h"
|
#include "modules/NodeInfoModule.h"
|
||||||
|
#include "modules/RoutingModule.h"
|
||||||
|
|
||||||
// ReliableRouter::ReliableRouter() {}
|
// ReliableRouter::ReliableRouter() {}
|
||||||
|
|
||||||
@ -73,18 +73,6 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||||||
i->second.nextTxMsec += iface->getPacketTime(p);
|
i->second.nextTxMsec += iface->getPacketTime(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resend implicit ACKs for repeated packets (hopStart equals hopLimit);
|
|
||||||
* this way if an implicit ACK is dropped and a packet is resent we'll rebroadcast again.
|
|
||||||
* Resending real ACKs is omitted, as you might receive a packet multiple times due to flooding and
|
|
||||||
* flooding this ACK back to the original sender already adds redundancy. */
|
|
||||||
bool isRepeated = p->hop_start == 0 ? (p->hop_limit == HOP_RELIABLE) : (p->hop_start == p->hop_limit);
|
|
||||||
if (wasSeenRecently(p, false) && isRepeated && !MeshModule::currentReply && !isToUs(p)) {
|
|
||||||
LOG_DEBUG("Resending implicit ack for a repeated floodmsg");
|
|
||||||
meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p);
|
|
||||||
tosend->hop_limit--; // bump down the hop count
|
|
||||||
Router::send(tosend);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FloodingRouter::shouldFilterReceived(p);
|
return FloodingRouter::shouldFilterReceived(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,16 +95,22 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||||||
if (MeshModule::currentReply) {
|
if (MeshModule::currentReply) {
|
||||||
LOG_DEBUG("Another module replied to this message, no need for 2nd ack");
|
LOG_DEBUG("Another module replied to this message, no need for 2nd ack");
|
||||||
} else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
} else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, p->hop_start, p->hop_limit);
|
// A response may be set to want_ack for retransmissions, but we don't need to ACK a response if it received an
|
||||||
|
// implicit ACK already. If we received it directly, only ACK with a hop limit of 0
|
||||||
|
if (!p->decoded.request_id)
|
||||||
|
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel,
|
||||||
|
routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit));
|
||||||
|
else if (p->hop_start > 0 && p->hop_start == p->hop_limit)
|
||||||
|
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0);
|
||||||
} else if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag && p->channel == 0 &&
|
} else if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag && p->channel == 0 &&
|
||||||
(nodeDB->getMeshNode(p->from) == nullptr || nodeDB->getMeshNode(p->from)->user.public_key.size == 0)) {
|
(nodeDB->getMeshNode(p->from) == nullptr || nodeDB->getMeshNode(p->from)->user.public_key.size == 0)) {
|
||||||
LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY");
|
LOG_INFO("PKI packet from unknown node, send PKI_UNKNOWN_PUBKEY");
|
||||||
sendAckNak(meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY, getFrom(p), p->id, channels.getPrimaryIndex(),
|
sendAckNak(meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY, getFrom(p), p->id, channels.getPrimaryIndex(),
|
||||||
p->hop_start, p->hop_limit);
|
routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit));
|
||||||
} else {
|
} else {
|
||||||
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
||||||
sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex(), p->hop_start,
|
sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex(),
|
||||||
p->hop_limit);
|
routingModule->getHopLimitForResponse(p->hop_start, p->hop_limit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && c &&
|
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && c &&
|
||||||
@ -224,7 +218,7 @@ int32_t ReliableRouter::doRetransmissions()
|
|||||||
|
|
||||||
bool stillValid = true; // assume we'll keep this record around
|
bool stillValid = true; // assume we'll keep this record around
|
||||||
|
|
||||||
// FIXME, handle 51 day rolloever here!!!
|
// FIXME, handle 51 day rollover here!!!
|
||||||
if (p.nextTxMsec <= now) {
|
if (p.nextTxMsec <= now) {
|
||||||
if (p.numRetransmissions == 0) {
|
if (p.numRetransmissions == 0) {
|
||||||
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to,
|
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An identifier for a globalally unique message - a pair of the sending nodenum and the packet id assigned
|
* An identifier for a globally unique message - a pair of the sending nodenum and the packet id assigned
|
||||||
* to that message
|
* to that message
|
||||||
*/
|
*/
|
||||||
struct GlobalPacketId {
|
struct GlobalPacketId {
|
||||||
|
@ -81,14 +81,17 @@ int32_t Router::runOnce()
|
|||||||
*/
|
*/
|
||||||
void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p)
|
void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
if (fromRadioQueue.enqueue(p, 0)) { // NOWAIT - fixme, if queue is full, delete older messages
|
// Try enqueue until successful
|
||||||
|
while (!fromRadioQueue.enqueue(p, 0)) {
|
||||||
|
meshtastic_MeshPacket *old_p;
|
||||||
|
old_p = fromRadioQueue.dequeuePtr(0); // Dequeue and discard the oldest packet
|
||||||
|
if (old_p) {
|
||||||
|
printPacket("fromRadioQ full, drop oldest!", old_p);
|
||||||
|
packetPool.release(old_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Nasty hack because our threading is primitive. interfaces shouldn't need to know about routers FIXME
|
// Nasty hack because our threading is primitive. interfaces shouldn't need to know about routers FIXME
|
||||||
setReceivedMessage();
|
setReceivedMessage();
|
||||||
} else {
|
|
||||||
printPacket("BUG! fromRadioQueue is full! Discarding!", p);
|
|
||||||
packetPool.release(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate a unique packet id
|
/// Generate a unique packet id
|
||||||
@ -133,10 +136,9 @@ meshtastic_MeshPacket *Router::allocForSending()
|
|||||||
/**
|
/**
|
||||||
* Send an ack or a nak packet back towards whoever sent idFrom
|
* Send an ack or a nak packet back towards whoever sent idFrom
|
||||||
*/
|
*/
|
||||||
void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart,
|
void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit)
|
||||||
uint8_t hopLimit)
|
|
||||||
{
|
{
|
||||||
routingModule->sendAckNak(err, to, idFrom, chIndex, hopStart, hopLimit);
|
routingModule->sendAckNak(err, to, idFrom, chIndex, hopLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
|
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
|
||||||
@ -423,7 +425,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return 0 for success or a Routing_Errror code for failure
|
/** Return 0 for success or a Routing_Error code for failure
|
||||||
*/
|
*/
|
||||||
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
@ -108,8 +108,7 @@ class Router : protected concurrency::OSThread
|
|||||||
/**
|
/**
|
||||||
* Send an ack or a nak packet back towards whoever sent idFrom
|
* Send an ack or a nak packet back towards whoever sent idFrom
|
||||||
*/
|
*/
|
||||||
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart = 0,
|
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0);
|
||||||
uint8_t hopLimit = 0);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -132,7 +131,7 @@ class Router : protected concurrency::OSThread
|
|||||||
*/
|
*/
|
||||||
void handleReceived(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
void handleReceived(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO);
|
||||||
|
|
||||||
/** Frees the provided packet, and generates a NAK indicating the speicifed error while sending */
|
/** Frees the provided packet, and generates a NAK indicating the specifed error while sending */
|
||||||
void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p);
|
void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ class Router : protected concurrency::OSThread
|
|||||||
*/
|
*/
|
||||||
bool perhapsDecode(meshtastic_MeshPacket *p);
|
bool perhapsDecode(meshtastic_MeshPacket *p);
|
||||||
|
|
||||||
/** Return 0 for success or a Routing_Errror code for failure
|
/** Return 0 for success or a Routing_Error code for failure
|
||||||
*/
|
*/
|
||||||
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p);
|
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||||||
|
|
||||||
// Overriding current limit
|
// Overriding current limit
|
||||||
// (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using
|
// (https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.cpp#L85) using
|
||||||
// value in SX126xInterface.h (currently 140 mA) It may or may not be neccessary, depending on how RadioLib functions, from
|
// value in SX126xInterface.h (currently 140 mA) It may or may not be necessary, depending on how RadioLib functions, from
|
||||||
// SX1261/2 datasheet: OCP after setting DeviceSel with SetPaConfig(): SX1261 - 60 mA, SX1262 - 140 mA For the SX1268 the IC
|
// SX1261/2 datasheet: OCP after setting DeviceSel with SetPaConfig(): SX1261 - 60 mA, SX1262 - 140 mA For the SX1268 the IC
|
||||||
// defaults to 140mA no matter the set power level, but RadioLib set it lower, this would need further checking Default values
|
// defaults to 140mA no matter the set power level, but RadioLib set it lower, this would need further checking Default values
|
||||||
// are: SX1262, SX1268: 0x38 (140 mA), SX1261: 0x18 (60 mA)
|
// are: SX1262, SX1268: 0x38 (140 mA), SX1261: 0x18 (60 mA)
|
||||||
|
@ -408,7 +408,7 @@ typedef enum _meshtastic_LogRecord_Level {
|
|||||||
} meshtastic_LogRecord_Level;
|
} meshtastic_LogRecord_Level;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
/* a gps position */
|
/* A GPS Position */
|
||||||
typedef struct _meshtastic_Position {
|
typedef struct _meshtastic_Position {
|
||||||
/* The new preferred location encoding, multiply by 1e-7 to get degrees
|
/* The new preferred location encoding, multiply by 1e-7 to get degrees
|
||||||
in floating point */
|
in floating point */
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
@ -14,8 +13,6 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
|||||||
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
||||||
if (!pb_encode(&stream, fields, src_struct)) {
|
if (!pb_encode(&stream, fields, src_struct)) {
|
||||||
LOG_ERROR("Panic: can't encode protobuf reason='%s'", PB_GET_ERROR(&stream));
|
LOG_ERROR("Panic: can't encode protobuf reason='%s'", PB_GET_ERROR(&stream));
|
||||||
assert(
|
|
||||||
0); // If this assert fails it probably means you made a field too large for the max limits specified in mesh.options
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return stream.bytes_written;
|
return stream.bytes_written;
|
||||||
|
@ -61,7 +61,6 @@ char *strnstr(const char *s, const char *find, size_t slen)
|
|||||||
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||||
{
|
{
|
||||||
int labelSize = strlen(label);
|
int labelSize = strlen(label);
|
||||||
if (labelSize < 100 && numbytes < 64) {
|
|
||||||
char *messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
char *messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||||
strncpy(messageBuffer, label, labelSize);
|
strncpy(messageBuffer, label, labelSize);
|
||||||
for (size_t i = 0; i < numbytes; i++)
|
for (size_t i = 0; i < numbytes; i++)
|
||||||
@ -69,7 +68,6 @@ void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
|||||||
strcpy(messageBuffer + labelSize + numbytes * 3, "\n");
|
strcpy(messageBuffer + labelSize + numbytes * 3, "\n");
|
||||||
LOG_DEBUG(messageBuffer);
|
LOG_DEBUG(messageBuffer);
|
||||||
delete[] messageBuffer;
|
delete[] messageBuffer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
|
@ -121,14 +121,12 @@ Will be used for broadcast.
|
|||||||
*/
|
*/
|
||||||
int32_t NeighborInfoModule::runOnce()
|
int32_t NeighborInfoModule::runOnce()
|
||||||
{
|
{
|
||||||
if (airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) {
|
|
||||||
sendNeighborInfo(NODENUM_BROADCAST_NO_LORA, false);
|
sendNeighborInfo(NODENUM_BROADCAST_NO_LORA, false);
|
||||||
}
|
|
||||||
return Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval, default_neighbor_info_broadcast_secs);
|
return Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval, default_neighbor_info_broadcast_secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Collect a recieved neighbor info packet from another node
|
Collect a received neighbor info packet from another node
|
||||||
Pass it to an upper client; do not persist this data on the mesh
|
Pass it to an upper client; do not persist this data on the mesh
|
||||||
*/
|
*/
|
||||||
bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_NeighborInfo *np)
|
bool NeighborInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_NeighborInfo *np)
|
||||||
|
@ -49,10 +49,9 @@ meshtastic_MeshPacket *RoutingModule::allocReply()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart,
|
void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit)
|
||||||
uint8_t hopLimit)
|
|
||||||
{
|
{
|
||||||
auto p = allocAckNak(err, to, idFrom, chIndex, hopStart, hopLimit);
|
auto p = allocAckNak(err, to, idFrom, chIndex, hopLimit);
|
||||||
|
|
||||||
router->sendLocal(p); // we sometimes send directly to the local node
|
router->sendLocal(p); // we sometimes send directly to the local node
|
||||||
}
|
}
|
||||||
@ -78,7 +77,7 @@ RoutingModule::RoutingModule() : ProtobufModule("routing", meshtastic_PortNum_RO
|
|||||||
{
|
{
|
||||||
isPromiscuous = true;
|
isPromiscuous = true;
|
||||||
|
|
||||||
// moved the ReboradcastMode logic into handleReceivedProtobuf
|
// moved the RebroadcastMode logic into handleReceivedProtobuf
|
||||||
// LocalOnly requires either the from or to to be a known node
|
// LocalOnly requires either the from or to to be a known node
|
||||||
// knownOnly specifically requires the from to be a known node.
|
// knownOnly specifically requires the from to be a known node.
|
||||||
encryptedOk = true;
|
encryptedOk = true;
|
||||||
|
@ -13,8 +13,7 @@ class RoutingModule : public ProtobufModule<meshtastic_Routing>
|
|||||||
*/
|
*/
|
||||||
RoutingModule();
|
RoutingModule();
|
||||||
|
|
||||||
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopStart = 0,
|
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0);
|
||||||
uint8_t hopLimit = 0);
|
|
||||||
|
|
||||||
// Given the hopStart and hopLimit upon reception of a request, return the hop limit to use for the response
|
// Given the hopStart and hopLimit upon reception of a request, return the hop limit to use for the response
|
||||||
uint8_t getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit);
|
uint8_t getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit);
|
||||||
|
@ -315,7 +315,7 @@ ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp
|
|||||||
// LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s",
|
// LOG_DEBUG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s",
|
||||||
// nodeDB->getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
// nodeDB->getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
||||||
|
|
||||||
if (!isFromUs(&mp)) {
|
if (isFromUs(&mp)) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If moduleConfig.serial.echo is true, then echo the packets that are sent out
|
* If moduleConfig.serial.echo is true, then echo the packets that are sent out
|
||||||
@ -532,7 +532,7 @@ void SerialModule::processWXSerial()
|
|||||||
batVoltageF, capVoltageF, temperatureF);
|
batVoltageF, capVoltageF, temperatureF);
|
||||||
}
|
}
|
||||||
if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) {
|
if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) {
|
||||||
// calulate averages and send to the mesh
|
// calculate averages and send to the mesh
|
||||||
float velAvg = 1.0 * velSum / velCount;
|
float velAvg = 1.0 * velSum / velCount;
|
||||||
|
|
||||||
double avgSin = dir_sum_sin / dirCount;
|
double avgSin = dir_sum_sin / dirCount;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "UnitConversions.h"
|
#include "UnitConversions.h"
|
||||||
|
|
||||||
float UnitConversions::CelsiusToFahrenheit(float celcius)
|
float UnitConversions::CelsiusToFahrenheit(float celsius)
|
||||||
{
|
{
|
||||||
return (celcius * 9) / 5 + 32;
|
return (celsius * 9) / 5 + 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
float UnitConversions::MetersPerSecondToKnots(float metersPerSecond)
|
float UnitConversions::MetersPerSecondToKnots(float metersPerSecond)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class UnitConversions
|
class UnitConversions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static float CelsiusToFahrenheit(float celcius);
|
static float CelsiusToFahrenheit(float celsius);
|
||||||
static float MetersPerSecondToKnots(float metersPerSecond);
|
static float MetersPerSecondToKnots(float metersPerSecond);
|
||||||
static float MetersPerSecondToMilesPerHour(float metersPerSecond);
|
static float MetersPerSecondToMilesPerHour(float metersPerSecond);
|
||||||
static float HectoPascalToInchesOfMercury(float hectoPascal);
|
static float HectoPascalToInchesOfMercury(float hectoPascal);
|
||||||
|
@ -12,7 +12,7 @@ bool LSM6DS3Sensor::init()
|
|||||||
// Default threshold of 2G, less sensitive options are 4, 8 or 16G
|
// Default threshold of 2G, less sensitive options are 4, 8 or 16G
|
||||||
sensor.setAccelRange(LSM6DS_ACCEL_RANGE_2_G);
|
sensor.setAccelRange(LSM6DS_ACCEL_RANGE_2_G);
|
||||||
|
|
||||||
// Duration is number of occurances needed to trigger, higher threshold is less sensitive
|
// Duration is number of occurrences needed to trigger, higher threshold is less sensitive
|
||||||
sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH);
|
sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH);
|
||||||
|
|
||||||
LOG_DEBUG("LSM6DS3Sensor::init ok");
|
LOG_DEBUG("LSM6DS3Sensor::init ok");
|
||||||
|
@ -51,7 +51,11 @@ void updateBatteryLevel(uint8_t level) {}
|
|||||||
|
|
||||||
void getMacAddr(uint8_t *dmac)
|
void getMacAddr(uint8_t *dmac)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_IDF_TARGET_ESP32C6) && defined(CONFIG_SOC_IEEE802154_SUPPORTED)
|
||||||
|
assert(esp_base_mac_addr_get(dmac) == ESP_OK);
|
||||||
|
#else
|
||||||
assert(esp_efuse_mac_get_default(dmac) == ESP_OK);
|
assert(esp_efuse_mac_get_default(dmac) == ESP_OK);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_32768HZ
|
#ifdef HAS_32768HZ
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "../mesh/generated/meshtastic/paxcount.pb.h"
|
#include "../mesh/generated/meshtastic/paxcount.pb.h"
|
||||||
#endif
|
#endif
|
||||||
#include "mesh/generated/meshtastic/remote_hardware.pb.h"
|
#include "mesh/generated/meshtastic/remote_hardware.pb.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, bool shouldLog)
|
std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, bool shouldLog)
|
||||||
{
|
{
|
||||||
|
@ -287,7 +287,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
|||||||
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
||||||
// leave floating input for the IRQ line
|
// leave floating input for the IRQ line
|
||||||
// If we want to leave the radio receiving in would be 11.5mA current draw, but most of the time it is just waiting
|
// If we want to leave the radio receiving in would be 11.5mA current draw, but most of the time it is just waiting
|
||||||
// in its sequencer (true?) so the average power draw should be much lower even if we were listinging for packets
|
// in its sequencer (true?) so the average power draw should be much lower even if we were listening for packets
|
||||||
// all the time.
|
// all the time.
|
||||||
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
// never tries to go to sleep if the user is using the API
|
// never tries to go to sleep if the user is using the API
|
||||||
// gpio_wakeup_enable((gpio_num_t)SERIAL0_RX_GPIO, GPIO_INTR_LOW_LEVEL);
|
// gpio_wakeup_enable((gpio_num_t)SERIAL0_RX_GPIO, GPIO_INTR_LOW_LEVEL);
|
||||||
|
|
||||||
// doesn't help - I think the USB-UART chip losing power is pulling the signal llow
|
// doesn't help - I think the USB-UART chip losing power is pulling the signal low
|
||||||
// gpio_pullup_en((gpio_num_t)SERIAL0_RX_GPIO);
|
// gpio_pullup_en((gpio_num_t)SERIAL0_RX_GPIO);
|
||||||
|
|
||||||
// alas - can only work if using the refclock, which is limited to about 9600 bps
|
// alas - can only work if using the refclock, which is limited to about 9600 bps
|
||||||
|
@ -19,4 +19,3 @@ static const uint8_t MOSI = 38;
|
|||||||
static const uint8_t SS = 17;
|
static const uint8_t SS = 17;
|
||||||
|
|
||||||
#endif /* Pins_Arduino_h */
|
#endif /* Pins_Arduino_h */
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 5
|
minor = 5
|
||||||
build = 9
|
build = 11
|
||||||
|
Loading…
Reference in New Issue
Block a user