write gcodeview code - still quite buggy