A surgical device is provided that includes a tool assembly having an anvil assembly and a cartridge assembly configured to grasp tissue therebetween, the cartridge assembly including a plurality of surgical fasteners. A motor is configured to fire one or more surgical fasteners. A sensor determines a first parameter of the tool assembly and a control system adjusts a second parameter of the motor used to fire the one or more surgical fasteners based on the first parameter detected by the sensor.