Console to dmesg (#910)
* always pip console.log to dmesg * trim new line * restore storage * restore new line * remove unused variable
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
				
			|||||||
// This is the last thing executed before user code
 | 
					// This is the last thing executed before user code
 | 
				
			||||||
 | 
					console.addListener(function(msg: string) {
 | 
				
			||||||
 | 
					    control.dmesg(msg.substr(0, msg.length - 1))
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
// pulse green, play startup sound, turn off light
 | 
					// pulse green, play startup sound, turn off light
 | 
				
			||||||
brick.setStatusLight(StatusLight.GreenPulse);
 | 
					brick.setStatusLight(StatusLight.GreenPulse);
 | 
				
			||||||
// We pause for 100ms to give time to read sensor values, so they work in on_start block
 | 
					// We pause for 100ms to give time to read sensor values, so they work in on_start block
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,6 @@ namespace storage {
 | 
				
			|||||||
    storage.temporary.remove("console.txt");
 | 
					    storage.temporary.remove("console.txt");
 | 
				
			||||||
    console.addListener(function(line) {
 | 
					    console.addListener(function(line) {
 | 
				
			||||||
        const fn = "console.txt";
 | 
					        const fn = "console.txt";
 | 
				
			||||||
        const mxs = 65536;
 | 
					 | 
				
			||||||
        const t = control.millis();
 | 
					        const t = control.millis();
 | 
				
			||||||
        storage.temporary.appendLine(fn, `${t}> ${line}`);
 | 
					        storage.temporary.appendLine(fn, `${t}> ${line}`);
 | 
				
			||||||
        storage.temporary.limit(fn, 65536);
 | 
					        storage.temporary.limit(fn, 65536);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user