mirror of
				https://github.com/Pablo2048/modbus-rtu-master.git
				synced 2025-10-31 16:11:51 +01:00 
			
		
		
		
	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.
		
			
				
	
	
	
		
			17 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			17 KiB