Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed Nov 24, 2022
1 parent bc3ba75 commit b5828e0
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 37 deletions.
21 changes: 11 additions & 10 deletions core/dexter_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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,<br/>" +
"there is no value for the comment_property key: " + low_key +
"<br/>so we're using the value from Dexter.default." + high_key +
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 +
Expand Down
4 changes: 2 additions & 2 deletions core/index.js
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
1 change: 0 additions & 1 deletion core/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions doc/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<details class="doc_details"><summary>About</summary>
This is <a href="http://hdrobotic.com/" target="_blank">Dexter</a> Development Environment<br/>
version: <span id="dde_version_id">3.8.12</span><br/>
released: <span id="dde_release_date_id">Nov 12, 2022</span>
version: <span id="dde_version_id">3.8.13</span><br/>
released: <span id="dde_release_date_id">Nov 24, 2022</span>
<p></p>
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,
Expand Down
72 changes: 53 additions & 19 deletions doc/ref_man.html
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@
Please use <code>read_file</code> instead.
</details> <!-- end read_file -->

<details id="read_file_async_doc_id" class="doc_details"><summary>read_file_async</summary>
<details id="read_file_async_doc_id" class="doc_details"><summary>read_file_async</summary>
Similar to <a href="#" onclick="open_doc(read_file_doc_id)">read_file</a>
but does not return the
file contents. Instead, it takes an additional argument
Expand All @@ -428,6 +428,23 @@
function(err, content){
out("read_file_async got err: " + err + " content: " + content)
}) </code></pre>
</details>

<details id="FileTransfer.unzip_id" class="doc_details"><summary>unzip</summary>
Creates a folder of the contents of the passed in zip file.<br/>
<i>Parameters:</i><br/>
<b>zip_file_path</b> String of full path. Required
<br/>
<b>unzip_into_folder</b> String. Name of the folder to be created containing
the contents of the zip_file_path.
<br/></br/>
<i>Example:</i><br/>
<code tooltip="not in TestSuite">FileTransfer.unzip("/Users/Fry/Documents/dde_apps/dexchat.zip")</code><br/>
Makes folder: <code>"/Users/Fry/Documents/dde_apps/dexchat"</code><br/>
<span style="color:red;">Warning:</span> this will overwrite an existing folder if any.
<br/><br/>
See also: <a href="#" onclick="open_doc('FileTransfer.zip_folder_id')">FileTransfer.zip_folder</a>

</details>


Expand Down Expand Up @@ -485,25 +502,42 @@
<code>"/srv/samba/share/dde_apps/junk.js"</code> file.
</details>

<details id="FileTransfer.zip_folder_id" class="doc_details"><summary>zip_folder</summary>
Creates a zip file of the contents of the passed in folder.<br/>
<i>Parameter:</i><br/>
<b>path_to_folder_to_zip</b> String of full path. Required
<br/><br/>
<i>Example:</i><br/>
<code tooltip="not in TestSuite">FileTransfer.zip_folder("/Users/Fry/Documents/dde_apps/dexchat")</code><br/>
Makes file: <code>"/Users/Fry/Documents/dde_apps/dexchat.zip"</code>
<br/><br/>
See also: <a href="#" onclick="open_doc('FileTransfer.unzip_id')">FileTransfer.unzip</a>
</details>







<!-- removed for security reasons
<details id="folder_listing_doc_id" style="margin-left:40px;"><summary>folder_listing</summary>
<code>folder_listing</code> retrieves an array of filenames and/or folder names that are somewhere
beneath the <b>dde_apps</b> folder. This function only works if you have
<i>Web Server for Chrome</i> installed. (See the doc for <b>load_files</b>.)<br/>
Arguments:<br/>
<b>folder</b> Default: <code>"/"</code>. The name of the folder to retreive the listing of.
A folder of "/" finds the files and/or folders immediately below the <b>dde_apps</b> folder.
Folder should begin and end with a slash, but if it doesn't, it will be added.<br/>
<b>include_folders</b> Default: <code>true</code>. Retrieved folder names end in slash.<br/>
<b>include_files</b> Default: <code>true</code>.<br/>
<b>callback</b> Default: <code>out</code> A function of one argument. It is passed the
array of file and/or folder names determined by the other arguments.<br/>
Examples:<br/>
<code>folder_listing()</code> Retrieves the files and folders immediately under <code>dde_apps</code>.<br/>
<code>folder_listing("/test_folder/", true, false)</code> Retrieves only the folder names immediately under <code>test_folder</code>.<br/>
<code>folder_listing("/whatever/", false, false)</code> Retrieves nothing. An empty array will be passed to the callback.
</details> -->
<!-- removed for security reasons
<details id="folder_listing_doc_id" style="margin-left:40px;"><summary>folder_listing</summary>
<code>folder_listing</code> retrieves an array of filenames and/or folder names that are somewhere
beneath the <b>dde_apps</b> folder. This function only works if you have
<i>Web Server for Chrome</i> installed. (See the doc for <b>load_files</b>.)<br/>
Arguments:<br/>
<b>folder</b> Default: <code>"/"</code>. The name of the folder to retreive the listing of.
A folder of "/" finds the files and/or folders immediately below the <b>dde_apps</b> folder.
Folder should begin and end with a slash, but if it doesn't, it will be added.<br/>
<b>include_folders</b> Default: <code>true</code>. Retrieved folder names end in slash.<br/>
<b>include_files</b> Default: <code>true</code>.<br/>
<b>callback</b> Default: <code>out</code> A function of one argument. It is passed the
array of file and/or folder names determined by the other arguments.<br/>
Examples:<br/>
<code>folder_listing()</code> Retrieves the files and folders immediately under <code>dde_apps</code>.<br/>
<code>folder_listing("/test_folder/", true, false)</code> Retrieves only the folder names immediately under <code>test_folder</code>.<br/>
<code>folder_listing("/whatever/", false, false)</code> Retrieves nothing. An empty array will be passed to the callback.
</details> -->
</details> <!-- end File Access -->

<details class="doc_details"><summary>Gamepad & Keyboard</summary>
Expand Down
10 changes: 10 additions & 0 deletions doc/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
.doc_details summary { font-weight: 600; }
</style>

<details class="doc_details"><summary>v 3.8.13, Nov 24, 2022</summary>
Highlights: Big fixes to Dexter.defaults, zip file support
<ul>
<li>Fix to <code>Dexter.prototype.defaults_write</code></li>
<li>Fixes to <code>Dexter.prototype.default_high_level_to_defaults_lines</code></li>
<li><code>FileTransfer.zip_folder</code> and <code>FileTransfer.unzip</code>
defined and documented under Ref Man/IO/File Access</li>
</ul>
</details>

<details class="doc_details"><summary>v 3.8.12, Nov 12, 2022</summary>
Highlights: Many fixes for Job Engine to make it more compatible with DDE IDE.
Fixes for Dexter instructions: set_follow_me, set_force_protect
Expand Down
33 changes: 33 additions & 0 deletions file_transfer.js
Original file line number Diff line number Diff line change
@@ -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)
}
}

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<script type="text/javascript" src="picture1.js"></script>
<script type="text/javascript" src="ros_interface.js"></script>
<script type="text/javascript" src="ssh.js"></script>
<!-- <script type="text/javascript" src="file_transfer.js"></script> -->
<script type="text/javascript" src="file_transfer.js"></script>


<link rel="stylesheet" href="ui_widgets/awesomplete.css"/>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit b5828e0

Please sign in to comment.