?? mastercontroldlg.cpp
字號:
pos = AfxGetApp( )->GetProfileInt("Preferences", "Limits" , -99 );
if( pos == -99 )
{
CallPage( 5 ); // call property page #5 to replenish vars
return false; // then repeat
} else Limits = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "LPT1" , -99 );
if( pos == -99 )
{
CallPage( 1 ); // call property page #1 to replenish vars
return false; // then repeat
} else LPT1 = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "LPT2" , -99 );
if( pos == -99 )
{
CallPage( 1 ); // call property page #1 to replenish vars
return false; // then repeat
} else LPT2 = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "LPT3" , -99 );
if( pos == -99 )
{
CallPage( 1 ); // call property page #1 to replenish vars
return false; // then repeat
} else LPT3 = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "LPT4" , -99 );
if( pos == -99 )
{
CallPage( 1 ); // call property page #1 to replenish vars
return false; // then repeat
} else LPT4 = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "IO48" , -99 );
if( pos == -99 )
{
CallPage( 1 ); // call property page #1 to replenish vars
return false; // then repeat
} else IO48 = (pos != 0) ? true:false ;
// end of page 1 data //start of page 4 data
pos = AfxGetApp( )->GetProfileInt("Preferences", "SeekHome" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else SeekHome = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "Inches" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else Inches = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "ToolChange" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else ToolChange = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "SwapX" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else SwapX = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "SwapY" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else SwapY = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "SwapZ" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #1 to replenish vars
return false; // then repeat
} else SwapZ = (pos != 0) ? true:false ;
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_TCX" , " -9999");
ToolChangeX = atof( (LPCTSTR) buffer);
if( ToolChangeX == -9999 )
{
CallPage( 4 ); // call property page #4 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_TCY" , " -9999");
ToolChangeY = atof( (LPCTSTR) buffer);
if( ToolChangeY == -9999 )
{
CallPage( 4 ); // call property page #4 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_TCZ" , " -9999");
ToolChangeZ = atof( (LPCTSTR) buffer);
if( ToolChangeZ == -9999 ) // start of page 2 data
{
CallPage( 4 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XOverLap" , " -9999");
XOverLap = atof( (LPCTSTR) buffer);
if( XOverLap == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YOverLap" , " -9999");
YOverLap = atof( (LPCTSTR) buffer);
if( YOverLap == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZOverLap" , " -9999");
ZOverLap = atof( (LPCTSTR) buffer);
if( ZOverLap == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XWidth" , " -9999");
XWidth = atof( (LPCTSTR) buffer);
if( XWidth == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YWidth" , " -9999");
YWidth = atof( (LPCTSTR) buffer);
if( YWidth == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZWidth" , " -9999");
ZWidth = atof( (LPCTSTR) buffer);
if( ZWidth == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
XPpi = AfxGetApp( )->GetProfileInt("Preferences", "m_XPpi" , -9999);
if( XPpi == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
YPpi = AfxGetApp( )->GetProfileInt("Preferences", "m_YPpi" , -9999);
if( YPpi == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
}
ZPpi = AfxGetApp( )->GetProfileInt("Preferences", "m_ZPpi" , -9999);
if( ZPpi == -9999 )
{
CallPage( 2 ); // call property page #2 to replenish vars
return false; // then repeat
} // start of page 3 data
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XAcc" , " -9999");
XAcc = atof( (LPCTSTR) buffer);
if( XAcc == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YAcc" , " -9999");
YAcc = atof( (LPCTSTR) buffer);
if( YAcc == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZAcc" , " -9999");
ZAcc = atof( (LPCTSTR) buffer);
if( ZAcc == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XDec" , " -9999");
XDec = atof( (LPCTSTR) buffer);
if( XDec == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YDec" , " -9999");
YDec = atof( (LPCTSTR) buffer);
if( YDec == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZDec" , " -9999");
ZDec = atof( (LPCTSTR) buffer);
if( ZDec == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMaxCut" , " -9999");
XMaxCut = atof( (LPCTSTR) buffer);
if( XMaxCut == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMaxCut" , " -9999");
YMaxCut = atof( (LPCTSTR) buffer);
if( YMaxCut == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMaxCut" , " -9999");
ZMaxCut = atof( (LPCTSTR) buffer);
if( ZMaxCut == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMaxIps" , " -9999");
XMaxIps = atof( (LPCTSTR) buffer);
if( XMaxIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMaxIps" , " -9999");
YMaxIps = atof( (LPCTSTR) buffer);
if( XMaxIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMaxIps" , " -9999");
ZMaxIps = atof( (LPCTSTR) buffer);
if( YMaxIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_XMinIps" , " -9999");
XMinIps = atof( (LPCTSTR) buffer);
if( XMinIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMinIps" , " -9999");
YMinIps = atof( (LPCTSTR) buffer)- .01;
if( YMinIps < 0 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_ZMinIps" , " -9999");
ZMinIps = atof( (LPCTSTR) buffer);
if( ZMinIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
buffer = AfxGetApp( )->GetProfileString("Preferences", "m_YMinIps" , " -9999");
YMinIps = atof( (LPCTSTR) buffer);
if( YMinIps == -9999 )
{
CallPage( 3 ); // call property page #3 to replenish vars
return false; // then repeat
}
pos = AfxGetApp( )->GetProfileInt("Preferences", "XRamp" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #3 to replenish vars
return false; // then repeat
} else XRamp = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "YRamp" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #3 to replenish vars
return false; // then repeat
} else YRamp = (pos != 0) ? true:false ;
pos = AfxGetApp( )->GetProfileInt("Preferences", "ZRamp" , -99 );
if( pos == -99 )
{
CallPage( 4 ); // call property page #3 to replenish vars
return false; // then repeat
} else ZRamp = (pos != 0) ? true:false ;
if(Inches) m_Units.SetWindowText("Inches"); else m_Units.SetWindowText("mm's");
m_Units.Invalidate(TRUE);
XResmm = 25.4 / XPpi;
YResmm = 25.4 / YPpi;
ZResmm = 25.4 / ZPpi;
XResIn = 1 / XPpi;
YResIn = 1 / YPpi;
ZResIn = 1 / ZPpi;
if( Inches ) XRes = XResIn; else XRes = XResmm;
if( Inches ) YRes = YResIn; else YRes = YResmm;
if( Inches ) ZRes = ZResIn; else ZRes = ZResmm;
MaxRes = __min( XRes, YRes);
MaxRes = __min( MaxRes , ZRes );
XDir = false; YDir=false; ZDir = false;
XPulse = false; YPulse = false; ZPulse = false;
XDigPos = 0; YDigPos = 0; ZDigPos = 0;
XPulse = 0; YPulse = 0; ZPulse = 0;
XCurrent = 0; YCurrent = 0; ZCurrent = 0;
latency = CalcLatency();
XMidDelay = (1 / (XMaxCut * XPpi)) - latency;
if( XMidDelay < 0 ) XMidDelay = 0;
YMidDelay = (1 / (YMaxCut * YPpi)) - latency;
if( YMidDelay < 0 ) YMidDelay = 0;
ZMidDelay = (1 / (ZMaxCut * ZPpi)) - latency;
if( ZMidDelay < 0 ) ZMidDelay = 0;
XMaxDelay = (1 / (XMinIps * XPpi)) - latency;
if( XMaxDelay < 0 ) XMaxDelay = 0;
XMinDelay = (1 / (XMaxIps * XPpi)) - latency;
if( XMinDelay < 0 ) XMinDelay = 0;
YMaxDelay = (1 / (YMinIps * YPpi)) - latency;
if( YMaxDelay < 0 ) YMaxDelay = 0;
YMaxDelay += .0000001; // just to make Ramp differances for x and Y for algorithm
YMinDelay = (1 / (YMaxIps * YPpi)) - latency;
if( YMinDelay < 0 ) YMinDelay = 0;
ZMaxDelay = (1 / (ZMinIps * ZPpi)) - latency;
if( ZMaxDelay < 0 ) ZMaxDelay = 0;
ZMinDelay = (1 / (ZMaxIps * ZPpi)) - latency;
if( ZMinDelay < 0 ) ZMinDelay = 0;
XIncAccCut = ( XMaxDelay - XMidDelay ) / (XAcc * XPpi );
YIncAccCut = ( YMaxDelay - YMidDelay ) / (YAcc * YPpi );
ZIncAccCut = ( ZMaxDelay - ZMidDelay ) / (ZAcc * ZPpi );
XIncDecCut = ( XMaxDelay - XMidDelay ) / (XDec * XPpi );
YIncDecCut = ( YMaxDelay - YMidDelay ) / (YDec * YPpi );
ZIncDecCut = ( ZMaxDelay - ZMidDelay ) / (ZDec * ZPpi );
XIncAcc = (XMaxDelay - XMinDelay) / (XAcc * XPpi);
YIncAcc = (YMaxDelay - YMinDelay) / (YAcc * YPpi);
ZIncAcc = (ZMaxDelay - ZMinDelay) / (ZAcc * ZPpi);
XIncDec = (XMaxDelay - XMinDelay) / (XDec * XPpi);
YIncDec = (YMaxDelay - YMinDelay) / (YDec * YPpi);
ZIncDec = (ZMaxDelay - ZMinDelay) / (ZDec * ZPpi);
TimeCalc = 0;
TimeEstimate = 0;
Movements = NULL;
Times = NULL;
Incremental = false;
GMode = 0;
Axis = 1;
if( IO48 )
{
_outp( DCW, 0x80 ); // set ports to output
_outp( DA , 0x00 );
_outp( DB , 0x00 );
_outp( DC , 0x00 );
_outp( PCW, 0x80 ); // set ports to output
_outp( PA , 0x00 );
_outp( PB , 0x00 );
_outp( PC , 0x00 );
}
return true;
}
void CMasterControlDlg::CallPage(int page)
{
CPropertySheet *Prefs = new CPropertySheet( "Configuration");
if( page == 1) { CPropertyPage *pinsheet = new pinouts( ); Prefs->AddPage(pinsheet); }
if( page == 2) { CPropertyPage *pulsesheet = new pulses( ); Prefs->AddPage(pulsesheet); }
if( page == 3) { CPropertyPage *speedsheet = new speeds( ); Prefs->AddPage(speedsheet); }
if( page == 4) { CPropertyPage *homesheet = new homeconf( ); Prefs->AddPage(homesheet); }
if( page == 5) { CPropertyPage *auxsheet = new PropAux( ); Prefs->AddPage(auxsheet); }
if( page == 6) { CPropertyPage *feeds = new Feeds(); Prefs->AddPage( feeds ); }
Prefs->DoModal();
}
void CMasterControlDlg::PulseX(bool dir)
{
static int index = 0;
if( dir ) index++; else index--;
static DWORD RampSinCos32[32] = { 0x43f, 0x427, 0x473, 0x4fd, 0x525, 0x5f9, 0x671, 0x721,
0x3e1, 0x321, 0x271, 0x1f9 ,0x125, 0x0fd, 0x073, 0x027,
0x03e, 0x026, 0x072, 0x0fc, 0x124, 0x1f8, 0x270, 0x320,
0x7e0, 0x720, 0x670, 0x5f8 ,0x524, 0x4fc, 0x472, 0x426 };
IO48data &= 0xfff800;
IO48data |= RampSinCos32[ (index & 0x1f)];
XPulse = true;
if( !SwapX )XDir = dir; else XDir = !dir;
}
void CMasterControlDlg::PulseY(bool dir)
{
static int index = 0;
if( dir ) index++; else index--;
static DWORD RampSinCos32[32] = { 0x43f, 0x427, 0x473, 0x4fd, 0x525, 0x5f9, 0x671, 0x721,
0x3e1, 0x321, 0x271, 0x1f9 ,0x125, 0x0fd, 0x073, 0x027,
0x03e, 0x026, 0x072, 0x0fc, 0x124, 0x1f8, 0x270, 0x320,
0x7e0, 0x720, 0x670, 0x5f8 ,0x524, 0x4fc, 0x472, 0x426 };
IO48data &= 0xc007ff;
IO48data |= (RampSinCos32[ (index & 0x1f)]) << 11;
YPulse = true;
if( !SwapY )YDir = dir; else YDir = !dir;
}
void CMasterControlDlg::PulseZ(bool dir)
{
if( !dir ) IO48data |= 0x400000; // turn on reverse bit
else
IO48data &= 0xbfffff; // or clear it;
ZPulse = true;
if( !SwapZ )ZDir = dir; else ZDir = !dir;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -