Skip to content

Add ADS1X15 voltage metrics#711

Merged
caveman99 merged 2 commits into
meshtastic:masterfrom
fablabbcn:enhancement/voltage-metrics
Jun 25, 2025
Merged

Add ADS1X15 voltage metrics#711
caveman99 merged 2 commits into
meshtastic:masterfrom
fablabbcn:enhancement/voltage-metrics

Conversation

@oscgonfer

@oscgonfer oscgonfer commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

ADS1X15 ADCs are 4-channel I2C ADCs with configurable I2C Addresses. This PR adds the SensorType and created an additional channel for it in the PowerMetrics` protobuf.

What does this PR do?

This PR adds the TelemetrySensorType and creates an additional channel for it in the PowerMetrics protobuf.
This, is however incomplete: the problem being that up to 4x ADS1X15s can be chained together, and each one of them with 4 channels, making up for a total of 16 channels.

Checklist before merging

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

@oscgonfer

Copy link
Copy Markdown
Contributor Author

@caveman99 - I am not able to allow you for editing the PR because of this: https://github.com/orgs/community/discussions/5634

* Voltage (Ch4)
*/
optional float ch4_voltage = 7;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we define the Current for Channel 4 as well, and add the remaining channels 5 to 8 in one PR? So all 8 channels are set up identical.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Although to avoid overloading this with a very specific ADC, would there be maybe a better approach to avoid repeating these metrics?

I was thinking maybe something like:

message AnalogMetrics {
    repeated float voltage = 1;
}

@oscgonfer oscgonfer Jun 25, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can always just to this for now and tackle this later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All done @caveman99

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message AnalogMetrics {
    repeated float voltage = 1;
}

That would require a max size definition in the options file, since we can't handle infinite repeated fields. we need to check for the max mtu size during compile time.

@oscgonfer oscgonfer marked this pull request as ready for review June 25, 2025 12:17
@caveman99 caveman99 merged commit 386fa53 into meshtastic:master Jun 25, 2025
2 checks passed
@oscgonfer oscgonfer deleted the enhancement/voltage-metrics branch July 20, 2025 13:28
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