Use old and new copies of local memory instead of shmem and local copy in all input checks. All write operations are performed to shared memory. --- src/emc/usr_intf/halui.cc | 244 ++++++++++++++++++++++---------------------- 1 files changed, 122 insertions(+), 122 deletions(-)
diff --git a/src/emc/usr_intf/halui.cc b/src/emc/usr_intf/halui.cc index 9133eff..7ae49ee 100644 --- a/src/emc/usr_intf/halui.cc +++ b/src/emc/usr_intf/halui.cc @@ -1626,32 +1626,32 @@ static void hal_init_pins() { int joint; - old_halui_data.machine_on = *(halui_data->machine_on) = 0; - old_halui_data.machine_off = *(halui_data->machine_off) = 0; + (*halui_old->machine_on) = *(halui_data->machine_on) = 0; + (*halui_old->machine_off) = *(halui_data->machine_off) = 0; - old_halui_data.estop_activate = *(halui_data->estop_activate) = 0; - old_halui_data.estop_reset = *(halui_data->estop_reset) = 0; + (*halui_old->estop_activate) = *(halui_data->estop_activate) = 0; + (*halui_old->estop_reset) = *(halui_data->estop_reset) = 0; for (joint=0; joint < num_axes; joint++) { - *(halui_data->joint_home[joint]) = old_halui_data.joint_home[joint] = 0; - *(halui_data->joint_unhome[joint]) = old_halui_data.joint_unhome[joint] = 0; - *(halui_data->joint_nr_select[joint]) = old_halui_data.joint_nr_select[joint] = 0; - *(halui_data->jog_minus[joint]) = old_halui_data.jog_minus[joint] = 0; - *(halui_data->jog_plus[joint]) = old_halui_data.jog_plus[joint] = 0; - *(halui_data->jog_analog[joint]) = old_halui_data.jog_analog[joint] = 0; + *(halui_data->joint_home[joint]) = (*halui_old->joint_home)[joint] = 0; + *(halui_data->joint_unhome[joint]) = (*halui_old->joint_unhome)[joint] = 0; + *(halui_data->joint_nr_select[joint]) = (*halui_old->joint_nr_select)[joint] = 0; + *(halui_data->jog_minus[joint]) = (*halui_old->jog_minus)[joint] = 0; + *(halui_data->jog_plus[joint]) = (*halui_old->jog_plus)[joint] = 0; + *(halui_data->jog_analog[joint]) = (*halui_old->jog_analog)[joint] = 0; } - *(halui_data->joint_home[num_axes]) = old_halui_data.joint_home[num_axes] = 0; - *(halui_data->jog_minus[num_axes]) = old_halui_data.jog_minus[num_axes] = 0; - *(halui_data->jog_plus[num_axes]) = old_halui_data.jog_plus[num_axes] = 0; + *(halui_data->joint_home[num_axes]) = (*halui_old->joint_home)[num_axes] = 0; + *(halui_data->jog_minus[num_axes]) = (*halui_old->jog_minus)[num_axes] = 0; + *(halui_data->jog_plus[num_axes]) = (*halui_old->jog_plus)[num_axes] = 0; *(halui_data->jog_deadband) = 0.2; *(halui_data->jog_speed) = 0; *(halui_data->joint_selected) = 0; // select joint 0 by default - *(halui_data->fo_scale) = old_halui_data.fo_scale = 0.1; //sane default - *(halui_data->so_scale) = old_halui_data.so_scale = 0.1; //sane default + *(halui_data->fo_scale) = (*halui_old->fo_scale) = 0.1; //sane default + *(halui_data->so_scale) = (*halui_old->so_scale) = 0.1; //sane default } static int check_bit_changed(hal_bit_t *halpin, hal_bit_t *oldpin) { @@ -1685,223 +1685,223 @@ static void check_hal_changes() } //check if machine_on pin has changed (the rest work exactly the same) - if (check_bit_changed(halui_data->machine_on, &(old_halui_data.machine_on)) != 0) + if (check_bit_changed(halui_new->machine_on, ((halui_old->machine_on))) != 0) sendMachineOn(); //send MachineOn NML command - if (check_bit_changed(halui_data->machine_off, &(old_halui_data.machine_off)) != 0) + if (check_bit_changed(halui_new->machine_off, ((halui_old->machine_off))) != 0) sendMachineOff(); - if (check_bit_changed(halui_data->estop_activate, &(old_halui_data.estop_activate)) != 0) + if (check_bit_changed(halui_new->estop_activate, ((halui_old->estop_activate))) != 0) sendEstop(); - if (check_bit_changed(halui_data->estop_reset, &(old_halui_data.estop_reset)) != 0) + if (check_bit_changed(halui_new->estop_reset, ((halui_old->estop_reset))) != 0) sendEstopReset(); - if (check_bit_changed(halui_data->mode_manual, &(old_halui_data.mode_manual)) != 0) + if (check_bit_changed(halui_new->mode_manual, ((halui_old->mode_manual))) != 0) sendManual(); - if (check_bit_changed(halui_data->mode_auto, &(old_halui_data.mode_auto)) != 0) + if (check_bit_changed(halui_new->mode_auto, ((halui_old->mode_auto))) != 0) sendAuto(); - if (check_bit_changed(halui_data->mode_mdi, &(old_halui_data.mode_mdi)) != 0) + if (check_bit_changed(halui_new->mode_mdi, ((halui_old->mode_mdi))) != 0) sendMdi(); - if (check_bit_changed(halui_data->mode_teleop, &(old_halui_data.mode_teleop)) != 0) + if (check_bit_changed(halui_new->mode_teleop, ((halui_old->mode_teleop))) != 0) sendTeleop(); - if (check_bit_changed(halui_data->mode_joint, &(old_halui_data.mode_joint)) != 0) + if (check_bit_changed(halui_new->mode_joint, ((halui_old->mode_joint))) != 0) sendJoint(); - if (check_bit_changed(halui_data->mist_on, &(old_halui_data.mist_on)) != 0) + if (check_bit_changed(halui_new->mist_on, ((halui_old->mist_on))) != 0) sendMistOn(); - if (check_bit_changed(halui_data->mist_off, &(old_halui_data.mist_off)) != 0) + if (check_bit_changed(halui_new->mist_off, ((halui_old->mist_off))) != 0) sendMistOff(); - if (check_bit_changed(halui_data->flood_on, &(old_halui_data.flood_on)) != 0) + if (check_bit_changed(halui_new->flood_on, ((halui_old->flood_on))) != 0) sendFloodOn(); - if (check_bit_changed(halui_data->flood_off, &(old_halui_data.flood_off)) != 0) + if (check_bit_changed(halui_new->flood_off, ((halui_old->flood_off))) != 0) sendFloodOff(); - if (check_bit_changed(halui_data->lube_on, &(old_halui_data.lube_on)) != 0) + if (check_bit_changed(halui_new->lube_on, ((halui_old->lube_on))) != 0) sendLubeOn(); - if (check_bit_changed(halui_data->lube_off, &(old_halui_data.lube_off)) != 0) + if (check_bit_changed(halui_new->lube_off, ((halui_old->lube_off))) != 0) sendLubeOff(); - if (check_bit_changed(halui_data->program_run, &(old_halui_data.program_run)) != 0) + if (check_bit_changed(halui_new->program_run, ((halui_old->program_run))) != 0) sendProgramRun(0); - if (check_bit_changed(halui_data->program_pause, &(old_halui_data.program_pause)) != 0) + if (check_bit_changed(halui_new->program_pause, ((halui_old->program_pause))) != 0) sendProgramPause(); - if (check_bit_changed(halui_data->program_os_on, &(old_halui_data.program_os_on)) != 0) + if (check_bit_changed(halui_new->program_os_on, ((halui_old->program_os_on))) != 0) sendSetOptionalStop(ON); - if (check_bit_changed(halui_data->program_os_off, &(old_halui_data.program_os_off)) != 0) + if (check_bit_changed(halui_new->program_os_off, ((halui_old->program_os_off))) != 0) sendSetOptionalStop(OFF); - if (check_bit_changed(halui_data->program_bd_on, &(old_halui_data.program_bd_on)) != 0) + if (check_bit_changed(halui_new->program_bd_on, ((halui_old->program_bd_on))) != 0) sendSetBlockDelete(ON); - if (check_bit_changed(halui_data->program_bd_off, &(old_halui_data.program_bd_off)) != 0) + if (check_bit_changed(halui_new->program_bd_off, ((halui_old->program_bd_off))) != 0) sendSetBlockDelete(OFF); - if (check_bit_changed(halui_data->program_resume, &(old_halui_data.program_resume)) != 0) + if (check_bit_changed(halui_new->program_resume, ((halui_old->program_resume))) != 0) sendProgramResume(); - if (check_bit_changed(halui_data->program_step, &(old_halui_data.program_step)) != 0) + if (check_bit_changed(halui_new->program_step, ((halui_old->program_step))) != 0) sendProgramStep(); - if (check_bit_changed(halui_data->program_stop, &(old_halui_data.program_stop)) != 0) + if (check_bit_changed(halui_new->program_stop, ((halui_old->program_stop))) != 0) sendAbort(); //max-velocity stuff - counts = *halui_data->mv_counts; - if (counts != old_halui_data.mv_counts) { - if (*halui_data->mv_count_enable) { - if (*halui_data->mv_direct_value) { - sendMaxVelocity(counts * *halui_data->mv_scale); + counts = *halui_new->mv_counts; + if (counts != (*halui_old->mv_counts)) { + if (*halui_new->mv_count_enable) { + if (*halui_new->mv_direct_value) { + sendMaxVelocity(counts * *halui_new->mv_scale); } else { - sendMaxVelocity( *halui_data->mv_value + (counts - old_halui_data.mv_counts) * - *halui_data->mv_scale); + sendMaxVelocity( *halui_new->mv_value + (counts - (*halui_old->mv_counts)) * + *halui_new->mv_scale); } } - old_halui_data.mv_counts = counts; + (*halui_old->mv_counts) = counts; } //feed-override stuff - counts = *halui_data->fo_counts; - if (counts != old_halui_data.fo_counts) { - if (*halui_data->fo_count_enable) { - if (*halui_data->fo_direct_value) { - sendFeedOverride(counts * *halui_data->fo_scale); + counts = *halui_new->fo_counts; + if (counts != (*halui_old->fo_counts)) { + if (*halui_new->fo_count_enable) { + if (*halui_new->fo_direct_value) { + sendFeedOverride(counts * *halui_new->fo_scale); } else { - sendFeedOverride( *halui_data->fo_value + (counts - old_halui_data.fo_counts) * - *halui_data->fo_scale); + sendFeedOverride( *halui_new->fo_value + (counts - (*halui_old->fo_counts)) * + *halui_new->fo_scale); } } - old_halui_data.fo_counts = counts; + (*halui_old->fo_counts) = counts; } //spindle-override stuff - counts = *halui_data->so_counts; - if (counts != old_halui_data.so_counts) { - if (*halui_data->so_count_enable) { - if (*halui_data->so_direct_value) { - sendSpindleOverride(counts * *halui_data->so_scale); + counts = *halui_new->so_counts; + if (counts != (*halui_old->so_counts)) { + if (*halui_new->so_count_enable) { + if (*halui_new->so_direct_value) { + sendSpindleOverride(counts * *halui_new->so_scale); } else { - sendSpindleOverride( *halui_data->so_value + (counts - old_halui_data.so_counts) * - *halui_data->so_scale); + sendSpindleOverride( *halui_new->so_value + (counts - (*halui_old->so_counts)) * + *halui_new->so_scale); } } - old_halui_data.so_counts = counts; + (*halui_old->so_counts) = counts; } - if (check_bit_changed(halui_data->mv_increase, &(old_halui_data.mv_increase)) != 0) - sendMaxVelocity(*halui_data->mv_value + *halui_data->mv_scale); - if (check_bit_changed(halui_data->mv_decrease, &(old_halui_data.mv_decrease)) != 0) - sendMaxVelocity(*halui_data->mv_value - *halui_data->mv_scale); + if (check_bit_changed(halui_new->mv_increase, ((halui_old->mv_increase))) != 0) + sendMaxVelocity(*halui_new->mv_value + *halui_new->mv_scale); + if (check_bit_changed(halui_new->mv_decrease, ((halui_old->mv_decrease))) != 0) + sendMaxVelocity(*halui_new->mv_value - *halui_new->mv_scale); - if (check_bit_changed(halui_data->fo_increase, &(old_halui_data.fo_increase)) != 0) - sendFeedOverride(*halui_data->fo_value + *halui_data->fo_scale); - if (check_bit_changed(halui_data->fo_decrease, &(old_halui_data.fo_decrease)) != 0) - sendFeedOverride(*halui_data->fo_value - *halui_data->fo_scale); + if (check_bit_changed(halui_new->fo_increase, ((halui_old->fo_increase))) != 0) + sendFeedOverride(*halui_new->fo_value + *halui_new->fo_scale); + if (check_bit_changed(halui_new->fo_decrease, ((halui_old->fo_decrease))) != 0) + sendFeedOverride(*halui_new->fo_value - *halui_new->fo_scale); - if (check_bit_changed(halui_data->so_increase, &(old_halui_data.so_increase)) != 0) - sendSpindleOverride(*halui_data->so_value + *halui_data->so_scale); - if (check_bit_changed(halui_data->so_decrease, &(old_halui_data.so_decrease)) != 0) - sendSpindleOverride(*halui_data->so_value - *halui_data->so_scale); + if (check_bit_changed(halui_new->so_increase, ((halui_old->so_increase))) != 0) + sendSpindleOverride(*halui_new->so_value + *halui_new->so_scale); + if (check_bit_changed(halui_new->so_decrease, ((halui_old->so_decrease))) != 0) + sendSpindleOverride(*halui_new->so_value - *halui_new->so_scale); //spindle stuff - if (check_bit_changed(halui_data->spindle_start, &(old_halui_data.spindle_start)) != 0) + if (check_bit_changed(halui_new->spindle_start, ((halui_old->spindle_start))) != 0) sendSpindleForward(); - if (check_bit_changed(halui_data->spindle_stop, &(old_halui_data.spindle_stop)) != 0) + if (check_bit_changed(halui_new->spindle_stop, ((halui_old->spindle_stop))) != 0) sendSpindleOff(); - if (check_bit_changed(halui_data->spindle_forward, &(old_halui_data.spindle_forward)) != 0) + if (check_bit_changed(halui_new->spindle_forward, ((halui_old->spindle_forward))) != 0) sendSpindleForward(); - if (check_bit_changed(halui_data->spindle_reverse, &(old_halui_data.spindle_reverse)) != 0) + if (check_bit_changed(halui_new->spindle_reverse, ((halui_old->spindle_reverse))) != 0) sendSpindleReverse(); - bit = *(halui_data->spindle_increase); - if (bit != old_halui_data.spindle_increase) { + bit = *(halui_new->spindle_increase); + if (bit != (*halui_old->spindle_increase)) { if (bit != 0) sendSpindleIncrease(); if (bit == 0) sendSpindleConstant(); - old_halui_data.spindle_increase = bit; + (*halui_old->spindle_increase) = bit; } - bit = *(halui_data->spindle_decrease); - if (bit != old_halui_data.spindle_decrease) { + bit = *(halui_new->spindle_decrease); + if (bit != (*halui_old->spindle_decrease)) { if (bit != 0) sendSpindleDecrease(); if (bit == 0) sendSpindleConstant(); - old_halui_data.spindle_decrease = bit; + (*halui_old->spindle_decrease) = bit; } - if (check_bit_changed(halui_data->spindle_brake_on, &(old_halui_data.spindle_brake_on)) != 0) + if (check_bit_changed(halui_new->spindle_brake_on, ((halui_old->spindle_brake_on))) != 0) sendBrakeEngage(); - if (check_bit_changed(halui_data->spindle_brake_off, &(old_halui_data.spindle_brake_off)) != 0) + if (check_bit_changed(halui_new->spindle_brake_off, ((halui_old->spindle_brake_off))) != 0) sendBrakeRelease(); - if (check_bit_changed(halui_data->abort, &(old_halui_data.abort)) != 0) + if (check_bit_changed(halui_new->abort, ((halui_old->abort))) != 0) sendAbort(); - if (check_bit_changed(halui_data->home_all, &(old_halui_data.home_all)) != 0) + if (check_bit_changed(halui_new->home_all, ((halui_old->home_all))) != 0) sendHome(-1); // joint stuff (selection, homing..) select_changed = -1; // flag to see if the selected joint changed for (joint=0; joint < num_axes; joint++) { - if (check_bit_changed(halui_data->joint_home[joint], &(old_halui_data.joint_home[joint])) != 0) + if (check_bit_changed(halui_new->joint_home[joint], ((halui_old->joint_home)[joint])) != 0) sendHome(joint); - if (check_bit_changed(halui_data->joint_unhome[joint], &(old_halui_data.joint_unhome[joint])) != 0) + if (check_bit_changed(halui_new->joint_unhome[joint], ((halui_old->joint_unhome)[joint])) != 0) sendUnhome(joint); - bit = *(halui_data->jog_minus[joint]); - if (bit != old_halui_data.jog_minus[joint]) { + bit = *(halui_new->jog_minus[joint]); + if (bit != (*halui_old->jog_minus)[joint]) { if (bit != 0) - sendJogCont(joint,-*(halui_data->jog_speed)); + sendJogCont(joint,-*(halui_new->jog_speed)); else sendJogStop(joint); - old_halui_data.jog_minus[joint] = bit; + (*halui_old->jog_minus)[joint] = bit; } - bit = *(halui_data->jog_plus[joint]); - if (bit != old_halui_data.jog_plus[joint]) { + bit = *(halui_new->jog_plus[joint]); + if (bit != (*halui_old->jog_plus)[joint]) { if (bit != 0) - sendJogCont(joint,*(halui_data->jog_speed)); + sendJogCont(joint,*(halui_new->jog_speed)); else sendJogStop(joint); - old_halui_data.jog_plus[joint] = bit; + (*halui_old->jog_plus)[joint] = bit; } - floatt = *(halui_data->jog_analog[joint]); - if (floatt != old_halui_data.jog_analog[joint]) { - if (fabs(floatt) > *(halui_data->jog_deadband)) - sendJogCont(joint,*(halui_data->jog_speed) * *(halui_data->jog_analog[joint])); + floatt = *(halui_new->jog_analog[joint]); + if (floatt != (*halui_old->jog_analog)[joint]) { + if (fabs(floatt) > *(halui_new->jog_deadband)) + sendJogCont(joint,*(halui_new->jog_speed) * *(halui_new->jog_analog[joint])); else sendJogStop(joint); - old_halui_data.jog_analog[joint] = floatt; + (*halui_old->jog_analog)[joint] = floatt; } // check to see if another joint has been selected - bit = *(halui_data->joint_nr_select[joint]); - if (bit != old_halui_data.joint_nr_select[joint]) { + bit = *(halui_new->joint_nr_select[joint]); + if (bit != (*halui_old->joint_nr_select)[joint]) { if (bit != 0) { *(halui_data->joint_selected) = joint; select_changed = joint; // flag that we changed the selected joint } - old_halui_data.joint_home[joint] = bit; + (*halui_old->joint_home)[joint] = bit; } } @@ -1915,34 +1915,34 @@ static void check_hal_changes() } } - if (check_bit_changed(halui_data->joint_home[num_axes], &(old_halui_data.joint_home[num_axes])) != 0) - sendHome(*(halui_data->joint_selected)); + if (check_bit_changed(halui_new->joint_home[num_axes], ((halui_old->joint_home)[num_axes])) != 0) + sendHome(*(halui_new->joint_selected)); - if (check_bit_changed(halui_data->joint_unhome[num_axes], &(old_halui_data.joint_unhome[num_axes])) != 0) - sendUnhome(*(halui_data->joint_selected)); + if (check_bit_changed(halui_new->joint_unhome[num_axes], ((halui_old->joint_unhome)[num_axes])) != 0) + sendUnhome(*(halui_new->joint_selected)); - bit = *(halui_data->jog_minus[num_axes]); - js = *(halui_data->joint_selected); - if (bit != old_halui_data.jog_minus[num_axes]) { + bit = *(halui_new->jog_minus[num_axes]); + js = *(halui_new->joint_selected); + if (bit != (*halui_old->jog_minus)[num_axes]) { if (bit != 0) - sendJogCont(js, -*(halui_data->jog_speed)); + sendJogCont(js, -*(halui_new->jog_speed)); else sendJogStop(js); - old_halui_data.jog_minus[num_axes] = bit; + (*halui_old->jog_minus)[num_axes] = bit; } - bit = *(halui_data->jog_plus[num_axes]); - js = *(halui_data->joint_selected); - if (bit != old_halui_data.jog_plus[num_axes]) { + bit = *(halui_new->jog_plus[num_axes]); + js = *(halui_new->joint_selected); + if (bit != (*halui_old->jog_plus)[num_axes]) { if (bit != 0) - sendJogCont(js,*(halui_data->jog_speed)); + sendJogCont(js,*(halui_new->jog_speed)); else sendJogStop(js); - old_halui_data.jog_plus[num_axes] = bit; + (*halui_old->jog_plus)[num_axes] = bit; } for(int n = 0; n < num_mdi_commands; n++) { - if (check_bit_changed(halui_data->mdi_commands[n], &(old_halui_data.mdi_commands[n])) != 0) + if (check_bit_changed(halui_new->mdi_commands[n], ((halui_old->mdi_commands)[n])) != 0) sendMdiCommand(n); } } -- 1.7.1 ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers