gcode: Add minval/maxval/above/below options to get_X parsers

Add value checking to gcode parameter parsing code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-04-20 21:41:13 -04:00
parent 8f4f5da11c
commit d5dc6b785d
5 changed files with 53 additions and 45 deletions

View file

@ -102,7 +102,7 @@ class VirtualSD:
# Set SD position
if self.work_timer is not None:
raise self.gcode.error("SD busy")
pos = self.gcode.get_int('S', params)
pos = self.gcode.get_int('S', params, minval=0)
self.file_position = pos
def cmd_M27(self, params):
# Report SD print status