Skip to content

Commit

Permalink
Merge pull request #121 from PropGit/debug_download4
Browse files Browse the repository at this point in the history
Patch for Mac download problems
  • Loading branch information
PropGit authored May 28, 2020
2 parents afa45ae + dd607e1 commit ccbcd7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const mDbug = mcStatus + mdLog + mdConsole;
const mDeep = mcVerbose + mdConsole;
const mAll = mcUser + mdDisplay + mdLog + mdConsole;

let logLines = [];
//TODO determine if more messages should be converted to mUser - instead of manually socket.send()'ing them
//TODO allow this to be further filtered with includes/excludes set by app options at runtime
//TODO provide mechanism for this to be a downloadable date-stamped file.
Expand Down Expand Up @@ -116,9 +117,13 @@ function log(text = "", type = mStat, socket = null, direction = 0) {
//Send to Launcher log view
let logView = $('log');
//Note scroll position (to see if user has scrolled up), append message, then auto-scroll (down) if bottom was previously in view
let scroll = (logView.scrollTop+1 >= logView.scrollHeight-logView.clientHeight);
logView.innerHTML += stamp(verboseLogging) + text + '<br>';
if (scroll) {logView.scrollTo(0, logView.scrollHeight)}
// console.log(logView.scrollTop);
let scrollTop = logView.scrollTop;
let scroll = (scrollTop+1 >= logView.scrollHeight-logView.clientHeight);
logLines.push(stamp(verboseLogging) + text + '<br>');
if (logLines.length > 250) {logLines.shift()}
logView.innerHTML = logLines.join('');
if (scroll) {logView.scrollTo(0, logView.scrollHeight)} //else {if (scrollTop !== logView.ScrollTop) {logView.scrollTo(0, scrollTop-(logView.scrollTop-scrollTop))}}
}
//Send to Launcher console window
if (type & mdConsole) {console.log(stamp(true) + text)}
Expand Down
5 changes: 4 additions & 1 deletion loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function loadPropeller(sock, portName, action, payload, debug) {
updatePort(port, {mode: "programming", bSocket: sock});
connect = function() {return Promise.resolve()};
}
// let startTime = Date.now();
// Use connection to download application to the Propeller
connect()
.then(function() {listen(port, true)}) //Enable listener
Expand Down Expand Up @@ -168,7 +169,9 @@ function loadPropeller(sock, portName, action, payload, debug) {
.catch(function(e) {log(e.message, mAll, sock, -1)})
.then(function() {if (port.isWireless) return closePort(port, false)})
.catch(function(e) {log(e.message, mAll, sock, -1)})
// .then(function() {let stopTime = Date.now(); log('Processing time: ' + (stopTime-startTime).toString().slice(-5));})
.then(function() {resumeTimedEvents()}) // Resume timed events that were halted earlier
// .catch(function() {let stopTime = Date.now(); log('Processing time: ' + (stopTime-startTime).toString().slice(-5));})
.catch(function() {resumeTimedEvents()});
} else {
// Port not found
Expand Down Expand Up @@ -825,7 +828,7 @@ function generateLoaderPacket(loaderType, packetId, clockSpeed, clockMode) {
fBitTime.setUint32(0, Math.round(clockSpeed / finalBaudrate), true); //Final Bit Time (baudrate in clock cycles)
bitTime1_5.setUint32(0, Math.round(((1.5 * clockSpeed) / finalBaudrate) - maxRxSenseError), true); //1.5x Final Bit Time minus maximum start bit sense error
failsafe.setUint32(0, 2 * Math.trunc(clockSpeed / (3 * 4)), true); //Failsafe Timeout (seconds-worth of Loader's Receive loop iterations)
endOfPacket.setUint32(0, Math.round(500 * clockSpeed / finalBaudrate * 10 / 12), true); //EndOfPacket Timeout (500 bytes worth of Loader's Receive loop iterations)
endOfPacket.setUint32(0, Math.round(1000 * clockSpeed / finalBaudrate * 10 / 12), true); //EndOfPacket Timeout (1000 bytes worth of Loader's Receive loop iterations)
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}
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
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
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "BlocklyProp Launcher",
"description": "A Chrome application that connects your Propeller-Powered Hardware to the BlocklyProp website.",
"version": "1.0.1",
"version": "1.0.3",
"manifest_version": 2,
"minimum_chrome_version": "45",

Expand Down

0 comments on commit ccbcd7c

Please sign in to comment.