Gcode: Use operator[] instead of string::at to avoid allocation

Not entire sure why string::at allocates, but we don't need bounds
checking regardless. Perhaps this is due to const-ness?
Gcode: Use const_cast to silence warning