|
|
@ -382,6 +382,7 @@ void posctl_gui_update() {
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.calib_axis2_lenma);
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.calib_axis2_lenma);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY(e_cal_a2lenma), txt);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY(e_cal_a2lenma), txt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY(e_posdevice), posctl.GetDevice().c_str());
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.out[0]);
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.out[0]);
|
|
|
|
gtk_label_set_text(GTK_LABEL(a1_out), txt);
|
|
|
|
gtk_label_set_text(GTK_LABEL(a1_out), txt);
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.out[1]);
|
|
|
|
strfromd (txt, sizeof(txt-1), (const char *)"%f", posctl.out[1]);
|
|
|
@ -598,7 +599,7 @@ void PosCtl::Loop (int posx, int posy) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PosCtl::SetDevice (std::string d) {
|
|
|
|
void PosCtl::SetDevice (std::string d) {
|
|
|
|
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
printf ("%s:%d %s new device:%s\n", __FILE__, __LINE__, __FUNCTION__, d.c_str());
|
|
|
|
OutputClose();
|
|
|
|
OutputClose();
|
|
|
|
device = d;
|
|
|
|
device = d;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -613,19 +614,50 @@ void PosCtl::OutputClose() {
|
|
|
|
|
|
|
|
|
|
|
|
void PosCtl::OutputOpen() {
|
|
|
|
void PosCtl::OutputOpen() {
|
|
|
|
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (device_fd > 0) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
device_fd = open (device.c_str(), O_RDWR);
|
|
|
|
|
|
|
|
if (device_fd < 0) {
|
|
|
|
|
|
|
|
printf ("%s:%d could not open device:%s Error:%s\n", __FILE__, __LINE__,
|
|
|
|
|
|
|
|
device.c_str(), strerror(errno));
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PosCtl::OutputWriteValue (int axis, double value) {
|
|
|
|
void PosCtl::OutputWriteValue (int axis, double value) {
|
|
|
|
|
|
|
|
char outbuf[255];
|
|
|
|
|
|
|
|
ssize_t len;
|
|
|
|
printf ("%s:%d %s Axis %d Value:%f\n", __FILE__, __LINE__, __FUNCTION__, axis, value);
|
|
|
|
printf ("%s:%d %s Axis %d Value:%f\n", __FILE__, __LINE__, __FUNCTION__, axis, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (device_fd <= 0) OutputOpen();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// save language setting and set to plain C
|
|
|
|
|
|
|
|
std::string s = setlocale(LC_ALL, NULL);
|
|
|
|
|
|
|
|
setlocale (LC_ALL, "C");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(outbuf, 254, "FIXME: dd:%f\n", value);
|
|
|
|
|
|
|
|
outbuf[254] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// reset language setting to default
|
|
|
|
|
|
|
|
setlocale (LC_ALL, s.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
len = write (device_fd, outbuf, strlen(outbuf));
|
|
|
|
|
|
|
|
if ((size_t) len != strlen(outbuf) || len < 0)
|
|
|
|
|
|
|
|
printf ("%s:%d could not open device:%s Error:%s\n", __FILE__, __LINE__,
|
|
|
|
|
|
|
|
device.c_str(), strerror(errno));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void PosCtl::OutputWriteStop (int axis) {
|
|
|
|
void PosCtl::OutputWriteStop (int axis) {
|
|
|
|
printf ("%s:%d %s Axis %d\n", __FILE__, __LINE__, __FUNCTION__, axis);
|
|
|
|
printf ("%s:%d %s Axis %d\n", __FILE__, __LINE__, __FUNCTION__, axis);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (device_fd <= 0) OutputOpen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PosCtl::OutputWriteStart (int axis) {
|
|
|
|
void PosCtl::OutputWriteStart (int axis) {
|
|
|
|
printf ("%s:%d %s Axis %d\n", __FILE__, __LINE__, __FUNCTION__, axis);
|
|
|
|
printf ("%s:%d %s Axis %d\n", __FILE__, __LINE__, __FUNCTION__, axis);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (device_fd <= 0) OutputOpen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|