diff --git a/core/dexter_defaults.js b/core/dexter_defaults.js index fd37dd38..a2fcf23e 100644 --- a/core/dexter_defaults.js +++ b/core/dexter_defaults.js @@ -65,11 +65,10 @@ Dexter.prototype.defaults_read = function(callback = null){ read_file_async(the_url, undefined, normal_defaults_read_cb) } -//caution: not ready for prime time. Dexter.prototype.defaults_write = function(){ - Dexter.dexter0.defaults_high_level_to_defaults_lines() - let the_url = Dexter.prototype.defaults_url() - let content = this.defaults.get("whole_file_string") + this.defaults_high_level_to_defaults_lines() + let the_url = this.defaults_url() + let content = this.defaults_get("whole_file_string") let the_dex_inst = this write_file_async(the_url, content, function(err){ @@ -873,7 +872,9 @@ Dexter.prototype.defaults_line_to_high_level = function(line, line_number="unkno (parsed_line.kind === "colonless_comment_prop")) { if(parsed_line.value_array) {high_value = parsed_line.value_array[0]} else { - high_value = Dexter.defaults[high_key] + high_value = Dexter.defaults[high_key] //todo bug: noah reports that Dexter.defaults + //is unbound. So before calling defaults_read, we need to get that + //Dexter.defaults bound and filled up SO that we can steal "high_value" from it. warning("While parsing the Defaults.make_ins file,
" + "there is no value for the comment_property key: " + low_key + "
so we're using the value from Dexter.default." + high_key + @@ -1057,9 +1058,9 @@ Dexter.defaults_high_key_to_j_key = function(key, joint_number){ else { return "J" + joint_number + key} } -Dexter.prototype.defaults_compute_parsed_lines = function(){ +Dexter.prototype.defaults_compute_parsed_lines = function() { let parsed_lines = [] - for(let i = 0; i < this.defaults_lines.length; i++){ + for (let i = 0; i < this.defaults_lines.length; i++) { let line = this.defaults_lines[i] let parsed_line = Dexter.defaults_parse_line(line, i) parsed_lines.push(parsed_line) @@ -1191,17 +1192,17 @@ Dexter.prototype.defaults_high_level_to_defaults_lines = function(){ low_val_str = low_val } else { - ins_arr.concat(high_val) + ins_arr = ins_arr.concat(high_val) let dde_ins_arr = Socket.instruction_array_degrees_to_arcseconds_maybe(ins_arr, this) let low_val = dde_ins_arr.slice(Instruction.INSTRUCTION_ARG1) - let low_val_str = low_val.join(Dexter.defaults_arg_sep) + low_val_str = low_val.join(Dexter.defaults_arg_sep) } } else { ins_arr[Instruction.INSTRUCTION_ARG1] = high_val let dde_ins_arr = Socket.instruction_array_degrees_to_arcseconds_maybe(ins_arr, this) let low_val = dde_ins_arr[Instruction.INSTRUCTION_ARG1] - let low_val_str = low_val + low_val_str = low_val } let new_line = "S" + Dexter.defaults_arg_sep + high_key + Dexter.defaults_arg_sep + low_val_str + diff --git a/core/index.js b/core/index.js index 2e71dc48..db70b889 100644 --- a/core/index.js +++ b/core/index.js @@ -1,5 +1,5 @@ -global.dde_version = "3.8.12" //require("../package.json").version -global.dde_release_date = "Nov 12, 2022" //require("../package.json").release_date +global.dde_version = "3.8.13" //require("../package.json").version +global.dde_release_date = "Nov 24, 2022" //require("../package.json").release_date console.log("dde_version: " + global.dde_version + " dde_release_date: " + global.dde_release_date + "\nRead electron_dde/core/job_engine_doc.txt for how to use the Job Engine.\n") diff --git a/core/storage.js b/core/storage.js index bc4f142d..6798b310 100644 --- a/core/storage.js +++ b/core/storage.js @@ -1328,7 +1328,6 @@ module.exports.init_storage = init_storage function running_on_dexter() { //dde4 added /*console.log("globalThis['fs' is: " + globalThis["fs"]) - debugger; if(globalThis["fs"] && globalThis.fs["existsSync"]) { return globalThis.fs.existsSync(SHARE_FOLDER) } diff --git a/doc/guide.html b/doc/guide.html index 5973c856..4de41d29 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -8,8 +8,8 @@
About This is Dexter Development Environment
- version: 3.8.12
- released: Nov 12, 2022 + version: 3.8.13
+ released: Nov 24, 2022

