Skip to content

Commit ccbcd7c

Browse files
authored
Merge pull request #121 from PropGit/debug_download4
Patch for Mac download problems
2 parents afa45ae + dd607e1 commit ccbcd7c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const mDbug = mcStatus + mdLog + mdConsole;
8484
const mDeep = mcVerbose + mdConsole;
8585
const mAll = mcUser + mdDisplay + mdLog + mdConsole;
8686

87+
let logLines = [];
8788
//TODO determine if more messages should be converted to mUser - instead of manually socket.send()'ing them
8889
//TODO allow this to be further filtered with includes/excludes set by app options at runtime
8990
//TODO provide mechanism for this to be a downloadable date-stamped file.
@@ -116,9 +117,13 @@ function log(text = "", type = mStat, socket = null, direction = 0) {
116117
//Send to Launcher log view
117118
let logView = $('log');
118119
//Note scroll position (to see if user has scrolled up), append message, then auto-scroll (down) if bottom was previously in view
119-
let scroll = (logView.scrollTop+1 >= logView.scrollHeight-logView.clientHeight);
120-
logView.innerHTML += stamp(verboseLogging) + text + '<br>';
121-
if (scroll) {logView.scrollTo(0, logView.scrollHeight)}
120+
// console.log(logView.scrollTop);
121+
let scrollTop = logView.scrollTop;
122+
let scroll = (scrollTop+1 >= logView.scrollHeight-logView.clientHeight);
123+
logLines.push(stamp(verboseLogging) + text + '<br>');
124+
if (logLines.length > 250) {logLines.shift()}
125+
logView.innerHTML = logLines.join('');
126+
if (scroll) {logView.scrollTo(0, logView.scrollHeight)} //else {if (scrollTop !== logView.ScrollTop) {logView.scrollTo(0, scrollTop-(logView.scrollTop-scrollTop))}}
122127
}
123128
//Send to Launcher console window
124129
if (type & mdConsole) {console.log(stamp(true) + text)}

loader.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ function loadPropeller(sock, portName, action, payload, debug) {
140140
updatePort(port, {mode: "programming", bSocket: sock});
141141
connect = function() {return Promise.resolve()};
142142
}
143+
// let startTime = Date.now();
143144
// Use connection to download application to the Propeller
144145
connect()
145146
.then(function() {listen(port, true)}) //Enable listener
@@ -168,7 +169,9 @@ function loadPropeller(sock, portName, action, payload, debug) {
168169
.catch(function(e) {log(e.message, mAll, sock, -1)})
169170
.then(function() {if (port.isWireless) return closePort(port, false)})
170171
.catch(function(e) {log(e.message, mAll, sock, -1)})
172+
// .then(function() {let stopTime = Date.now(); log('Processing time: ' + (stopTime-startTime).toString().slice(-5));})
171173
.then(function() {resumeTimedEvents()}) // Resume timed events that were halted earlier
174+
// .catch(function() {let stopTime = Date.now(); log('Processing time: ' + (stopTime-startTime).toString().slice(-5));})
172175
.catch(function() {resumeTimedEvents()});
173176
} else {
174177
// Port not found
@@ -825,7 +828,7 @@ function generateLoaderPacket(loaderType, packetId, clockSpeed, clockMode) {
825828
fBitTime.setUint32(0, Math.round(clockSpeed / finalBaudrate), true); //Final Bit Time (baudrate in clock cycles)
826829
bitTime1_5.setUint32(0, Math.round(((1.5 * clockSpeed) / finalBaudrate) - maxRxSenseError), true); //1.5x Final Bit Time minus maximum start bit sense error
827830
failsafe.setUint32(0, 2 * Math.trunc(clockSpeed / (3 * 4)), true); //Failsafe Timeout (seconds-worth of Loader's Receive loop iterations)
828-
endOfPacket.setUint32(0, Math.round(500 * clockSpeed / finalBaudrate * 10 / 12), true); //EndOfPacket Timeout (500 bytes worth of Loader's Receive loop iterations)
831+
endOfPacket.setUint32(0, Math.round(1000 * clockSpeed / finalBaudrate * 10 / 12), true); //EndOfPacket Timeout (1000 bytes worth of Loader's Receive loop iterations)
829832
sTime.setUint32(0, Math.max(Math.round(clockSpeed * 0.0000006), 14), true); //Minimum EEPROM Start/Stop Condition setup/hold time (400 KHz = 1/0.6 µS); Minimum 14 cycles}
830833
sclHighTime.setUint32(0, Math.max(Math.round(clockSpeed * 0.0000006), 14), true); //Minimum EEPROM SCL high time (400 KHz = 1/0.6 µS); Minimum 14 cycles
831834
sclLowTime.setUint32(0, Math.max(Math.round(clockSpeed * 0.0000013), 14), true); //Minimum EEPROM SCL low time (400 KHz = 1/1.3 µS); Minimum 26 cycles

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "BlocklyProp Launcher",
33
"description": "A Chrome application that connects your Propeller-Powered Hardware to the BlocklyProp website.",
4-
"version": "1.0.1",
4+
"version": "1.0.3",
55
"manifest_version": 2,
66
"minimum_chrome_version": "45",
77

0 commit comments

Comments
 (0)