Commit Graph

964 Commits

Author SHA1 Message Date
AtlavoxDev e5dab6b999 Rename bootComplete() to onBootComplete() for naming consistency
Matches the existing event-style lifecycle hooks on MainBoard
(onBeforeTransmit, onAfterTransmit) per @liamcottle's review feedback.
2026-05-25 09:50:28 -04:00
AtlavoxDev 39a69b86c3 Add MainBoard::bootComplete() hook for boot-indicator LED feedback
Framework for upcoming variant-specific PRs that add LED feedback during boot. The hook gives users visual cues that the device is busy and
shouldn't be interacted with until startup completes.
2026-05-25 09:04:47 -04:00
Rafał Wojdyła eb53c61f17 Respect predefined I2C addresses in EnvironmentSensorManager 2026-05-24 13:16:50 +02:00
fdlamotte 73c7718b9e Merge pull request #2235 from jirogit/fix/lr1110-rxgain-cli-guard
fix: enable radio.rxgain CLI command for LR1110 (T1000-E)
2026-05-24 11:56:23 +02:00
ripplebiz e251dc1659 Merge pull request #2540 from agessaman/feat/regions-quick-loasd
Add bulk region hierarchy command to CLI
2026-05-23 18:37:28 +10:00
Liam Cottle a35b1bbbfd Merge pull request #2590 from jocasmark/fix/typos
Fix typos in comments and docs
2026-05-22 19:38:19 +12:00
agessaman 1296aa7792 Refactor region def with helpers, refine docs
Extract the inline cursor-walk in handleRegionCmd into file-local
helpers (skipSpaces, rtrimSpaces, takeToken, splitNameJump,
processRegionDefSegment), grouped immediately above the consumer.
Behavior is identical; addresses PR #2540 review feedback on
readability.

Tighten the region def docs: collapse five Note callouts into three
grouped paragraphs (Behavior / Existing regions / Limits), add a
case-sensitivity caveat plus an error example, note the cursor reset
between split commands, and use generic placeholder names.
2026-05-21 19:25:01 -07:00
taco 5058415fa3 u8g2 wrapper: allow larger font when size >= 2 2026-05-21 19:58:10 +10:00
pelgraine 2462cf6c97 add wrapper for u8g2 display driver 2026-05-21 19:58:10 +10:00
Huw Duddy bfdceae16e Merge pull request #2443 from kizniche/fix-rxdelay-txdelay
Fix: Enforce upper bounds for rxdelay, txdelay, and direct.txdelay
2026-05-21 16:57:41 +10:00
Scott Powell a130a95a0d * added 6th byte to ACK, with RNG 2026-05-21 00:00:03 +10:00
Mark Jocas 63fe3d42a2 Corrects typos and grammatical errors
Improves readability across documentation and inline comments by fixing common spelling mistakes and duplicate words.
2026-05-20 08:33:48 +02:00
Scott Powell 717142abd6 * bug fix 2026-05-19 17:06:42 +10:00
Scott Powell 2eb747d504 * fix 2026-05-17 22:38:42 +10:00
Scott Powell f6e6fdaa05 * support for sending 5-byte ACKs 2026-05-17 22:10:13 +10:00
agessaman f3c6c34883 Update CLI command from region bulk to region def 2026-05-16 10:47:51 -07:00
Scott Powell c588540b1b * new CMD_SEND_RAW_PACKET 2026-05-13 13:28:56 +10:00
agessaman 19f950018c Add bulk region hierarchy command to CLI
Add a new command `region bulk` for defining region hierarchies in a single line. This command allows users to create multiple regions in a single message. Updated the documentation to include usage examples and detailed parameter descriptions.
2026-05-12 12:08:03 -07:00
Quency-D 6d3b71eed9 add heltec-mesh-node-t1 2026-05-11 15:11:07 +08:00
taco e7e97ec438 add option to disable DS3231 probe 2026-05-10 20:29:47 +10:00
Josiah VanderZee 4b6b8abe7a Add missing Wire.h include for sensors
This slipped through in PR #2327 and I noticed because the TechoBoard.h
for my variant doesn't include the Wire header, so the source file
in question does not coincidentally obtain a copy.
2026-05-07 07:20:48 -05:00
Liam Cottle bf733f00a6 Merge pull request #2488 from weebl2000/fix-rak-pin-gps-en-undefined
Gate PIN_GPS_EN
2026-05-07 18:44:37 +12:00
ripplebiz b75cefbfb4 Merge pull request #2327 from NickDunklee/fix-environment-sensor-refactor
fix(sensors): improve sensor initialization and handling to prevent hangs and handle growth
2026-05-07 15:58:10 +10:00
Wessel Nieboer 3bde089bdb Gate PIN_GPS_EN
Do not reference it unconditionally
2026-05-07 00:31:15 +02:00
Liam Cottle 19ebd8c795 Merge pull request #2480 from KPrivitt/dev
Incorrect time_t TypeDef used in RAK12035_SoilMoisture
2026-05-06 17:46:57 +12:00
Kenneth Privitt 235706a22a Incorrect time_t TypeDef in RAK12035_SoilMoisture 2026-05-05 11:20:36 -07:00
Josiah VanderZee e56c1b3d58 Do not perform redundant reset on ST7789 displays
The `::init` method in the Adafruit ST7789 library is responsible to
initialize the device. This includes performing a reset, which can be
found in the Adafruit source for `Adafruit_SPITFT`.

