Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed Jan 14, 2021
1 parent cb1f25c commit fdf3bb4
Show file tree
Hide file tree
Showing 33 changed files with 1,024 additions and 338 deletions.
12 changes: 6 additions & 6 deletions core/dextersim.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ DexterSim = class DexterSim{

//sim_actual passed in is either true or "both"
//called by Socket
static create_or_just_init(robot_name, sim_actual = "required"){
static create_or_just_init(robot_name, sim_actual = "required", connect_success_cb){
if (!DexterSim.robot_name_to_dextersim_instance_map){
DexterSim.init_all()
}
var sim_inst = DexterSim.robot_name_to_dextersim_instance_map[robot_name]
if(!sim_inst) { sim_inst = new DexterSim(robot_name) }
sim_inst.init(sim_actual)
if (sim_actual === true) { //do not call new_socket_callback if simulate is "both" because we don't want to call it twice
Socket.new_socket_callback(robot_name, connect_success_cb)
}
}

static init_all(){ //called once per DDE session (normally)
Expand Down Expand Up @@ -53,9 +56,6 @@ DexterSim = class DexterSim{
this.velocity_arcseconds_per_second = [0,0,0,0,0,0,0]

this.now_processing_instruction = null // a Dexter can only be doing at most 1 instruction at a time. This is it.
if (this.sim_actual === true) { //do not call new_socket_callback if simulate is "both" because we don't want to call it twice
Socket.new_socket_callback(this.robot_name)
}
}

static stop_all_sims(){
Expand Down Expand Up @@ -137,7 +137,7 @@ DexterSim = class DexterSim{
break;
case "g":
let inst_status_mode = instruction_array[Instruction.INSTRUCTION_ARG0]
if((inst_status_mode === null) || (inst_status_mode === undefined)){} //don't change existing sim_inst.status_mode
if((inst_status_mode === null) || (inst_status_mode === undefined)){ sim_inst.status_mode = 0} //helps backwards compatibility pre status modes.
else { sim_inst.status_mode = inst_status_mode }
sim_inst.ack_reply(instruction_array)
break;
Expand Down Expand Up @@ -403,7 +403,7 @@ DexterSim = class DexterSim{
else if (oplet === "W") {}
else if (oplet === "z") {} //just let process_next_instructions trigger the next instruction after the ending_time_of_cur_instruction
//below handles "a", "P", "T"
else if(global.job_or_robot_to_simulate_id) { //window.platform == "dde") //even if we're in dde, unless the sim pane is up, don't attempt to render
else if(SimUtils.is_simulator_showing()) { //window.platform == "dde") //even if we're in dde, unless the sim pane is up, don't attempt to render
//SimUtils.render_once(robot_status, job_name, rob_name) //renders after dur, ie when the dexter move is completed.
SimUtils.render_multi(this, ins_args, job_name, rob_name, undefined, dur)
}
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.7.1"
global.dde_release_date = "Dec 27, 2020"
global.dde_version = "3.7.2"
global.dde_release_date = "Jan 13, 2021"

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
12 changes: 8 additions & 4 deletions core/instruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3102,14 +3102,18 @@ Instruction.wait_until = class wait_until extends Instruction{
}
}
else if (typeof(this.fn_date_dur) == "number"){ //number is seconds
if (this.start_time_in_ms == null) { this.start_time_in_ms = Date.now() } //hits the first time this do_item is called for an inst
let dur_from_start_in_ms = Date.now() - this.start_time_in_ms
let the_now_in_ms = Date.now()
if (this.start_time_in_ms == null) { this.start_time_in_ms = the_now_in_ms } //hits the first time this do_item is called for an inst
let dur_from_start_in_ms = the_now_in_ms - this.start_time_in_ms
if (dur_from_start_in_ms >= this.fn_date_dur * 1000){ //The wait is over. dur_from_start_in_ms is in ms, fn_date_dur is in seconds
job_instance.wait_reason = null
job_instance.set_status_code("running")
this.init_instruction() //essential for the 2nd thru nth call to start() for this job.
job_instance.set_up_next_do(1)
}
}/* this 'keep alive/ clause should be unnecessary because if the socket times out, the
//Socket.send method will reconnect the socket when the next send to dexter instruction comes through.
//We'd need that socket code anyway for other do_lists that have long running sections
//that don't involve sending instructions to dexter for a long period.
else if ((job_instance.robot instanceof Dexter) && (dur_from_start_in_ms > 1000)){
//so that we can keep the tcp connection alive, send a virtual heartbeat
let new_wait_dur_in_sec = this.fn_date_dur - (dur_from_start_in_ms / 1000)
Expand All @@ -3120,7 +3124,7 @@ Instruction.wait_until = class wait_until extends Instruction{
job_instance.wait_reason = null
job_instance.set_status_code("running")
job_instance.set_up_next_do(1)
}
}*/
else {
job_instance.set_status_code("waiting", "a wait_until duration of: " + this.fn_date_dur + " seconds")
job_instance.set_up_next_do(0)
Expand Down
13 changes: 5 additions & 8 deletions core/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,6 @@ Job.all_names = [] //maintained in both UI and sandbox/ used by replacement seri
Job.remember_job_name = function(job_name){
if (!Job.all_names.includes(job_name)){
Job.all_names.push(job_name)
if(window["job_or_robot_to_simulate_id"]){
refresh_job_or_robot_to_simulate_id()
//let a_option = document.createElement("option");
//a_option.innerText = "Job." + job_name
//job_or_robot_to_simulate_id.prepend(a_option)
}
}
}

Expand Down Expand Up @@ -1896,8 +1890,8 @@ Job.prototype.do_next_item = function(){ //user calls this when they want the jo
//is not true (from "else if" above). So while we have more, set status to running
this.set_status_code("running")
}
let cur_do_item = this.current_instruction()
try {
let cur_do_item = this.current_instruction()
//onsole.log("do_next_item cur_do_item: " + cur_do_item)
this.show_progress_maybe()
this.select_instruction_maybe(cur_do_item)
Expand Down Expand Up @@ -2035,7 +2029,10 @@ Job.prototype.do_next_item = function(){ //user calls this when they want the jo
catch(err){ //this can happen when, for instance a fn def on the do_list is called and it contains an unbound var ref
//this.stop_for_reason("errored", err.message) //let do_next_item loop around and stop normally
//this.set_up_next_do(0)
warning("Error running instruction: " + err.message)
warning("Error running instruction: " + this.program_counter +
" with source: " + to_source_code({value: cur_do_item}) +
" in Job." + this.name +
" of:<br/>" + err.message)
if(this.if_instruction_error){
//note instruction_to_run_when_error can be a single instruction or an array
//of instructions. If its an array, we insert it as just one instruction,
Expand Down
Loading

0 comments on commit fdf3bb4

Please sign in to comment.