mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	Fix modbus user-defined function handling (#3527)
This commit is contained in:
		@@ -76,7 +76,12 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
 | 
			
		||||
    // installed, but wait, there is the CRC, and if we get a hit there is a good
 | 
			
		||||
    // chance that this is a complete message ... admittedly there is a small chance is
 | 
			
		||||
    // isn't but that is quite small given the purpose of the CRC in the first place
 | 
			
		||||
    data_len = at;
 | 
			
		||||
 | 
			
		||||
    // Fewer than 2 bytes can't calc CRC
 | 
			
		||||
    if (at < 2)
 | 
			
		||||
      return true;
 | 
			
		||||
 | 
			
		||||
    data_len = at - 2;
 | 
			
		||||
    data_offset = 1;
 | 
			
		||||
 | 
			
		||||
    uint16_t computed_crc = crc16(raw, data_offset + data_len);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user