Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fw795 map6s add peaks #856

Merged
merged 11 commits into from
Jan 30, 2025
Merged

Feature/fw795 map6s add peaks #856

merged 11 commits into from
Jan 30, 2025

Conversation

Ilia1S
Copy link
Contributor

@Ilia1S Ilia1S commented Jan 27, 2025

Добавил регистры пиковых значений.

Summary by CodeRabbit

  • New Features

    • Added peak current and voltage measurement capabilities for WB-MAP6S firmware version 2.
    • Introduced a new parameter to configure peak measurement periods.
    • Added peak measurement channels for six current channels and voltage.
  • Documentation

    • Updated configuration templates with new measurement parameters.
    • Added translations for new features in English and Russian.
  • Changelog

    • New version entry for wb-mqtt-serial package (2.154.1) with added peaks registers feature.

@Ilia1S Ilia1S requested a review from pgasheev January 27, 2025 09:17
@Ilia1S Ilia1S requested review from a team, KraPete and sikmir as code owners January 27, 2025 09:17
Copy link

coderabbitai bot commented Jan 27, 2025

Walkthrough

This pull request introduces version 2.154.1 of the wb-mqtt-serial package, focusing on adding peak registers functionality for the WB-MAP6S firmware version 2. The changes include updating the debian/changelog to reflect the new version and modifying the templates/config-map6s-fw2.json configuration file to support new peak measurement channels and a measurement period parameter for current and voltage readings across six channels.

Changes

File Change Summary
debian/changelog Added new version entry 2.154.1 with note about WB-MAP6S firmware version 2 peak registers
templates/config-map6s-fw2.json - Added peaks_measurement_period_s parameter
- Added 6 new Ipeak channels (1-6)
- Added Upeak voltage channel
- Updated existing channel Urms type and added units attribute
- Updated translations for new elements

Possibly related PRs

Suggested reviewers

  • KraPete
  • sikmir
  • pgasheev

Poem

🐰 Peaks of data, rising high,
Registers dancing, channels fly!
WB-MAP6S, version two,
Measuring currents, voltage true,
A rabbit's metrics, crisp and bright! 📊


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
templates/config-map6s-fw2.json (1)

284-294: Verify consistency in peak current channel configurations.

The peak current channels (Ipeak 1-6) are consistently configured with:

  • Correct register type (input)
  • Consistent scale (0.016)
  • Consistent format (s32)
  • Consistent word order (little_endian)
  • Logical address progression (0x181c, 0x181a, 0x1818, 0x281c, 0x281a, 0x2818)

However, consider adding documentation about:

  1. The meaning of the scale factor (0.016)
  2. The expected range of values

Also applies to: 399-409, 514-524, 629-639, 744-754, 859-869

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e31677 and fe1d19c.

