diff --git a/load/sqrllogin.js b/load/sqrllogin.js index 7fe1b7b..8e23d9e 100644 --- a/load/sqrllogin.js +++ b/load/sqrllogin.js @@ -39,7 +39,7 @@ function sqrllogin() { .map(function(x) {return x.charCodeAt(0)}); var qr = qrcodegen.QrCode.encodeBinary(data,qrcodegen.QrCode.Ecc.LOW); - var subframe = new Frame(38,2,43,22,BG_BLACK|LIGHTGRAY); + var subframe = new Frame((viewdata ? VIEWDATA_FRAME_WIDTH : ANSI_FRAME_WIDTH-qr.size-2),2,(viewdata ? qr.size/2 : qr.size+2),22,BG_BLACK|LIGHTGRAY); fo.qrcode(qr,subframe); fo.sendBaseline('CANCEL_MSG',false); diff --git a/load/viewdataframe.js b/load/viewdataframe.js index b3aba6e..d4276b6 100644 --- a/load/viewdataframe.js +++ b/load/viewdataframe.js @@ -6,14 +6,15 @@ var VIEWDATA_FRAME_HEADER = 23; /* Size of page owner (length) */ var VIEWDATA_FRAME_PAGENUM = 11; /* Size of page number (length with a-z) */ var VIEWDATA_FRAME_COST = 3; /* Size of cost (length without unit) */ -var VIEWDATA_HOME = "\x1e"; -var VIEWDATA_CLS = "\x0c"; -var VIEWDATA_UP = "\x0b"; -var VIEWDATA_DOWN = "\x0a"; -var VIEWDATA_COFF = "\x14"; -var VIEWDATA_CON = "\x11"; -var VIEWDATA_RIGHT = "\x09"; -var VIEWDATA_LEFT = "\x08"; +var VIEWDATA_LEFT = ascii(0x08); +var VIEWDATA_RIGHT = ascii(0x09); +var VIEWDATA_DOWN = ascii(0x0a); +var VIEWDATA_UP = ascii(0x0b); +var VIEWDATA_CLS = ascii(0x0c); +var VIEWDATA_CR = ascii(0x0d); +var VIEWDATA_CON = ascii(0x11); +var VIEWDATA_COFF = ascii(0x14); +var VIEWDATA_HOME = ascii(0x1e); var VIEWDATA_MOSIAC_RED = ascii(27)+ascii(0x51); var VIEWDATA_MOSIAC_GREEN = ascii(27)+ascii(0x52); var VIEWDATA_MOSIAC_YELLOW = ascii(27)+ascii(0x53); @@ -449,6 +450,9 @@ function VIEWDATAFrame() { repeat_count = VIEWDATA_FRAME_WIDTH-Math.ceil(qr.size/2)-offset-(offset ? 1 : 2)-(y%2 == 1 ? 0 : 1); qrcode += line+' '.repeat(repeat_count > 0 ? repeat_count : 0); + + // To fix some terminals where moving right from col 40 doesnt advance to col 1 on the next line + qrcode +=VIEWDATA_LEFT+VIEWDATA_CR+VIEWDATA_DOWN; } log(LOG_DEBUG,'WIDTH:'+VIEWDATA_FRAME_WIDTH);