diff --git a/CHANGELOG.md b/CHANGELOG.md index f66a545..aa38c54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to ModbusTool, newest first. Each section is also the text of it [GitHub release](https://github.com/chetto1983/ModbusTool/releases): the Release workflow publishes the section whose heading matches the pushed `vX.Y.Z` tag. The full history is in git. +## v3.6.0 — 2026-11-11 + +Unit 255 for the slave, the unit most Modbus TCP devices answer as. + +### Changed + +- The slave's unit list, simulations and project files accept unit ids up to 255 (they stopped at + 247). On serial lines 248..255 are reserved by the Modbus specification, so a serial master may + not address them. + ## v3.5.0 — 2026-11-06 Import a device's register map as a dashboard, and record a dashboard's values to file. diff --git a/docs/superpowers/verification/2026-11-11-slave-unit-255.md b/docs/superpowers/verification/2026-11-11-slave-unit-255.md new file mode 100644 index 0000000..111e111 --- /dev/null +++ b/docs/superpowers/verification/2026-11-11-slave-unit-255.md @@ -0,0 +1,31 @@ +# Verifica: unità dello slave fino a 255 + +Data: 2026-11-11. Richiesta: lo slave rifiutava l'unità 255 ("non è un'unità o un intervallo in +1..247"). Il limite stava solo nel frontend (`parseUnits`, `parseProject`, editor delle +simulazioni): il backend tiene le unità come `u8` e rmodbus 0.13 tratta come broadcast solo +l'unità 0 (`ModbusFrame::new`, `broadcast_units: &[0]`), quindi 255 è servita come ogni altra. + +## Cosa è stato misurato + +- **Riferimento indipendente**: pymodbus 3.16.2 (la versione della CI) come master contro il + `SlaveServer` reale configurato con la sola unità 255, su TCP, UDP e RTU over TCP, in una + worktree usa-e-getta. Su ogni trasporto: lettura di 3 holding register con `device_id=255` → + `[11, 22, 33]`; scrittura di `[7, 8]` all'indirizzo 10 → presente nello store dell'unità 255; + lettura con `device_id=254` (non configurata) → nessuna risposta. +- **Test**: `all_operations_over_tcp_udp_and_rtu_over_tcp` esegue tutte le operazioni del master + anche sull'unità 255; `parseUnits` accetta 255 e 247-248, rifiuta 256 e 250-256; + `parseProject` accetta `[1, 255]`, rifiuta `[0]` e `[1, 256]`. +- **Gate**: `cargo fmt --check`, `cargo clippy -D warnings`, `cargo test` (61); `npm run check`, + `lint`, `format:check`, `deadcode`, `dup`, `coverage` (146 test, 99,13% righe), `build`, + `file-size`, `check:i18n`. Stryker: `units.ts` 93,1% (i 4 sopravvissuti sono equivalenti: + `trim`/`filter` ridondanti con `Number()` e gli argomenti del messaggio), nessun sopravvissuto + sulle righe toccate di `project.ts`. + +## Cosa NON dimostra + +- L'app non è stata avviata: la UI (campo unità, simulazioni, caricamento progetto) è coperta da + test unitari e svelte-check, non dall'E2E con tauri-driver, che gira in CI. +- Linee seriali RTU/ASCII non misurate con l'unità 255: lì 248..255 sono riservati (Modbus over + Serial Line v1.02 §2.2) e un master seriale conforme può non indirizzarli. +- `project.ts` resta al 54,5% di mutation score: il file non è nello scope di Stryker e i + sopravvissuti sono sulle righe non toccate. diff --git a/messages/en.json b/messages/en.json index 595a4ff..4dca23a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -200,7 +200,7 @@ "slave_stop": "Stop", "slave_first": "Start", "slave_count": "Count", - "units_invalid": "\"{part}\" is not a unit or range in 1..247", + "units_invalid": "\"{part}\" is not a unit or range in 1..255", "units_empty": "At least one unit is required", "csv_invalid_entry": "Invalid entry \"{entry}\"", "sim_title": "Simulation", diff --git a/messages/it.json b/messages/it.json index b3daaa2..c148e94 100644 --- a/messages/it.json +++ b/messages/it.json @@ -200,7 +200,7 @@ "slave_stop": "Ferma", "slave_first": "Inizio", "slave_count": "Numero", - "units_invalid": "\"{part}\" non è un'unità o un intervallo in 1..247", + "units_invalid": "\"{part}\" non è un'unità o un intervallo in 1..255", "units_empty": "Serve almeno un'unità", "csv_invalid_entry": "Voce non valida \"{entry}\"", "sim_title": "Simulazione", diff --git a/package-lock.json b/package-lock.json index 2e938b5..cd5cd9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "modbus-tool", - "version": "3.5.0", + "version": "3.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modbus-tool", - "version": "3.5.0", + "version": "3.6.0", "license": "MIT", "dependencies": { "@tauri-apps/api": "^2.12.4", diff --git a/package.json b/package.json index 8011d1e..149101c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "modbus-tool", "private": true, - "version": "3.5.0", + "version": "3.6.0", "license": "MIT", "type": "module", "scripts": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 6f264ae..368a9ad 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "modbus-tool" -version = "3.5.0" +version = "3.6.0" dependencies = [ "rmodbus", "serde", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index bb3c331..9c46958 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "modbus-tool" -version = "3.5.0" +version = "3.6.0" description = "Modbus TCP/UDP/RTU/ASCII master and slave tool" authors = ["ModbusTool contributors"] license = "MIT" diff --git a/src-tauri/src/master_tests.rs b/src-tauri/src/master_tests.rs index 3b5860b..374429b 100644 --- a/src-tauri/src/master_tests.rs +++ b/src-tauri/src/master_tests.rs @@ -123,10 +123,14 @@ fn every_operation(master: &mut Master, store: &UnitStore, unit: u8) { #[test] fn all_operations_over_tcp_udp_and_rtu_over_tcp() { - for kind in [tcp, udp, rtu_over_tcp] { - let (server, store) = slave(local(kind, 0), 4); - let mut m = master(local(kind, server.local_addr.unwrap().port()), 0); - every_operation(&mut m, &store, 4); + // 255 is the unit TCP devices answer as (MODBUS Messaging on TCP/IP Implementation Guide + // V1.0b); rmodbus 0.13 broadcasts only on unit 0, so it is served like any other unit. + for unit in [4, 255] { + for kind in [tcp, udp, rtu_over_tcp] { + let (server, store) = slave(local(kind, 0), unit); + let mut m = master(local(kind, server.local_addr.unwrap().port()), 0); + every_operation(&mut m, &store, unit); + } } } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a79f686..1661cd0 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "ModbusTool", - "version": "3.5.0", + "version": "3.6.0", "identifier": "io.github.chetto1983.modbustool", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/lib/components/SimulationForm.svelte b/src/lib/components/SimulationForm.svelte index c0bace8..73cb69c 100644 --- a/src/lib/components/SimulationForm.svelte +++ b/src/lib/components/SimulationForm.svelte @@ -17,7 +17,7 @@