⛔ Files ignored due to path filters (1)
  • test/TDeviceTemplatesTest.Validate.dat is excluded by !**/*.dat
📒 Files selected for processing (2)
  • debian/changelog (1 hunks)
  • templates/config-map6s-fw2.json (11 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (5)
debian/changelog (1)

1-5: LGTM! The changelog entry is well-formatted.

The changelog entry follows the standard format and provides clear information about the changes:

  • Version number follows semantic versioning
  • Distribution and urgency are properly set
  • Change description is concise and clear
  • Maintainer information and timestamp are correctly formatted
templates/config-map6s-fw2.json (4)

260-269: Review the peaks measurement period parameter configuration.

The parameter configuration looks good with appropriate constraints:

  • Minimum value of 1 second prevents too frequent measurements
  • Default value of 60 seconds is reasonable
  • Clear firmware version requirement is specified

975-986: Review peak voltage channel configuration.

The Upeak channel configuration includes an important error value (0x7FFFFFFF) that's not present in other peak channels.

Please clarify:

  1. Should the Ipeak channels also have an error_value field?
  2. Is 0x7FFFFFFF a special indicator value for this specific channel?

1091-1091: Verify translation completeness.

The translations for firmware version requirements are properly added in both English and Russian.

Also applies to: 1131-1132


Line range hint 260-986: Verify firmware version compatibility.

The changes require firmware v2.3.0 or newer, but some existing features require v2.10.0.

Run this script to check version compatibility:

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
templates/config-map6s-fw2.json (2)

989-1000: Document the error value usage.

The Upeak channel includes an error_value (0x7FFFFFFF) but lacks documentation explaining when this value is returned. Consider adding a description to clarify its usage.


286-296: Add firmware version requirement to peak measurement channels.

While the peaks_measurement_period_s parameter specifies the firmware version requirement (v2.3.0+), this requirement is not documented for the peak measurement channels (Ipeak 1-6, Upeak). Consider adding the same description to these channels for clarity.

Also applies to: 403-413, 520-530, 637-647, 754-764, 871-881, 989-1000

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b4d7cb and 1c360ba.

📒 Files selected for processing (2)
  • debian/changelog (1 hunks)
  • templates/config-map6s-fw2.json (24 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • debian/changelog
🔇 Additional comments (3)
templates/config-map6s-fw2.json (3)

260-269: LGTM! Well-structured parameter configuration.

The peaks measurement period parameter is properly defined with appropriate constraints, firmware version requirement, and translations.


278-279: LGTM! Consistent type and units specification.

The change from specific types to generic "value" type with explicit units improves consistency across all measurements.

Also applies to: 395-396, 512-513, 629-630, 746-747, 863-864, 980-981, 1034-1035, 1064-1065


286-296: Verify the scale factor for peak current measurements.

The scale factor for peak current measurements (0.016) is significantly different from regular current measurements (2.44141e-7). Please verify that this is intentional and correct according to the firmware specifications.

Run the following script to search for any documentation or tests that validate these scale factors:

Also applies to: 403-413, 520-530, 637-647, 754-764, 871-881

@Ilia1S Ilia1S requested a review from sikmir January 28, 2025 15:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
templates/config-map6s-fw2.json (1)

Line range hint 1098-1139: Add translations for peak measurement channels.

While firmware version requirement translations were added, the following translations are missing for the new channels:

  • "Ipeak 1" through "Ipeak 6" in Russian
  • "Upeak" in Russian

Apply this diff to add the missing translations:

             "ru": {
                 "WB-MAP6S-fw2_template_title": "WB-MAP6S fw2 (многоканальный счетчик электроэнергии)",
+                "Ipeak 1": "Пиковый ток 1",
+                "Ipeak 2": "Пиковый ток 2",
+                "Ipeak 3": "Пиковый ток 3",
+                "Ipeak 4": "Пиковый ток 4",
+                "Ipeak 5": "Пиковый ток 5",
+                "Ipeak 6": "Пиковый ток 6",
+                "Upeak": "Пиковое напряжение",
                 "Channel 1": "Канал 1",
🧹 Nitpick comments (1)
templates/config-map6s-fw2.json (1)

981-993: Consider standardizing error value handling across channels.

The Upeak channel includes an error_value field (0x7FFFFFFF) while other channels don't have this field. Consider:

  1. Adding error values to other channels if they can report errors
  2. Documenting why only Upeak has this field if it's intentional
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c360ba and f762f3f.

⛔ Files ignored due to path filters (1)
  • test/TDeviceTemplatesTest.Validate.dat is excluded by !**/*.dat
📒 Files selected for processing (2)
  • debian/changelog (1 hunks)
  • templates/config-map6s-fw2.json (11 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • debian/changelog
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
templates/config-map6s-fw2.json (2)

260-269: LGTM! Parameter configuration looks good.

The peaks_measurement_period_s parameter is well-structured with appropriate constraints and firmware version requirement.


284-295: Verify the scale factor for peak current measurements.

The scale factor for Ipeak channels (0.016) is significantly different from Irms channels (2.44141e-7). While this might be intentional due to different measurement methods, please verify that this is correct according to the firmware specifications.

Also applies to: 400-411, 516-527, 632-643, 748-759, 864-875

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
templates/config-map6s-fw2.json (1)

974-975: Consider adding error_value to Urms channel for consistency.

The voltage channels are properly configured, but for consistency with Upeak, consider adding error_value to Urms as well.

Apply this diff:

                 "type": "value",
                 "units": "V",
+                "error_value": "0x7FFFFFFF",
                 "semi-sporadic": true,

Also applies to: 982-994

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f762f3f and 51dda3d.

📒 Files selected for processing (1)
  • templates/config-map6s-fw2.json (11 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
templates/config-map6s-fw2.json (3)

260-269: LGTM: Well-structured parameter configuration.

The peaks_measurement_period_s parameter is properly configured with:

  • Reasonable min (1) and default (60) values
  • Clear firmware version requirement
  • Proper grouping and order

284-295: LGTM: Consistent peak current channel configurations.

The peak current channels (Ipeak 1-6) follow a consistent pattern with proper:

  • Register addressing scheme
  • Scale and format for current measurements
  • Units specification
  • Word order specification

Also applies to: 400-411, 516-527, 632-643, 748-759, 864-875


1099-1099: LGTM: Proper translations provided.

The translations for the new parameter and firmware requirement message are properly added in both English (implicitly) and Russian.

Also applies to: 1139-1139

@Ilia1S Ilia1S merged commit 4b9342b into master Jan 30, 2025
14 checks passed
@Ilia1S Ilia1S deleted the feature/fw795-map6s-add-peaks branch January 30, 2025 04:59
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