Преглед на файлове

Integer division 8.0 -> 8

Stéphane Raimbault преди 17 години
родител
ревизия
8556e176c3
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      modbus/modbus.c

+ 2 - 2
modbus/modbus.c

@@ -730,14 +730,14 @@ void manage_query(modbus_param_t *mb_param, uint8_t *query,
         switch (function) {
         case FC_READ_COIL_STATUS:
                 count = (query[offset+4] << 8) + query[offset+5];
-                byte_count = (count / 8.0) + ((count % 8) ? 1 : 0);
+                byte_count = (count / 8) + ((count % 8) ? 1 : 0);
                 offset = build_response_packet(mb_param, slave, function, byte_count, response);
                 offset = response_io_status(address, count, mb_mapping->tab_coil_status,
                                             response, offset);
                 break;
         case FC_READ_INPUT_STATUS:
                 count = (query[offset+4] << 8) + query[offset+5];
-                byte_count = (count / 8.0) + ((count % 8) ? 1 : 0);
+                byte_count = (count / 8) + ((count % 8) ? 1 : 0);
                 offset = build_response_packet(mb_param, slave, function, byte_count, response);
                 offset = response_io_status(address, count, mb_mapping->tab_input_status,
                                             response, offset);