Before this change, MeshCore performed its own ST7789 display reset
sequence, which consisted of three steps.

* Pull reset low
* Wait 10ms
* Pull reset high

Importantly, there was no fixed delay after pulling reset high. The
ST7789 driver requires a delay (T<sub>RT</sub>) of 5ms in Sleep In Mode
and 120ms in Sleep Out Mode before it will properly receive commands.
When `Adafruit_SPITFT` resets the device after MeshCore has already
reset it, the mandatory time may not have elapsed, leading to strange
behavior. In the author's case, this issue caused the initial
`fillScreen` to fail, such that the display showed an uninitialized
framebuffer.

This removes the MeshCore delay, leaving the responsibility of reset to
`Adafruit_SPITFT`, where they have the correct delays in place with
extra safety margin. The change was briefly tested by Josiah VanderZee
and Ben Zignego on a custom hardware build using an nRF52840 Dongle and
an Adafruit 4311 TFT display. The user button seemed to behave
strangely, but the display looked correct.
2026-05-04 17:01:39 -05:00
Liam Cottle e727fd543b Merge pull request #2462 from meshcore-dev/target-dup-cleanup
Refactor: removed duplicated target code
2026-05-02 17:21:51 +12:00
liamcottle 5a509752a7 don't play startup tune if buzzer pref disabled 2026-05-02 01:47:35 +12:00
jirogit f224a325e6 fix: enable radio.rxgain CLI command for LR1110 (T1000-E)
USE_LR1110 was missing from the preprocessor guard in CommonCLI.cpp,
causing both get and set to fail silently on T1000-E:

- get radio.rxgain returned the full radio config string (fell through
  to the memcmp("radio", 5) branch)
- set radio.rxgain returned "unknown config" (no branch matched)

Fix: add -D USE_LR1110 to variants/t1000-e/platformio.ini and include
USE_LR1110 in the #if guard on both get and set branches.

CustomLR1110Wrapper already implements setRxBoostedGainMode() and
getRxBoostedGainMode() via the RadioLibWrapper virtual interface,
so no radio-layer changes are required.

