Happened to me when I would alt+tab the game, and the logitech panel would be "up" (not minimized to taskbar), but in my case every joystick button would trigger this crazy movement not just the trim assigned button.
The quickest way to solve it was restart windows, I know it sounds daft, but much more reliable than unplugging/plugging the g940, or restarting just the console.
Hope it helps :)