Skip to content

feat: configurable startup Test Target (EMMA / SUN2000 / Custom) - #13

Merged
mcamposv merged 2 commits into
mainfrom
feature/issue-12-target-profile
Nov 2, 2026
Merged

mcamposv merged 2 commits into
mainfrom
feature/issue-12-target-profile

Conversation

@mcamposv

@mcamposv mcamposv commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Closes #12
Closes #8

Summary

The boot Modbus liveness check (Toll 2) is no longer hard-wired to the EMMA. A new Test Target subsection inside Modbus TCP target — available both in /config and in the initial Setup portal — lets the user configure it:

Field EMMA SUN2000 Custom
Unit ID 0 (editable) 1 (editable) free
Function code 03 03 free (1–127)
Start register 30000 30000 free
Register count 15 15 free
  • Enable / disable the startup check. When disabled the gateway opens as soon as the ping to the target IP succeeds (the ping toll always stays).
  • Custom shows a warning: values are the user's responsibility (a write function code would modify the device on every attempt).
  • The check passes with the requested function's normal reply or its exception (FC | 0x80). With FC03/FC04 the ASCII text read is shown as device model; otherwise FCnn-OK.
  • The Unit ID only affects the check and the menu diagnostics — client requests are still forwarded untouched with their own Unit ID.

Persistence / migration

Stored in NVS (tgtProf, tstOn, tstId, tstFc, tstReg, tstCnt). When missing (upgrade from 6.0-0) they default to the EMMA values, so behaviour is unchanged until modified. Survives reboots and USB/OTA flashing.

Other changes

  • Shared, bounds-checked reply parsing for the boot check, the menu test and the scanner (the latter two could read past the PDU buffer).
  • Scanner now also probes ID 255 (the loop stopped at 7 of 8 IDs).
  • /api/status adds target_profile, startup_check, test_unit_id, test_function, test_register, test_reg_count.
  • i18n ES/EN/DE, READMEs updated, firmware bumped to 6.1-0.

Test plan

  • pio run -e esp32_usb builds with no new warnings
  • OTA flashed to the test proxy (.213): migrated to EMMA defaults, check passed against the EMMA emulator (EMMA-SA4H, WAITING)
  • /config renders the Test Target subsection
  • Save a Custom profile from the browser and verify /api/status after reboot
  • Verify with the check disabled

🤖 Generated with Claude Code

…oses #12, closes #8

The boot Modbus liveness check is no longer hard-wired to the EMMA
(MODBUS_FIXED_ID / MODBUS_TEST_REG). A "Test Target" subsection inside
"Modbus TCP target" (both /config and the Setup portal) lets the user:

- pick a device profile: EMMA, SUN2000 or Custom
- enable/disable the startup check (the ICMP ping toll always stays)
- set the 4 request fields: Unit ID, function code, start register and
  register count. Presets lock everything but the Unit ID; Custom makes
  all of them free and shows a responsibility warning.

Values persist in NVS; when missing (upgrade from 6.0-0) they default to
the EMMA values, so behaviour is unchanged until modified.

The check now accepts the requested function's normal reply or its
exception (FC | 0x80). Reply text parsing is shared and bounds-checked
(the menu test and scanner could read past the PDU buffer). The scanner
also probes ID 255, which the loop skipped.

/api/status exposes the target settings. Firmware bumped to 6.1-0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI was resolving the latest espressif32 (Arduino core 3.x), which breaks
the build (char8_t literals, ETH/esp_mac API changes). Pin the version
validated on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mcamposv
mcamposv merged commit ec361d1 into main Nov 2, 2026
2 checks passed
@mcamposv
mcamposv deleted the feature/issue-12-target-profile branch November 2, 2026 12:35
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.

include customization to specify the modbus TCP id ports related with suport multiple inverters. Add Support for additional Inverter / BESS Brands

1 participant