Tested on T1000-E: get/set/persist all confirmed working.
2026-05-01 00:31:31 -07:00
Scott Powell 0a8a0a4904 * Refactor: removed duplicated radio_rng_seed(), radio_set_params(), radio_set_tx_power() 2026-05-01 14:47:07 +10:00
Liam Cottle 5c651b35a0 Merge pull request #1954 from OverkillFPV/lora-longer-preamble
Lora longer preamble
2026-04-30 22:12:04 +12:00
Kyle db8a002c0e fix: enforce upper bounds for rxdelay, txdelay, and direct.txdelay in CLI 2026-04-29 13:26:26 -04:00
Scott Powell 3d982711a6 * CommonCLI: more reply bounds checking 2026-04-21 12:12:47 +10:00
Scott Powell db7baa7bd7 * CommonCLI: bounds check added to "unknown config:" replies 2026-04-21 12:07:39 +10:00
Scott Powell 49b37d5622 * minor bounds fix 2026-04-18 21:32:41 +10:00
Nick Dunklee c7be216f27 fix(sensors): improve sensor initialization and handling to prevent hangs and handle growth
This is a medium-ish refactor to attempt to clean up sensor handling logic both for board stability and future potential growth before the code becomes all spaghetti and meatballs.

I'd be curious to see if anyone running sensors out there that knows how to build and flash MeshCore code could give this a try and see how it behaves. It is working fine on my end on multiple nodes.

PR notes are gigantic because it is a fundamental behavior repair for sensors, so I wanted to over-explain. Also, if it hadn't been mentioned previously, push-back is always welcome. I'm just spending my time trying to clean up / fix / enhance this corner of the firmware, and want to contribute my improvements back to the project.

**Problem:**

Current MeshCore code makes no attempt to see what sensors are actually available on the I2C bus at startup and blindly tries to interact with sensors. This has some very bad side-effects, like if a sensor that is unsupported, or has a weird initialization process, the MeshCore node will just hang at boot and never successfully start up and ostensibly looks bricked, or the INA226 and SHT4X both sharing the same address and the code just silently fighting.

The current implementation also gloms sensor readouts from the MCU and environment sensors onto the same telemetry channel, with some arbitrary exceptions for incrementing channels based on certain behavioral situations. The MCU temperature and external temperature sensors would appear on channel 1, and it wouldn't be possible to tell which sensor the temperature value was coming from.

