From 03e34f2676b042eed26ae5b3de51595dba8d617c Mon Sep 17 00:00:00 2001 From: Wouter R Date: Sun, 14 Feb 2016 00:38:19 +0100 Subject: [PATCH] 'printer/print' API call: change 'first' parameter to 'clear' and deprecate old name. --- src/rest/api/api_printer.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rest/api/api_printer.lua b/src/rest/api/api_printer.lua index 42e8fce..c2d43f4 100644 --- a/src/rest/api/api_printer.lua +++ b/src/rest/api/api_printer.lua @@ -175,7 +175,8 @@ end --requires: gcode(string) (the gcode to be appended) --accepts: id(string) (the printer ID to append to) ---accepts: first(bool) (chunks will be concatenated but output file will be cleared first if this argument is true) +--accepts: clear(bool) (chunks will be concatenated but output file will be cleared first if this argument is true) +--accepts: first(deprecated) (an alias for 'clear') --accepts: start(bool) (only when this argument is true will printing be started) --accepts: total_lines(int) (the total number of lines that is going to be sent, will be used only for reporting progress) --accepts: seq_number(int) (sequence number of the chunk, must be given until clear() after given once, and incremented each time) @@ -201,7 +202,8 @@ function M.print_POST(request, response) local argId = request:get("id") local argGcode = request:get("gcode") - local argIsFirst = utils.toboolean(request:get("first")) + local argClear = utils.toboolean(request:get("clear")) + local argIsFirst = utils.toboolean(request:get("first")) -- deprecated local argStart = utils.toboolean(request:get("start")) local argTotalLines = request:get("total_lines") or -1 local argSeqNumber = request:get("seq_number") or -1 @@ -218,7 +220,7 @@ function M.print_POST(request, response) return end - if argIsFirst == true then + if argClear == true or argIsFirst == true then log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId()) response:addData('gcode_clear',true) local rv,msg = printer:clearGcode()