Skip to content

Add AS3935 lightning sensor telemetry fields - #981

Draft
ndoo wants to merge 3 commits into
meshtastic:masterfrom
ndoo:feat/as3935-lightning-sensor
Draft

Add AS3935 lightning sensor telemetry fields#981
ndoo wants to merge 3 commits into
meshtastic:masterfrom
ndoo:feat/as3935-lightning-sensor

Conversation

@ndoo

@ndoo ndoo commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the schema needed to support an AS3935 lightning-detection sensor in meshtastic/firmware (companion firmware PR: meshtastic/firmware#10931, branch feat/as3935-lightning-sensor on mesh-malaysia/meshtastic-firmware).

In meshtastic/telemetry.proto:

  • EnvironmentMetrics.lightning_strike_count_1h (uint32, field 24) — lightning strikes detected in the last hour, matching the rainfall_1h naming convention.
  • EnvironmentMetrics.lightning_distance_km (float, field 25) — estimated distance to the leading edge of the storm for the most recently detected strike in the current window, valid only when a genuine strike (not noise/disturber) was classified.
  • TelemetrySensorType.AS3935 (enum value 55).

Field numbers were the next free slots in both EnvironmentMetrics (last used: 23, one_wire_temperature) and TelemetrySensorType (last used: 54, SPA06).

Related Issue

Checklist before merging

  • All top level messages commented
  • All enum members have unique descriptions

Note: this repo's develop branch (not master) is what meshtastic/firmware's own develop branch submodule-pins to — this PR targets develop accordingly.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Adds lightning_strike_count_1h and lightning_distance_km to EnvironmentMetrics (reset on a rolling ~1h window, matching the rainfall_1h precedent), and an AS3935 entry to TelemetrySensorType, to support meshtastic/firmware#10774.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@ndoo
ndoo force-pushed the feat/as3935-lightning-sensor branch from 83a364c to f10075c Compare July 7, 2026 18:57
@caveman99
caveman99 changed the base branch from develop to master August 12, 2026 07:06
@caveman99
caveman99 marked this pull request as ready for review August 12, 2026 07:13
@ndoo

ndoo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Do not merge unless anyone has tested

@caveman99
caveman99 marked this pull request as draft August 12, 2026 07:14
@caveman99

Copy link
Copy Markdown
Member

Do not merge unless anyone has tested

I have one of those sensors incoming, but i wanted to keep the pr's fresh.

ndoo pushed a commit to meshmy/meshtastic-firmware that referenced this pull request Aug 12, 2026
Conflict resolutions:
- configuration.h: keep the DS248X and HM330X addresses, append the AS3935 addresses
- ScanI2C.h: keep DS248X and HM330X in DeviceType, append AS3935
- EnvironmentTelemetry.cpp: keep the display-source refactor from develop, keep IMMEDIATE_SEND_MAX_STALENESS_MS, drop the duplicate environmentTelemetryModule definition
- EnvironmentTelemetry.h: drop the duplicate extern environmentTelemetryModule declaration
- protobufs: take develop (84bfb0f); meshtastic/protobufs#981 supplies the AS3935 fields

Note: protobufs#981 as it stands assigns lightning_strike_count_1h = 24,
lightning_distance_km = 25 and AS3935 = 55, which collide with
adc_voltage_ch0, adc_voltage_ch1 and HM330X on protobufs master. It needs
renumbering before merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants