Commit b5d75be31f2da83f699fdadb9e597df681317d10
1 parent
50235c40
It's faster to use int data than uint16_t (alignment).
Showing
1 changed file
with
2 additions
and
2 deletions
modbus/modbus.c
| ... | ... | @@ -844,7 +844,7 @@ void manage_query(modbus_param_t *mb_param, uint8_t *query, |
| 844 | 844 | } |
| 845 | 845 | break; |
| 846 | 846 | case FC_FORCE_MULTIPLE_COILS: { |
| 847 | - uint16_t count = (query[offset+4] << 8) + query[offset+5]; | |
| 847 | + int count = (query[offset+4] << 8) + query[offset+5]; | |
| 848 | 848 | |
| 849 | 849 | if ((address + count) > mb_mapping->nb_coil_status) { |
| 850 | 850 | printf("Illegal data address %0X in force_multiple_coils\n", |
| ... | ... | @@ -860,7 +860,7 @@ void manage_query(modbus_param_t *mb_param, uint8_t *query, |
| 860 | 860 | } |
| 861 | 861 | break; |
| 862 | 862 | case FC_PRESET_MULTIPLE_REGISTERS: { |
| 863 | - uint16_t count = (query[offset+4] << 8) + query[offset+5]; | |
| 863 | + int count = (query[offset+4] << 8) + query[offset+5]; | |
| 864 | 864 | |
| 865 | 865 | if ((address + count) > mb_mapping->nb_holding_registers) { |
| 866 | 866 | printf("Illegal data address %0X in preset_multiple_registers\n", | ... | ... |