Configtool: make KINEMATICS a set of booleans, too.

Reasons:

 - Less code, easier handling.

 - An entire case of configuration handling could be removed.

 - Better class-like encapsulation.
This commit is contained in:
Markus Hitter 2016-04-13 20:50:07 +02:00
parent 1fad0036a7
commit 4645715f18
9 changed files with 26 additions and 45 deletions

View File

@ -35,23 +35,6 @@ acceleration there are three different and mutually exclusive variable names:
All of these names MUST appear in the header file (with at most one of them
un-commented out).
However, the variable KINEMATICS only has a finite set of values and would
seem to be a similar field, but there is only one variable name: KINEMATICS
- so it should only appear once.
This is ok:
//#define KINEMATICS KINEMATICS_STRAIGHT
as is this:
#define KINEMATICS KINEMATICS_STRAIGHT
but this is not:
#define KINEMATICS KINEMATICS_STRAIGHT
//#define KINEMATICS KINEMATICS_COREXY
Help Text - both board and printer files
----------------------------------------

View File

@ -6,6 +6,7 @@
\***************************************************************************/
/** \def KINEMATICS_STRAIGHT KINEMATICS_COREXY
This defines the type of kinematics your printer uses. That's essential!
Valid values (see dda_kinematics.h):
@ -20,7 +21,8 @@
are long and crossing toothed belts and a print head
moving on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
//#define KINEMATICS_COREXY
/** \def STEPS_PER_M_X STEPS_PER_M_Y STEPS_PER_M_Z STEPS_PER_M_E
Steps per meter ( = steps per mm * 1000 ), calculate these values

View File

@ -6,6 +6,7 @@
\***************************************************************************/
/** \def KINEMATICS_STRAIGHT KINEMATICS_COREXY
This defines the type of kinematics your printer uses. That's essential!
Valid values (see dda_kinematics.h):
@ -20,7 +21,8 @@
are long and crossing toothed belts and a print head
moving on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
//#define KINEMATICS_COREXY
/** \def STEPS_PER_M_X STEPS_PER_M_Y STEPS_PER_M_Z STEPS_PER_M_E
Steps per meter ( = steps per mm * 1000 ), calculate these values

View File

@ -6,6 +6,7 @@
\***************************************************************************/
/** \def KINEMATICS_STRAIGHT KINEMATICS_COREXY
This defines the type of kinematics your printer uses. That's essential!
Valid values (see dda_kinematics.h):
@ -20,7 +21,8 @@
are long and crossing toothed belts and a print head
moving on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
//#define KINEMATICS_COREXY
/** \def STEPS_PER_M_X STEPS_PER_M_Y STEPS_PER_M_Z STEPS_PER_M_E
Steps per meter ( = steps per mm * 1000 ), calculate these values

View File

@ -6,6 +6,7 @@
\***************************************************************************/
/** \def KINEMATICS_STRAIGHT KINEMATICS_COREXY
This defines the type of kinematics your printer uses. That's essential!
Valid values (see dda_kinematics.h):
@ -20,7 +21,8 @@
are long and crossing toothed belts and a print head
moving on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
//#define KINEMATICS_COREXY
/** \def STEPS_PER_M_X STEPS_PER_M_Y STEPS_PER_M_Z STEPS_PER_M_E
Steps per meter ( = steps per mm * 1000 ), calculate these values

View File

@ -184,23 +184,14 @@ class MechanicalPage(wx.Panel, Page):
def insertValues(self, cfgValues):
Page.insertValues(self, cfgValues)
k = 'KINEMATICS'
if k in cfgValues.keys():
k = cfgValues[k]
if k in self.kinematicsKeys:
self.radioButtons[k].SetValue(True)
else:
self.radioButtons[self.kinematicsKeys[0]].SetValue(True)
else:
self.radioButtons[self.kinematicsKeys[0]].SetValue(True)
for tag in self.kinematicsKeys:
if tag in cfgValues.keys() and cfgValues[tag]:
self.radioButtons[tag].SetValue(True)
def getValues(self):
result = Page.getValues(self)
for tag in self.kinematicsKeys:
rb = self.radioButtons[tag]
if rb.GetValue():
result['KINEMATICS'] = tag, True
break
result[tag] = self.radioButtons[tag].GetValue()
return result

View File

@ -6,6 +6,7 @@
\***************************************************************************/
/** \def KINEMATICS_STRAIGHT KINEMATICS_COREXY
This defines the type of kinematics your printer uses. That's essential!
Valid values (see dda_kinematics.h):
@ -20,7 +21,8 @@
are long and crossing toothed belts and a print head
moving on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
#define KINEMATICS_COREXY
/** \def STEPS_PER_M_X STEPS_PER_M_Y STEPS_PER_M_Z STEPS_PER_M_E
Steps per meter ( = steps per mm * 1000 ), calculate these values

View File

@ -1,16 +1,12 @@
#ifndef _DDA_KINEMATICS_H
#define _DDA_KINEMATICS_H
#include "config_wrapper.h"
#include <stdint.h>
#include "dda.h"
#define KINEMATICS_STRAIGHT 1
#define KINEMATICS_COREXY 2
//#define KINEMATICS_SCARA 3
#include "config_wrapper.h"
void carthesian_to_carthesian(TARGET *startpoint, TARGET *target,
axes_uint32_t delta_um, axes_int32_t steps);
@ -27,11 +23,11 @@ static void code_axes_to_stepper_axes(TARGET *, TARGET *, axes_uint32_t,
inline void code_axes_to_stepper_axes(TARGET *startpoint, TARGET *target,
axes_uint32_t delta_um,
axes_int32_t steps) {
#if KINEMATICS == KINEMATICS_STRAIGHT
#if defined KINEMATICS_STRAIGHT
carthesian_to_carthesian(startpoint, target, delta_um, steps);
#elif KINEMATICS == KINEMATICS_COREXY
#elif defined KINEMATICS_COREXY
carthesian_to_corexy(startpoint, target, delta_um, steps);
// #elif KINEMATICS == KINEMATICS_SCARA
// #elif defined KINEMATICS_SCARA
// return carthesian_to_scara(startpoint, target, delta_um, steps);
#else
#error KINEMATICS not defined or unknown, edit your config.h.

View File

@ -78,7 +78,8 @@
long and crossing toothed belts and a print head moving
on the X-Y-plane.
*/
#define KINEMATICS KINEMATICS_STRAIGHT
#define KINEMATICS_STRAIGHT
//#define KINEMATICS_COREXY
/** \def STEPS_PER_M