DDE helps you create, debug, and send software to a Dexter robot. You can use any JavaScript augmented with DDE-specific functions to help find out about, diff --git a/doc/ref_man.html b/doc/ref_man.html index d96ac600..2fe82d94 100644 --- a/doc/ref_man.html +++ b/doc/ref_man.html @@ -413,7 +413,7 @@ Please use read_file instead.
-
read_file_async +
read_file_async Similar to read_file but does not return the file contents. Instead, it takes an additional argument @@ -428,6 +428,23 @@ function(err, content){ out("read_file_async got err: " + err + " content: " + content) }) +
+ +
unzip + Creates a folder of the contents of the passed in zip file.
+ Parameters:
+ zip_file_path String of full path. Required +
+ unzip_into_folder String. Name of the folder to be created containing + the contents of the zip_file_path. +

+ Example:
+ FileTransfer.unzip("/Users/Fry/Documents/dde_apps/dexchat.zip")
+ Makes folder: "/Users/Fry/Documents/dde_apps/dexchat"
+ Warning: this will overwrite an existing folder if any. +

+ See also: FileTransfer.zip_folder +
@@ -485,25 +502,42 @@ "/srv/samba/share/dde_apps/junk.js" file.
+
zip_folder + Creates a zip file of the contents of the passed in folder.
+ Parameter:
+ path_to_folder_to_zip String of full path. Required +

+ Example:
+ FileTransfer.zip_folder("/Users/Fry/Documents/dde_apps/dexchat")
+ Makes file: "/Users/Fry/Documents/dde_apps/dexchat.zip" +

+ See also: FileTransfer.unzip +
+ + + + + + - +
Gamepad & Keyboard diff --git a/doc/release_notes.html b/doc/release_notes.html index 79dcf2eb..e1e527d6 100644 --- a/doc/release_notes.html +++ b/doc/release_notes.html @@ -6,6 +6,16 @@ .doc_details summary { font-weight: 600; } +
v 3.8.13, Nov 24, 2022 +Highlights: Big fixes to Dexter.defaults, zip file support + +
+
v 3.8.12, Nov 12, 2022 Highlights: Many fixes for Job Engine to make it more compatible with DDE IDE. Fixes for Dexter instructions: set_follow_me, set_force_protect diff --git a/file_transfer.js b/file_transfer.js new file mode 100644 index 00000000..061619b4 --- /dev/null +++ b/file_transfer.js @@ -0,0 +1,33 @@ +const AdmZip = require('adm-zip') + +var FileTransfer = class FileTransfer { + + //create the zip file containing the update + //path is the path to the folder that represents slash on Dexter + //https://github.com/cthackers/adm-zip/wiki/ADM-ZIP-Introduction + static zip_folder(path_to_folder_to_zip) { + let zip = new AdmZip(); + zip.addLocalFolder(path_to_folder_to_zip) + zip.writeZip(path_to_folder_to_zip + ".zip") + out(path_to_folder_to_zip + ".zip created.") + } + + //zip_file_path expected to end in .zip + //unzips files into a new folder having the same file name as the zip_file_path + //(excluding the .zip) + //That new folder will be put under folder_for_folder_of_files. + static unzip(zip_file_path, unzip_into_folder) { + if (!unzip_into_folder) { + unzip_into_folder = dde_apps_folder + "/firmware_unzipped" + } + //let file_name = this.path_to_file_name(zip_file_path) + //file_name = file_name.substring(0, file_name.length - 4) //remove the .zip extension + //folder_for_files = dde_apps_folder + "/" + file_name + //} + out("Unzipping: " + zip_file_path + " into: " + unzip_into_folder) + let zip = new AdmZip(zip_file_path); + zip.extractAllTo(unzip_into_folder, true) //true means overwrite if folder already exists + out("Unzipped: " + zip_file_path + " into: " + unzip_into_folder) + } +} + diff --git a/index.html b/index.html index 6bef3a89..1b2e6873 100644 --- a/index.html +++ b/index.html @@ -130,7 +130,7 @@ - + diff --git a/package.json b/package.json index 4cdbe7f2..e44c2cc3 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "dexter_dev_env", "productName": "dexter_dev_env", - "version": "3.8.12", - "release_date": "Nov 12, 2022", + "version": "3.8.13", + "release_date": "Nov 24, 2022", "description": "Dexter Development Environment for programming the Dexter robot.", "author": "Fry", "license": "GPL-3.0",