Per [CayenneLPP](https://github.com/myDevicesIoT/CayenneLPP): *Data Channel: Uniquely identifies each sensor in the device across frames, eg. “indoor sensor”* So this channel division implementation falls inline with what CayenneLPP intended. There are up to 256 channels available. So I tried to model this change in that behavioral style.

**Proposed Improvement:**

This implementation scans the I2C bus for what devices are present, sets each sensor to its own CayenneLPP channel, and keeps MCU telemetry on channel 1 only. So Channel 1 is always "self" and no confusion can result.

Details:
  - Channel 1 is always the MCU and things about it, so you always know that telemetry is from the board itself. Exception is GPS, GPS stays on channel 1 as well since it is "about the board" even though it's a bit gray-area as GPS can often be a secondary chip.
  - Each sensor board is allocated to a dedicated CayenneLPP channel, so if you are reading from that channel, you know the data is from that sensor only. (Sensors emitting more than one of the same type of measurement are exceptions.)
  - `scanI2CBus()` probes addresses 0x08–0x77 with raw `beginTransmission`/`endTransmission`. No sensor library is touched until after this completes. This will prevent sensor-based boot hangs, unknown or unresponsive devices never reach a library init call.
  - Created `SENSOR_TABLE` a compile-time array that is gated by the existing `ENV_INCLUDE_*` macros. A sentinel `{ 0, nullptr, nullptr, nullptr }` at the end keeps the array non-empty regardless of which sensors are enabled, avoiding zero-length array warnings.
  - When `begin()` is called, scan first, then loop: skip if address not detected, skip if `init()` returns 0, otherwise register one ActiveSensor entry per sub-channel.
  - `querySensors()` I replaced the entire #ifdef chain with a 3-line loop.
  - T1000-E has its own T1000SensorManager, so it should be completely unaffected by this change.
  - SHT4X quirky initialization behavior is retained.
  - MLX90614  - git commits around this didn't have any notes as to why it is reporting ambient temperature on a separate channel as well as the object temperature, as the ambient temperature is used internally to compute the object temperature and not really needed for the sensor's purpose - just the same, kept the existing behavior of reporting the ambient temperature one channel above the channel assigned to the sensor
  - All `bool *_initialized` fields are gone, replaced with `ActiveSensor _active_sensors[16]` (query function pointer and sub-channel index) and `_active_sensor_count. SensorDef` lives entirely in the `.cpp` so the header has no dependency on it.
  - Details on the INA226 and SHT4X: both default to address 0x44, the old code had a bug and would have both begin() calls fire and they would just fight each other silently. In the new code, the respective sensor code is only called if the device is actually present, however, if both were present simultaneously, SHT4X comes first in the table and would win, and INA226 would return false and be skipped. The INA226 has 16 possible addresses that are configurable in the hardware itself, so in a potential scenario where both sensors would be present, the person implementing that design could take that into account.
  - BME680 gas resistance will now transmit on the same channel as the rest of BME680 telemetry which is inline with CayenneLPP standards. Coupling this PR with https://github.com/meshcore-dev/MeshCore/pull/2146 streamline the whole sensor telemetry, and with https://github.com/meshcore-dev/MeshCore/pull/2149 will overall improve BME680 handling. The gas resistance sensor actually has a binary library to make it more useful, calibration, accounting for age of sensor, and other improvements, but since that adds more flash consumption, I have omitted that in PRs thus far.
 - RAK12035 and other current upstream dev branch changes integrated.
2026-04-17 22:23:21 -06:00
liamcottle cfe4b0b9a5 bleuart service stay registered first to prevent gatt cache issues on android when already paired 2026-04-18 14:43:47 +12:00
Liam Cottle 77d737beb9 Merge pull request #2323 from txkbaldlaw/updated-companion-dfu-from-mt
Add support for Companion BLE OTA updates on nRF devices
2026-04-18 12:17:16 +12:00
Scott Powell d7a3d41843 Merge branch 'default-scope' into dev 2026-04-17 16:30:19 +10:00
Scott Powell 91f3fa0bdf * CLI: 'region put ...' now defaults to flood allowed 2026-04-17 15:11:10 +10:00
Scott Powell 7cdb056cb3 * CLI: 'region default ...' now auto-creates the region 2026-04-17 15:02:04 +10:00
Scott Powell 77d02e844f * bug fix 2026-04-17 14:38:03 +10:00
txkbaldlaw b898e7a04e Add DFU to BLE Stack 2026-04-16 16:04:30 -05:00
OverkillFPV 958204c7f1 Merge branch 'dev' into lora-longer-preamble 2026-04-16 20:43:46 +10:00
Scott Powell 576e9dfd45 * bug fix 2026-04-15 15:44:22 +10:00
Scott Powell 4131a455a2 * repeater: refactored 'region' CLI commands -> CommonCLI
* room server: added RegionMap, and new CommonCLI wiring, default_scope handling
* sensor: only minimal RegionMap wiring. Still needs work to handle default-scope
2026-04-15 13:32:49 +10:00
Scott Powell d131e8ae35 * companion: RegionMap now used in Datastore
* companion: new CMD_SET_DEFAULT_FLOOD_SCOPE
* support for regional builds with DEFAULT_REGION_SCOPE
2026-04-13 21:06:53 +10:00
Scott Powell 6a939ed8f8 * RegionMap: new 'default' region 2026-04-12 22:06:10 +10:00
Liam Cottle a9de5bfc0c Merge pull request #1612 from weebl2000/default-button-low
Default button polarity to active-LOW across all firmware types
2026-04-12 23:30:28 +12:00