Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Started working on support for UP Mini 2 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions UP3DCOMMON/up3dcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define VID (0x4745)
#define PID_MINI_A (0x0001)
#define PID_MINI_M (0x2777)
#define PID_MINI_2 (0x2790)
#define PID_PLUS (0x277d)
#define PID_CETUS_S7 (0x277f)
#define EP_OUT 1
Expand All @@ -40,7 +41,7 @@ bool UP3DCOMM_Open()
int r;

r = libusb_init( &_libusb_ctx );
if( r < 0 )
if( r < 0 )
{
printf( "[ERROR] USB Init: %d\n", r );
return false;
Expand All @@ -51,25 +52,28 @@ bool UP3DCOMM_Open()
_libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_A );
if( !_libusb_dev_handle )
_libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_M );

if( !_libusb_dev_handle )
_libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_PLUS );

if( !_libusb_dev_handle )
_libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_CETUS_S7 );


if( !_libusb_dev_handle )
_libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_2 );


if( !_libusb_dev_handle )
{
fprintf(stderr, "[ERROR] USB Open Device (%04X:%04X/%04X/%04X/%04X) not found\n", VID, PID_MINI_A, PID_MINI_M, PID_PLUS, PID_CETUS_S7 );
fprintf(stderr, "[ERROR] USB Open Device (%04X:%04X/%04X/%04X/%04X/%04X) not found\n", VID, PID_MINI_A, PID_MINI_M, PID_PLUS, PID_CETUS_S7, PID_MINI_2 );
UP3DCOMM_Close();
return false;
}

if( 1 == libusb_kernel_driver_active( _libusb_dev_handle, 0 ) )
libusb_detach_kernel_driver( _libusb_dev_handle, 0 );

if( libusb_claim_interface( _libusb_dev_handle, 0 ) < 0 )
if( libusb_claim_interface( _libusb_dev_handle, 0 ) < 0 )
{
fprintf(stderr,"[ERROR] USB Claim Interface\n");
UP3DCOMM_Close();
Expand Down
23 changes: 18 additions & 5 deletions UP3DCOMMON/up3dconf.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
up3dconf.c for UP3DTranscoder
M. Stohn 2016

This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand All @@ -20,7 +20,20 @@

settings_t settings;

settings_t settings_mini = {
settings_t settings_mini = {
.steps_per_mm = { 854.0, 854.0, 854.0 },
.max_rate = { 200, 200, 50 },
.acceleration = { 1500, 1500, 1500 },
.junction_deviation = 0.1,
.x_axes = 1, .y_axes = 0,
.x_dir = 1, .y_dir = -1, .z_dir = -1,
.x_hspeed_hi = 50.0, .y_hspeed_hi = 50.0, .z_hspeed_hi = 50.0, .x_hofs_hi = 4.0, .y_hofs_hi = 4.0, .z_hofs_hi = 6.0,
.x_hspeed_lo = 10.0, .y_hspeed_lo = 10.0, .z_hspeed_lo = 3.0, .x_hofs_lo = 9.0, .y_hofs_lo = 2.0, .z_hofs_lo = 2.0,
.heatbed_wait_factor = 20.0,
};

// experimental settings for the Mini 2
settings_t settings_mini2 = {
.steps_per_mm = { 854.0, 854.0, 854.0 },
.max_rate = { 200, 200, 50 },
.acceleration = { 1500, 1500, 1500 },
Expand All @@ -32,7 +45,7 @@ settings_t settings_mini = {
.heatbed_wait_factor = 20.0,
};

settings_t settings_classic_plus = {
settings_t settings_classic_plus = {
.steps_per_mm = { 644.0, 644.0, 854.0 },
.max_rate = { 200, 200, 50 },
.acceleration = { 1500, 1500, 1500 },
Expand All @@ -44,7 +57,7 @@ settings_t settings_classic_plus = {
.heatbed_wait_factor = 30.0,
};

settings_t settings_box = {
settings_t settings_box = {
.steps_per_mm = { 644.0, 644.0, 854.0 },
.max_rate = { 200, 200, 50 },
.acceleration = { 1500, 1500, 1500 },
Expand All @@ -58,7 +71,7 @@ settings_t settings_box = {

// experimental settings for the Cetus3D
// the steps_per_mm for the extruder has been measured on a prototype
settings_t settings_cetus = {
settings_t settings_cetus = {
.steps_per_mm = { 160.0, 160.0, 236.0 },
.max_rate = { 200, 200, 50 },
.acceleration = { 1500, 1500, 1500 },
Expand Down
5 changes: 3 additions & 2 deletions UP3DCOMMON/up3dconf.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
up3dconf.h for UP3DTranscoder
M. Stohn 2016

This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand All @@ -28,7 +28,7 @@

#define N_AXIS 3 // Number of axes (X,Y,A)

#define X_AXIS 0 // Axis indexing value.
#define X_AXIS 0 // Axis indexing value.
#define Y_AXIS 1
#define A_AXIS 2

Expand Down Expand Up @@ -62,6 +62,7 @@ typedef struct {
extern settings_t settings;

extern settings_t settings_mini;
extern settings_t settings_mini2;
extern settings_t settings_classic_plus;
extern settings_t settings_box;
extern settings_t settings_cetus;
Expand Down
23 changes: 14 additions & 9 deletions UP3DTRANSCODE/up3dtranscode.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
void print_usage_and_exit()
{
printf("Usage: up3dtranscode machinetype input.gcode output.umc nozzleheight [a_factor%%] [vmax_factor%%] [junction]\n\n");
printf(" machinetype: mini / classic / plus / box / Cetus\n");
printf(" machinetype: mini / mini2 / classic / plus / box / Cetus\n");
printf(" input.gcode: g-code file from slic3r/cura/simplify\n");
printf(" output.umc: up machine code file which will be generated\n");
printf(" nozzleheight: nozzle distance from bed (e.g. 123.45)\n");
Expand All @@ -44,26 +44,31 @@ void print_usage_and_exit()
int main(int argc, char *argv[])
{
bool power_off = true;

if( 5 > argc || 8 < argc )
print_usage_and_exit();

switch( argv[1][0] )
{
case 'm': //mini
memcpy( &settings, &settings_mini, sizeof(settings) );
// TODO: Support both mini and mini2
case 'm': //mini 2
memcpy( &settings, &settings_mini2, sizeof(settings) );
break;

/*case 'm': //mini*/
/* memcpy( &settings, &settings_mini, sizeof(settings) );*/
/* break;*/

case 'c': //classic
case 'p': //plus
memcpy( &settings, &settings_classic_plus, sizeof(settings) );
break;

case 'b': //box
memcpy( &settings, &settings_box, sizeof(settings) );
break;
case 'C': //cetus

case 'C': //cetus
memcpy( &settings, &settings_cetus, sizeof(settings) );
power_off = false;
break;
Expand All @@ -72,7 +77,7 @@ int main(int argc, char *argv[])
printf("ERROR: Uknown machine type: %s\n\n",argv[1] );
print_usage_and_exit();
}

if (6 <= argc)
{
double factor;
Expand Down Expand Up @@ -114,7 +119,7 @@ int main(int argc, char *argv[])
settings.junction_deviation = junction;
//printf(";use junction %.5f\n", junction);
}

double nozzle_height;
if( 1 != sscanf(argv[4],"%lf", &nozzle_height) )
{
Expand Down