Commit Graph

31 Commits

Author SHA1 Message Date
google-labs-jules[bot]
8ba43c2ba4 feat: Add Modbus RTU write operations and update documentation
This commit introduces methods for writing to Modbus RTU devices:
- writeSingleCoil (FC05)
- writeSingleRegister (FC06)
- writeMultipleCoils (FC15)
- writeMultipleRegisters (FC16)

Key changes include:
- Implementation of the four write functions in `src/modbus-rtu-master.js`.
- Addition of helper methods for building Modbus request frames for these operations.
- Refinements to response handling (`_receiveResponse`) for increased robustness and to support various response types.
- Introduction of `ModbusRTUMaster.FUNCTION_CODES` for better code clarity and maintainability.
- Input validation for addresses, values, and quantities according to Modbus PDU limits.
- Thorough response validation for write operations to ensure commands were processed correctly by the slave device.
- Updated `README.md` with detailed documentation and usage examples for the new write methods.
- Enhanced `example/index.html` with UI elements and JavaScript logic to demonstrate and manually test all new write operations.

The changes also incorporate improvements based on an initial code review, such as the use of named constants and more structured request/response handling.
2025-05-26 10:01:53 +00:00
6f13fc5c0d Merge pull request #12 from Pablo2048/development
Refuse to use GA :-(
2024-10-12 15:35:10 +02:00
855e023758 Refuse to use GA :-( 2024-10-12 15:34:48 +02:00
11f6d7a7b5 Merge pull request #11 from Pablo2048/development
Identity update
2024-10-12 15:32:55 +02:00
33299110a3 Identity update 2024-10-12 15:32:28 +02:00
92c234e0a7 Merge pull request #10 from Pablo2048/development
Update GA with access token
2024-10-12 15:29:58 +02:00
f7494799b9 GA update 2024-10-12 15:29:18 +02:00
e5a665b29f Access token to GA 2024-10-12 15:29:01 +02:00
02b564fc46 Merge pull request #9 from Pablo2048/development
Update both main & development when rebase
2024-10-12 15:26:13 +02:00
4aff096f7b Update both main & development when rebase 2024-10-12 15:25:35 +02:00
1ac634fd8d Merge pull request #8 from Pablo2048/development
GA update
2024-10-12 15:21:13 +02:00
f634bf648a GA update 2024-10-12 15:20:32 +02:00
cd80deb142 Merge pull request #7 from Pablo2048/development
New way to sync
2024-10-12 15:16:03 +02:00
eaa95d08d0 New way to sync 2024-10-12 15:15:43 +02:00
55236c9356 Merge pull request #6 from Pablo2048/development
Documentation update
2024-10-11 15:47:31 +02:00
13a19f930f Documentation update 2024-10-11 15:46:38 +02:00
e5bcf00422 Merge pull request #5 from Pablo2048/development
Manual script to sync
2024-10-11 15:41:02 +02:00
d83a2db169 Manual script to sync 2024-10-11 15:40:22 +02:00
29b7f6de2c Merge pull request #4 from Pablo2048/development
Directory typo fix
2024-10-11 15:38:34 +02:00
02b6f692b0 Directory typo fix 2024-10-11 15:37:46 +02:00
88cb121cb2 Merge pull request #3 from Pablo2048/development
GA for automatic development sync
2024-10-11 15:36:14 +02:00
5434dcbbc8 GA for automatic development sync 2024-10-11 15:34:40 +02:00
a7c83f738f Merge pull request #2 from Pablo2048/development
Correctly handle disconnect & reconnect events
2024-10-11 15:29:19 +02:00
c7fba48b19 Update example code 2024-10-11 15:27:28 +02:00
c16d2ed08b Note about using trace.js library 2024-10-11 15:09:25 +02:00
1350335c75 Refactoring, correctly handling disconnect & reconnect, use of trace.js 2024-10-10 14:48:54 +02:00
5f3569d6be Merge pull request #1 from Pablo2048/development
Better disconnect handling
2024-10-09 14:06:56 +02:00
4f5fb3daa8 Missing reader.cancel() call. 2024-10-05 15:25:59 +02:00
6272dbf38a Better disconnect and connection timeout handling 2024-10-05 15:24:07 +02:00
1d93632f6d First commit v1.0.0 2024-09-13 09:59:14 +02:00
ad6781e737 Initial commit 2024-09-13 09:47:03 +02:00