Skip to content

Commit

Permalink
Merge pull request #46 from PropGit/Programming_Opti2
Browse files Browse the repository at this point in the history
Programming Optimization and Reliability Enhancements
  • Loading branch information
PropGit authored Feb 21, 2018
2 parents bad3626 + 0dc9408 commit 2bc20cc
Show file tree
Hide file tree
Showing 3 changed files with 281 additions and 196 deletions.
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": "0.7.5",
"version": "0.8.0",
"manifest_version": 2,
"minimum_chrome_version": "45",

Expand Down
11 changes: 8 additions & 3 deletions messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ notices = {
[neRAMChecksumFailed] : "RAM checksum failed",
[neEEPROMVerifyFailed] : "EEPROM verify failed",
[neCommunicationLost] : "Communication lost", /*No response*/
[neLoaderFailed] : "Loader failed",
[neLoaderFailed] : "Loader failed", /*Response invalid*/
[neCommunicationFailed] : "Communication failed" /*Response unexpected*/
};

function notice(noticeId = 0, values = []) {
/* Notice (message) retriever. Returns textual message indicated by the noticeId, inserts the optional values into it, and prepends with the noticeId value
in the form ###-<message>.
noticeId is the identifier of the notice; ex: nsDownloading.
values is an optional array of values to stuff into notice.*/
//Retrieve notice; if undefined,
values is an optional array of values to stuff into notice, or if noticeId = 0, is a custom message.*/
//Retrieve notice; if defined
nMsg = notices[noticeId];
//Fill in variables if needed; if notice undefined, use first values element as notice.
values.forEach(function(x){nMsg = (nMsg) ? nMsg.replace(/%s/, x) : x;});
Expand All @@ -97,3 +97,8 @@ function notice(noticeId = 0, values = []) {
nMsg = noticeId.substr(noticeId.length-3) + '-' + nMsg;
return nMsg;
}

function noticeCode(msg) {
/*Extracts and returns notice code from msg formatted in the form ###-<message>. Returns "000" if none.*/
return Number((results = msg.match(/[0-9]+/)) ? results[0] : "000");
}
Loading

0 comments on commit 2bc20cc

Please sign in to comment.