Skip to content

Commit

Permalink
release: new Electron v 28 for M3
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed Jan 12, 2024
1 parent cfa9fdb commit b0d0757
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 15 deletions.
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.18" //require("../package.json").version
global.dde_release_date = "Dec 15, 2023" //require("../package.json").release_date
global.dde_version = "3.8.19" //require("../package.json").version
global.dde_release_date = "Jan 11, 2024" //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
2 changes: 1 addition & 1 deletion core/instruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ var Instruction = class Instruction {
else { return parseInt(str) }
}

static extract_instruction_type(oplet_array_or_string){
static extract_instruction_type(oplet_array_or_string){ //oplet single letter
if(typeof(oplet_array_or_string) == "string") {
oplet_array_or_string = oplet_array_or_string.substring(0, oplet_array_or_string.length - 1) //cut the ending semicolon
oplet_array_or_string = oplet_array_or_string.split(" ")
Expand Down
51 changes: 44 additions & 7 deletions core/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ var Socket = class Socket{
}
}

static oplet_array_or_string_to_array_buffer(oplet_array_or_string){
/*static oplet_array_or_string_to_array_buffer(oplet_array_or_string){
let str = this.oplet_array_or_string_to_string(oplet_array_or_string)
return this.string_to_array_buffer(str)
}
}*/

static oplet_array_or_string_to_string(oplet_array_or_string) {
if (typeof(oplet_array_or_string) == "string") { return oplet_array_or_string }
Expand All @@ -199,6 +199,33 @@ var Socket = class Socket{
}
}

//the below should replace oplet_array_or_string_to_string once its proved to work
static oplet_array_or_string_to_variable_length_string(oplet_array_or_string){
if (typeof(oplet_array_or_string) === "string") {
return oplet_array_or_string
}
else {
let op_arr = oplet_array_or_string
let prefix_str = ""
for(let i = 0; i < Instruction.INSTRUCTION_TYPE; i++){ //Instruction.INSTRUCTION_TYPE is 4. We put the LENGTH of the text including the oplet and the space before it into the resulting string
let elt = op_arr[i]
prefix_str += elt + " "
}
//prefix_str ends in a space. and contains up to but not including the oplet
let postfix_str = ""
for (let i = Instruction.INSTRUCTION_TYPE; i < op_arr.length; i++){
let elt = op_arr[i]
if (Number.isNaN(elt)) { elt = "NaN" }
postfix_str += " " + elt
}
postfix_str += ";"
//postfix_str starts with space and ends with semicolon
let len = postfix_str.length
let str = prefix_str + len + postfix_str
return str
}
}

static string_to_array_buffer(str){
var arr_buff = Buffer.alloc(256) //was 128 but no reason not to have it 256
//var view1 = new Uint8Array(arr_buff)
Expand All @@ -210,6 +237,18 @@ var Socket = class Socket{
return arr_buff
}

static string_to_variable_length_array_buffer(str){
let len = str.length
var arr_buff = Buffer.alloc(len) //was 128 but no reason not to have it 256
//var view1 = new Uint8Array(arr_buff)
for(var i = 0; i < len; i++){
let char = str[i]
let code = char.charCodeAt(0)
arr_buff[i] = code
}
return arr_buff
}

static degrees_to_dexter_units_array(arr){
let new_array = []
for(let index = 0; index < arr.length; index++){
Expand Down Expand Up @@ -499,15 +538,16 @@ var Socket = class Socket{
"<br/>extracted job_id:" + job_id + " but no defined Job with that ID.")
}
//out(job_instance.name + " " + robot_name + " Socket.send passed oplet_array_or_string: " + oplet_array_or_string)
const str = Socket.oplet_array_or_string_to_string(oplet_array_or_string_du) //will be replaced with oplet_array_or_string_to_variable_length_string
const arr_buff = Socket.string_to_array_buffer(str)

const str = Socket.oplet_array_or_string_to_string(oplet_array_or_string_du)
if(Instruction.is_F_instruction_string(str)) {
rob.waiting_for_flush_ack = true
}
if(job_instance.keep_history) {
job_instance.sent_instructions_strings.push(str)
}
const arr_buff = Socket.string_to_array_buffer(str)

var sim_actual = Robot.get_simulate_actual(rob.simulate)
if((sim_actual === true) || (sim_actual === "both")){
let sim_inst = DexterSim.robot_name_to_dextersim_instance_map[robot_name]
Expand All @@ -530,10 +570,7 @@ var Socket = class Socket{
let net_soc_inst = Socket.robot_name_to_soc_instance_map[robot_name]
if(net_soc_inst && (net_soc_inst.readyState === "open")) {
try {
//console.log("Socket.send about to send: " + str)
net_soc_inst.write(arr_buff) //if doesn't error, success and we're done with send
//console.log("Socket.send just sent: " + str)
//this.stop_job_if_socket_dead(job_id, robot_name)
if(is_reboot_inst){
job_instance.stop_for_reason("completed", "Dexter.reboot_robot instruction sent.")
warning("Rebooting Dexter." + robot_name + " due to running reboot instruction.")
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.18</span><br/>
released: <span id="dde_release_date_id">Dec 15, 2023</span>
version: <span id="dde_version_id">3.8.19</span><br/>
released: <span id="dde_release_date_id">Jan 11, 2024</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
27 changes: 27 additions & 0 deletions doc/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,33 @@
.doc_details summary { font-weight: 600; }
</style>

<details class="doc_details"><summary>v 3.8.19, Jan 11, 2024</summary>
Highlights: Now works on new Apple Silicon Macs (M1 thru M3)
<ul>
<li> Upgraded Electron platform from version 5 to version 28
and made several "incompatible" fixes to underlying DDE code
to work under the new Election.</li>
<li>Defined (but am not calling) two functions to enable DDE3 to send to dexrun,
variable lengthed strings, which include the number of chars in the string
as an integer. This will help long instructions such as j oplet instructions.<br/>
To experiment with these new definitions, eval:<pre><code>
Socket.string_to_array_buffer =
Socket.string_to_variable_length_array_buffer
Socket.oplet_array_or_string_to_string =
Socket.oplet_array_or_string_to_variable_length_string</code></pre>
Note that this requires a newer version of dexrun on Dexter to process
this new instruction format.<br/>
Note that once these are proven to work, they'll become
the default definitions for string_to_array_buffer & oplet_array_or_string_to_string
in a later DDE3 release.
</li>

<li>For the OpenCV "blur" example under Insert menu/Machine Vision/blur,
improved the documentation from
<i>digested & displayed</i> to <i>blurred & displayed</i>.
</ul>
</details>

<details class="doc_details"><summary>v 3.8.18, Dec 15, 2023</summary>
<ul>
<li>Fixed bug in Vector.DCM_to_quaternian.</li>
Expand Down
2 changes: 1 addition & 1 deletion examples/opencv_blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ content:
.gif, .jpeg or .png<br/>
then click on "show image".<br/>
The image on the left has no cv processing.<br/>
The right is digested & displayed by cv.<br/>
The right is blurred & displayed by cv.<br/>
<input type="file" id="file_input_id"
accept="image/gif, image/jpeg, image/png"/>
<input type="button" value="show images"/> (may have to click twice)
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.18",
"release_date": "Dec 15, 2023",
"version": "3.8.19",
"release_date": "Jan 11, 2024",
"description": "Dexter Development Environment for programming the Dexter robot.",
"author": "Fry",
"license": "GPL-3.0",
Expand Down

0 comments on commit b0d0757

Please sign in to comment.