mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2025-01-19 02:55:59 +00:00
Add logger, output
This commit is contained in:
parent
95b23236e0
commit
8d244e5166
@ -207,6 +207,11 @@
|
|||||||
"mindreader.connection.portPath": {
|
"mindreader.connection.portPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"markdownDescription": "Specifies the serial port path to use if `#mindreader.connectAutomatically#` is not set."
|
"markdownDescription": "Specifies the serial port path to use if `#mindreader.connectAutomatically#` is not set."
|
||||||
|
},
|
||||||
|
"mindreader.connection.clearOutputOnRun": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether to clear the output each time the program is run",
|
||||||
|
"default": "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
import * as pl from './pylex';
|
import * as pl from './pylex';
|
||||||
|
|
||||||
import commands from './commands';
|
import commands from './commands';
|
||||||
|
|
||||||
import AccessNodeProvider from './accessNodeProvider';
|
import AccessNodeProvider from './accessNodeProvider';
|
||||||
|
import Logger from './log';
|
||||||
|
|
||||||
// create output channel
|
// Output Logger
|
||||||
const outputChannel = vscode.window.createOutputChannel("SPIKE Prime Output");
|
const outputChannel = vscode.window.createOutputChannel("SPIKE Prime Output");
|
||||||
|
export const logger = new Logger(outputChannel);
|
||||||
export function MindReaderOutput(line: string) {
|
|
||||||
outputChannel.show();
|
|
||||||
outputChannel.appendLine(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
let parser: pl.Parser = new pl.Parser();
|
let parser: pl.Parser = new pl.Parser();
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@ import * as vscode from 'vscode';
|
|||||||
import * as SerialPort from 'serialport';
|
import * as SerialPort from 'serialport';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import { MindReaderOutput } from './extension';
|
|
||||||
|
import { logger } from './extension';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type RPCRequest an RPC request message
|
* @type RPCRequest an RPC request message
|
||||||
@ -104,11 +105,11 @@ export default class HubManager {
|
|||||||
const params = json['p'];
|
const params = json['p'];
|
||||||
switch (json['m']) {
|
switch (json['m']) {
|
||||||
case 'user_program_error':
|
case 'user_program_error':
|
||||||
MindReaderOutput(Buffer.from(params[3], 'base64').toString());
|
logger.error(Buffer.from(params[3], 'base64').toString());
|
||||||
MindReaderOutput(Buffer.from(params[4], 'base64').toString());
|
logger.error(Buffer.from(params[4], 'base64').toString());
|
||||||
break;
|
break;
|
||||||
case 'runtime_error':
|
case 'runtime_error':
|
||||||
MindReaderOutput(Buffer.from(params[3], 'base64').toString());
|
logger.error(Buffer.from(params[3], 'base64').toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +142,7 @@ export default class HubManager {
|
|||||||
|
|
||||||
let mgr = this;
|
let mgr = this;
|
||||||
this.port.on('data', data => {
|
this.port.on('data', data => {
|
||||||
mgr.receiveData(data)
|
mgr.receiveData(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +365,6 @@ export default class HubManager {
|
|||||||
options = {
|
options = {
|
||||||
port: '/dev/ttyACM0',
|
port: '/dev/ttyACM0',
|
||||||
magic: true,
|
magic: true,
|
||||||
timeout: 2500,
|
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user