Fix bug in arduino server.

This commit is contained in:
Brad Nelson
2021-02-21 01:00:57 -08:00
parent 7869aa3859
commit a8ed647a81

View File

@ -65,7 +65,7 @@ function httpPost(url, items, callback) {
} }
function ask(cmd, callback) { function ask(cmd, callback) {
httpPost('/input', httpPost('/input',
{cmd: cmd + '\\n'}, function(data) { {cmd: cmd + '\n'}, function(data) {
if (data !== null) { output.value += data; } if (data !== null) { output.value += data; }
output.scrollTop = output.scrollHeight; // Scroll to the bottom output.scrollTop = output.scrollHeight; // Scroll to the bottom
if (callback !== undefined) { callback(); } if (callback !== undefined) { callback(); }
@ -82,7 +82,7 @@ filepick.onchange = function(event) {
if (event.target.files.length > 0) { if (event.target.files.length > 0) {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function(e) { reader.onload = function(e) {
var parts = e.target.result.split('\\n'); var parts = e.target.result.split('\n');
function upload() { function upload() {
if (parts.length === 0) { filepick.value = ''; return; } if (parts.length === 0) { filepick.value = ''; return; }
ask(parts.shift(), upload); ask(parts.shift(), upload);